• The board is made up of 100 squares, starting form 1 up to 100.
• There are 6 snakes on the board. For example, the green snake's head is in square 31 & its
tail is in square 4. If you land on its head square 31 then you move down to its tail square 4.
• There are 6 ladders located on the board. For example, the first ladder's bottom is in square 3
& its top is in square 39. If you land on its bottom square 3 then you up to its top square 4.
• The head of a snake is must always be higher up the board than its tail, similarly a ladder's
bottom must always be lower down the board than its top.
• A square cannot be both a head & a tail square for either the same snake or different snakes.
Similarly a square cannot be both a bottom & a top square for either the same ladder or
• In other words, a square can only contain: nothing (a normal square), or 1 snake's head, or 1
snake's tail, or 1 ladder's bottom, or 1 ladder's top.
• For obvious reasons:
• a snake's head cannot be in the first or last squares,
• a ladder's bottom can not be located on the top row.
• The state of the game includes the following:
• the current position on the board,
• the dice value last thrown,
• the number of moves,
• the number of snakes gone down,
• the number of ladders gone up,
• the list of squares visited in the order visited.
2 Develop a B Specification of the Snakes & Ladders board game
Your B specification, i.e. collection of 1 or more B machines, should include the following elements.
2.1 Sets and Constants
Any sets, constants and properties that are required to define the data and state of the board and
state of a player playing the game.
(Hint: you should not try to represent the board as a grid.)
2.2 System State
The state variables required to represent: the player's position on the board, the number of snakes
and ladders that have been encountered, the number of turns taken. In addition the list of squares
that have been visited in the order visited. This should include all empty squares landed on, for a
snake encounter this would be two, its head and tail squares, for a ladder encounter this would be
two, its bottom and top squares. The most recent dice value that was thrown.
Including the state invariant and initialisation.
The system has the following four operations.
A move operation that adds the last thrown dice value to the current position on the board then takes
what ever action is appropriate for the square landed on. That is either: go down a snake, go up a
ladder, do not move as the new square is above 100, land on the last square and win, or just landed
on a normal square.
The move operation must report its outcome:
• a message indicating that the move either went down a snake, up a ladder, threw too high a
dice value to finish, finished and won, landed on a normal square,
• the square it occupies as a result of the move.
Outputs the current statistics for the game: current position on the board, the number of snakes and
ladders encountered, number of turns taken.
Outputs the list of squares that have been visited in the order visited.
Reinitialises the game so that a new game can be started and outputs a message stating a new game
5 pekerja bebas membida secara purata £98 untuk pekerjaan ini
Heyy I am expert and I have already made snake and ladder game in java and I can help you with your project message me to discuss so that we can start working on it