diff --git a/container/Dockerfile b/container/Dockerfile index 8c5a763..6c9cc3f 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -6,9 +6,14 @@ RUN apk add \ --update \ autoconf \ g++ \ - make \ - && pecl install \ - xdebug-2.7.2 + make + +ADD xdebug-2.7.2.tgz / +RUN cd /xdebug-2.7.2 \ + && phpize \ + && ./configure --enable-xdebug \ + && make \ + && make install # done, copy binaries from build stage FROM php:7.0-cli-alpine as final @@ -16,5 +21,4 @@ LABEL maintainer="andre.rademacher.business@googlemail.com" COPY --from=build /usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini COPY --from=composer/composer:2.2-bin /composer /usr/local/bin/composer -USER 1000 WORKDIR /codewars/php70 diff --git a/container/xdebug-2.7.2.tgz b/container/xdebug-2.7.2.tgz new file mode 100644 index 0000000..c128d4d Binary files /dev/null and b/container/xdebug-2.7.2.tgz differ diff --git a/kata/RomanNumeralsDecoder/Instructions.md b/kata/RomanNumeralsDecoder/README.md similarity index 100% rename from kata/RomanNumeralsDecoder/Instructions.md rename to kata/RomanNumeralsDecoder/README.md diff --git a/kata/SnakesAndLadders/README.md b/kata/SnakesAndLadders/README.md new file mode 100644 index 0000000..af4457f --- /dev/null +++ b/kata/SnakesAndLadders/README.md @@ -0,0 +1,54 @@ +# Snakes and ladders + +## Introduction +Snakes and Ladders is an ancient Indian board game regarded today as a worldwide classic. +It is played between two or more players on a gameboard having numbered, gridded squares. +A number of "ladders" and "snakes" are pictured on the board, +each connecting two specific board squares. (Source Wikipedia) + +## Task + +Your task is to make a simple class called SnakesLadders. +The test cases will call the method play(die1, die2) +independantly of the state of the game or the player turn. +The variables die1 and die2 are the die thrown in a turn +and are both integers between 1 and 6. +The player will move the sum of die1 and die2. + +## The board + +![board.jpg](board.jpg) + +## Rules + +1. There are two players and both start off the board on square 0. +2. Player 1 starts and alternates with player 2. +3. You follow the numbers up the board in order 1=>100. +4. If the value of both die are the same then that player will have another go. +5. Climb up ladders. + The ladders on the game board allow you to move upwards and get ahead faster. + If you land exactly on a square that shows an image of the bottom of a ladder, + then you may move the player all the way up to the square at the top of the ladder + (even if you roll a double). +6. Slide down snakes. + Snakes move you back on the board because you have to slide down them. + If you land exactly at the top of a snake, slide move the player all the way + to the square at the bottom of the snake or chute (even if you roll a double). +7. Land exactly on the last square to win. + The first person to reach the highest square on the board wins. + But there's a twist! If you roll too high, your player "bounces" off the last square + and moves back. You can only win by rolling the exact number needed to land + on the last square. For example, if you are on square 98 and roll a five, + move your game piece to 100 (two moves), then "bounce" back to 99, 98, 97 (three, four then five moves). +8. If the Player rolled a double and lands on the finish square “100” + without any remaining moves then the Player wins the game and does not have to roll again. + +## Returns + +- Return `Player n Wins!`. + Where n is winning player that has landed on square 100 without any remainding moves left. +- Return `Game over!` if a player has won and another player tries to play. +- Otherwise, return `Player n is on square x`. + Where n is the current player and x is the sqaure they are currently on. + +[See this kata in Codewars](https://www.codewars.com/kata/587136ba2eefcb92a9000027) diff --git a/kata/SnakesAndLadders/SnakesLadders.php b/kata/SnakesAndLadders/SnakesLadders.php new file mode 100644 index 0000000..c661847 --- /dev/null +++ b/kata/SnakesAndLadders/SnakesLadders.php @@ -0,0 +1,18 @@ + $diceThrow) { + self::assertSame($expectedOutput[$key], $game->play(...$diceThrow)); + } + } + + public function providePlay(): Generator + { + yield 'Player 1 just throws 1 & 1' => [ + [ + 'Player 1 is on square 38', + ], + [ + [1, 1], + ] + ]; + } +} \ No newline at end of file diff --git a/kata/SnakesAndLadders/board.jpg b/kata/SnakesAndLadders/board.jpg new file mode 100644 index 0000000..20032e3 Binary files /dev/null and b/kata/SnakesAndLadders/board.jpg differ diff --git a/kata/TicTacToeChecker/Instructions.md b/kata/TicTacToeChecker/README.md similarity index 100% rename from kata/TicTacToeChecker/Instructions.md rename to kata/TicTacToeChecker/README.md