Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to implement a computer-based variant of the game Snake and Ladder using C++. This is a game mainly for two players who play

You are to implement a computer-based variant of the game Snake and Ladder using C++. This is a game mainly for two players who play against each other. The basic game of Snake and Ladder is a simple press-your-luck game with one winner. Players score points by moving up on the board. The player who reaches the end of the board first is the winner!

Basic Game Play:

In this program, the game has a board with fifty squares. The player starts at the first square, and they have to manoeuvre through snakes and ladders to get to the 50th square.

There should be at least one dice for the snakes and ladders board game and one pawn per player.

The basic game play is as follows:

Initialize: The players each roll six-sided dice. The game starts on the left, and each successive roll enables a player to move his/her piece to the right. Ultimately, the game is won when the first players piece gets to level 50, which is on the right.

To place the snakes and ladders on the board, you need three snakes and three ladders.

The Snake

I. The first snake is represented as S1 and is placed on square 17 and 36 with tail on 17 and head on 36,

Ii. The second snake S2 placed on square 3 and 41 with tail on 3 and head

on 41 and

Iii. The third snake S3 placed on square 14 and 44 with tail on 14 and head on 44.

The Ladder

I. The first ladder is represented by L1 and is placed on square 4 and 25 with bottom on 4 and top on 25,

Ii. The second ladder is represented by L2 and is placed on square 8 and 34 with bottom on 8 and top on 34 and

Iii. The third Ladder L3 is placed on square 12 and 31 with bottom on 12 and top on 31

To start the game, the player with the highest roll gets to be player one, and the player with the least score becomes the last player.

Players turn : Each player has a turn. They roll the dice and move the number of squares scored in the roll. According to the Snake and Ladders rules, when a player lands on a snake, he/she must go back to the tail of the snake. In comparison, the ladder acts as a shortcut. Snake and Ladders rules are enthralling. Another twist is when you roll a dice and and at the tail of the snake, you will stay in the same spot. Equally, when you land at the top of the ladder, you will not climb down.

No move : To win the game, Snake and Ladders rules require a player to roll the dice and get the exact steps needed to win the game. Say if you are left with two spots, then your dice roll must indicate 2. If you get six, you will stay in the same spot.

Winning the Game : There is only one winner. According to the Snakes and Ladders rules, the first player that successfully gets to the 50th square wins the game.

You MUST implement your program using the following classes, as a minimum, you may include more (as appropriate for your game design):

Player class: holds the players details including their name, current score and a collection of cards (the players stack in the game).

Board class: holds the board details including the shortcuts and hazards, a visual representation of the board and its squares.

Application file: holds the main() function and controls the overall flow of the game.

You may include other relevant attributes and behaviours to these classes, as identified in your project plan.

The Player must be able to do the following:

assign a name which is requested at the start of the game and used in the feedback given

rolls the dice to generate a random number and see appropriate feedback as a result

continue playing until a winner is found

quit the game at any time during or after a game

The Board in the game should have the following characteristics:

have 50 squares

have three ladders and three snakes

display a visual representation of the board (eg: square 1 as 1, snake 1 as S1 and ladder 1 as L1 etc.)

The Game Application must do the following:

display the how to play information at the start of the game create the players and a board with hundred squares with four snakes and four ladders.

display an appropriate and uncluttered user interface providing relevant information to the player at all times

ask for and allow the player to roll the dice or quit the game

display the updated player score after each roll

terminate the game (a player wins) when one player reaches the end of the board.

provide player stats at the end of the game (wins, loses and score)

the player should be able to QUIT the game at any time

Criteria to be followed :

Having at least two more classes in the game. [5]

The player can set the number of squares that they want to play with. [5]

Implement the bounce back rule which is when the player is only a few squares away from the end of the board. Such as if the player is left with two spots, then his/her dice roll must indicate 2. If he/she gets a six, then the player will move two places to 50 and then be forced to move back four steps to 46. [5]

Implement the strategy of roll twice. Snakes and Ladders rules occasionally award a player two turns. If you roll the dice and are lucky enough to get six, you will be given an opportunity to roll the dice again. The opportunity to keep rolling the dice will continue until the streak runs out. [5]

You could use any other formula for calculations. The formula must be given in the instructions or game rules. [5]

Display the Board using ASCII art. You can use different images related to a theme or patterns for the numbers, snakes and ladders. [5]

Allow the game to be saved and restored at the players request. [5]

Continuous Snake and Ladder alternative game play option. The players must select which version of the game (such as how many squares, snakes and ladder) to play at the start of the game. This version is almost the same as the basic one, but it is a single long round, rather than several short ones. When the player reaches the end of the board then also the player can select to play again but with increased difficulty such as next level with more or next level with more hazards etc. [5]

Allow the game to be played with multiple players, more than two. The game allows you to find the loser instead of the winner. The player who reaches the end of the board last is the loser. [5]

image text in transcribed

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

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

2. Identify the purpose of your speech

Answered: 1 week ago