Application Kata "Ladder game"

Develop an application that allows 2 to 4 people to use the Ladder game (snakes and ladders) can play.

You can download the sample data here.

Application Kata Leiterspiel - Clean Code Developer Akademie

In the ladder game, players have to move their token from the start at the bottom left to the finish at the top left. The first player to place their tile on the target space wins.

For each move, a die is rolled to determine how many spaces the token may be moved. The game should be played with one dice.

If the tile comes to rest on a square where a ladder begins (e.g. square 3), it automatically climbs to the square at the end of the ladder (e.g. square 11).

If the tile comes to rest on a square on which the head of a snake is located (e.g. square 14), it automatically slides back to the square at the end of the snake (e.g. 6).

The players roll the dice in turn. Each player has one roll per round [1].

On their first turn, each player places their token on the board. If you roll a 1, you immediately step onto a ladder on the board above, as does anyone who rolls a 3.

At the start of the game, the number of players is determined and a game board is selected.

A game can be started at any time. This cancels the current game.

At the end of the game, i.e. when the first player has reached the goal, the winner is shown and the dice are no longer rolled.

Each player should make their roll explicitly, e.g. by clicking on a dice.

Data

Game boards are available as image files as above and are accompanied by a file with metadata, e.g. ladderboard1.jpg and ladderboard1.txt.

The metadata defines the number of rows and columns and describes where ladders and snakes are located. Example of the game board above:

Gameboard=laddergameboard1.jpg

Rows=8
Columns=8

ladder=1,30
Ladder=3 , 11
Ladder=7,25
Ladder=17.34
Ladder = 22.52
ladder=40,54
Ladder=41.57
Ladder=48.64

Snake=14.6
 Snake = 39 , 23
Snake=45.33
Snake=47.19
snake=53.13
Snake=61.46

Whitespace is to be ignored in the metadata file; however, each piece of information is limited to one line of text.

The following game board file formats are available .jpg and .png to accept.

The specifications for the board, rows and columns are mandatory. The number of ladders and snakes is arbitrary (0..n).

In the game board drawing, the fields are to be assumed to be the same size and evenly distributed horizontally and vertically.

Variation #1

If a player rolls a 6, it is his turn again.

Variation #2

If a tile comes to rest on a square with another tile, it is "beaten" and must return to the start.

Variation #3

Which player starts is decided by dice. Each player rolls the dice once before the first round. The player with the highest number starts.

Players with the same number continue to roll the dice until there is a clear "winner".

Endnotes

[1] The players decide among themselves which player starts. The application always begins with the first tile in its list. The players assign themselves to the tiles.

en_USEnglish