Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

Define a constructive obligation.

Answered: 1 week ago

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago