Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ STDIN Mancala: Each square, except the end zones (the long rectangles ones on the sides of the board) start with 3 marbles inside of

C++

STDIN

Mancala:

Each square, except the end zones (the long rectangles ones on the sides of the board) start with 3 marbles inside of them. The end zones start empty. This is a two person game, and each person has their own end zone. Player 1 has the end zone on the right and player 2 has the end zone on the left. The goal is to get as many pieces into your end zone. Each player takes a turn to move the marbles until a players end zone has 5 marbles in it. Then the game is over. Once that happens the marbles in the 4 right hand holes go into the right end zone, and the 4 on the left go to the left end zone, leaving the middle square untouched. Once the pieces have been distributed the winner is determined by who has the most marbles in their end zone.

On a players turn they move by selecting any hole with marbles in it, except the end zones. They pick up all the marbles in that hole and start traveling along the red path of movement dropping one marble in each hole they pass. The starting hole does not get a marble unless you pass over it again. If the player goes over their opponents end zone they skip over it without dropping a marble; but if they pass their own end zone they will drop a marble in it. The turn ends once the player has dropped all of the marbles they had in their hand. If the player finishes a turn by dropping their last marble in their own end zone they get another turn.

Player 1 will be a human while the other will be a computer player.

The computer player selects a hole following the following decision logic:

If there is a hole with enough pieces to finish the turn in the computer players end zone, select it. Otherwise select the hole on the right to left path with the greatest amount of marbles. If there are no marbles on that path then select the hole closest to the opponents end zone.

It is highly suggested, but not required, to pause the output after the computer makes a move to allow the user to interpret the output before more gets printed out. Look into cin.get();

The program should not allow the player to enter incorrect selections. The player cannot select a nonexistent hole, the end zones, or an empty hole.

Look at the example output for an example for how to output the game board formatted in a nice way.

You must tell the player what input is valid. For example, the example outputs show a board next to the game board showing how the bins are labeled.

Implement at least 4 ADTs.

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions