Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
add day 4
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaswell committed Dec 4, 2018
1 parent 1fda25c commit c7f276d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode
4-crazy-eights/gameBuilder.go
22 changes: 22 additions & 0 deletions 4-crazy-eights/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: all
all: go js php py

.PHONY: go
go:
@echo "go"
docker run --rm -it `docker build -q -f go.Dockerfile .`

.PHONY: js
js:
@echo "js"
docker run --rm -it `docker build -q -f js.Dockerfile .`

.PHONY: php
php:
@echo "php"
docker run --rm -it `docker build -q -f php.Dockerfile .`

.PHONY: py
py:
@echo "py"
docker run --rm -it `docker build -q -f py.Dockerfile .`
30 changes: 30 additions & 0 deletions 4-crazy-eights/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Day 4 - Crazy Eights

Crazy Eights is a very popular game at the North Pole, but there are no playing
cards and the rules are completely different...

**Running `./newGame` in this directory outputs a new game of Crazy Eights.**

One elf will write a [7x7] matrix of digits between 0 and 9. Each digit in the
matrix has an equal chance of being any of the ten possible digits. Once the
matrix is complete, competing elves must find the sum of the count of 8s for
each row and each column then add the values of the two new [1x7] matrices.

Write a function that can solve a game of Elven Crazy Eights.

Example:
```
[2 4 8 2 0 4 1] -> 1
[5 1 2 7 6 2 1] -> 0
[0 0 0 3 2 4 4] -> 0
[3 1 5 3 5 2 2] -> 0
[8 2 4 6 3 1 4] -> 1
[1 0 8 8 5 4 8] -> 3
[0 4 2 2 6 1 6] -> 0
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
[1 0 2 1 0 0 1] |
[1 0 0 0 1 3 0] <- ⌟
+
[2 0 2 1 1 3 1] Solution
```
3 changes: 3 additions & 0 deletions 4-crazy-eights/go.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM golang:1-alpine
COPY crazy-eights.go .
CMD [ "go", "run", "crazy-eights.go" ]
3 changes: 3 additions & 0 deletions 4-crazy-eights/js.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM node:lts-alpine
COPY crazy-eights.js .
CMD [ "node", "crazy-eights.js" ]
Binary file added 4-crazy-eights/newGame
Binary file not shown.
3 changes: 3 additions & 0 deletions 4-crazy-eights/php.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7-cli-alpine
COPY crazy-eights.php .
CMD [ "php", "crazy-eights.php" ]
3 changes: 3 additions & 0 deletions 4-crazy-eights/py.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM python:3-alpine
COPY crazy-eights.py .
CMD [ "python", "crazy-eights.py" ]

0 comments on commit c7f276d

Please sign in to comment.