Question
Snake and Ladder is a two player game, played on 2-D board, in which every player roll a dice on its turn and move forward
Snake and Ladder is a two player game, played on 2-D board, in which every player roll a dice on its turn and move forward according to number appears on dice.
In this assignment you have to implement a Snake and Ladder Game with some extra functionalities. In this game different cells of game board can contain different objects,
list of objects and their corresponding points are given below.
Gold Coins | 10 Points for each | |
Silver Coins | 5 Points for each | |
Diamond | 50 Points for each | |
Prison cell | -20 Points | |
Sword | 0 Points | |
Shield | 0 Points |
A basic layout of Game board is presented in figure below.
Rules of game are listed here.
Winner/Loser: A winner of game is decided on the basis of two things number of points earned and last cell. If a player reached in last cell but has less number of points than other player, then game will draw. A winner must have reached to last cell with more points than other player.
If a player found an object in any cell he can put that in his bag so that he can use it and gain points. Once a player picked an object, then it will be removed from that cell and game board should update accordingly.
Sword: When a player enters in a cell with snake head then, he can kill the snake with sword and move on without losing any points. Sword can be used only once in life of a player.
Shield: When a player enters in a cell with snake head then, he can use his shield to protect him against snake attack, this will also be used once.
Prison cell: If any player enters in prison cell his next three turns are skipped and he lose 20 points. After three turns of other player, he can come out of prison.
Diamond: If a player has diamond in the bag and he enters in a prison cell, then he can sell his diamond to come out of prison immediately but the player will lose points of diamond.
Gold and Silver Coins: If a player is attacked by the snake and he has gold or silver coins, then he can use 3 gold coins or 6 silver coins to move two rows up from cell where he reached by snake attack. Points of player will also be deducted for using gold and silver coins.
Other Requirements:
Dynamic Board: Your game should support dynamic size of board minimum 55 (25 cells) to
maximum 1010 (100 cells).
Objects: Each time when a new game is started, number and placement of objects will be random. You can place minimum 5 and maximum 5+5 objects on the 55 (25 cells) board similar calculations will be used for larger board like minimum 10 to 20 objects on 1010 (100 cells) board. The snakes and ladders will also be placed in random cells. Size of all snakes and ladders should be different and random too.
User Interaction: Your game should be user interactive and should provide proper options to player, which he can use for every move. Like pick an object from cell, kill the snake, use an object etc. The dice of user will be rolled by system using a random number and dice will be six sided.
You do not need to provide any graphical user interface for game, but create neat and clean board on console and you can write name of objects in cells where they will present. Similarly you will update both users Bags, points and cells information accordingly.
Happy Programming
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