snakes and ladders machine in atelier b

Zaprto Objavljeno pred 2 letoma/leti Plačilo ob prevzemu
Zaprto Plačilo ob prevzemu

Notes

• 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

different 's.

• 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.

2.3 Operations

The system has the following four operations.

2.3.1 Move

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.

2.3.2 GameStatistics

Outputs the current statistics for the game: current position on the board, the number of snakes and

ladders encountered, number of turns taken.

2.3.3 VisitedSquares

Outputs the list of squares that have been visited in the order visited.

2.3.4 NewGame

Reinitialises the game so that a new game can be started and outputs a message stating a new game

has started.

Coding Java Programming Razvoj programske opreme

ID projekta: #32712524

Več o projektu

5 predlogov Oddaljen projekt Aktiven pred 2 letoma/leti

5 freelancerjev ponuja v povprečju za £98 na tem delu

mirzaahamza

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

£50 GBP v 1 dnevu
(37 ocen)
4.9
Muhammadsamran

Hello Sir/ Ma’am A skilled full stack developer, I have rich experience in JAVA,C, C++, C#, Python, .NET , MYSQL, SQL, IONIC , MATLAB,PHP and ARDUINO. I am very confident with my skills and I'd like to help your bu Več

£20 GBP v 1 dnevu
(28 ocen)
5.6
nachitayadav8

Hi, i will do snakes and ladders machine in atelier b I am an experienced Android and ios developer and equipped with all the necessary skills to provide you best website that completely satisfies your business ne Več

£135 GBP v 7 dneh
(1 Ocena)
0.3
Kttrine26

Dear, Client Your descriptioin impressed me from my high skills in Java and JavaScript. Interesting job. I have ever worked on serveral projects in Java and JavaScript for 5 years. As a fullstack and full time develope Več

£150 GBP v 7 dneh
(0 ocen)
0.0
ngallearsene2

Hi , I will do the work in a clear, concise way. I am a Java Developer with 3 years of experience. I have worked on several similar projects and can deliver quality work to tight deadlines. I'm interested to hear Več

£135 GBP v 7 dneh
(0 ocen)
0.0