Question
write in C++ write a program that plays snakes and ladders. How to play: Each player puts their counter on the tile that says 'start
write in C++
write a program that plays snakes and ladders.
How to play:
Each player puts their counter on the tile that says 'start here'. Take it in turns to roll the dice. Move your counter forward the number of spaces shown on the dice. If your counter lands at the bottom of a ladder, you can move up to the top of the ladder. If your counter lands on the head of a snake, you must slide down to the bottom of the snake. The first player to get to the space that says 'home' is the winner.
What data structures do you need?
A Tile
A Tile has at least one property - you may decide to add more properties - the destination property.
The tile's destination property describes five kinds of tiles - ordinary, head of snake, tail of snake, top of ladder, and bottom of ladder.
A ladder's bottom's destination property is the ladder's top's position in the array.
What should a ladder's top's destination property be?
What should a snake's head's destination property be?
What should a snake's tail's destination property be?
A dynamic 1D array of Tiles
Read a description of the tiles from a file. You don't have to read the properties of ordinary tiles, snakes' tails or ladders' tops.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started