9.ICE.2: TDD
Implement a JavaScript module for the dice game passage. The rules are as follows.
HOW TO PLAY PASSAGE What you need:
2 dice 2 or more players
Objective: to be the first player to reach 11 points.
To set up the game each player rolls a die. The highest scoring roll will be the player who begins the game. The player who rolled the lowest number will now roll a second time and the number on the die becomes the “point number.”
Starting with the first player, players take turns rolling two dice. If he rolls the point number, he gets one point. If he rolls doubles of the point number he gets two points. Each player gets only one roll per turn.
The first player to get 11 points wins.
The module should take in a game state object and return an object with the new state for that game.


Code the game in a TDD style. Begin by writing a base test case. and then writing the code that passes that test.
To get an idea of how the game module code should be setup, refer to 9.2.2: TDD
Copy link