Starting from:

$30

ECS34-Project 3 Mancala Game Solved

You are given the fix a given project that was developed by another developer. The project was a mancala game, the rules will be defined below. The existing game will work, but it is extremely buggy. The developer would compile the project using manual calls to g++ instead of using a Makefile and didn’t use test driven design. The developer also did not use revision control, so you will be adding revision control with git. You are tasked with creating a Makefile for the project that will run compile/link a test program and the project. You will develop a set of tests have check correctness for the game. Once you have created the tests, you will then fix the existing code. You have been provided with the source files, and a skeleton test file.

 

•      Only used Conventional Macros should be declared (e.g. CXX, but not AR)

•      The tests must be successfully run prior to building of mancala game

•      For each target all true dependencies must be listed

•      The Makefile must have a clean to remove object files, core dumps, etc.

•      A conventional naming scheme must be used to organize the project files (source files, object files, etc.)

•      The Makefile must build and run the tests and mancala game on the CSIF without modification

You need to create a git repository for your project. You should initialize it on github and then after cloning add the project files using the directory structure you have chosen. The following video https://www.youtube.com/watch?v=HVsySz-h9r4 has a very helpful tutorial on using git command line tools. You should commit progress as you make it and use branches so that you and your partner can develop in concurrently. You will include your .git directory in your submission. If you have not already gotten a github student developer pack, you should follow the directions here https://help.github.com/en/articles/applying-for-a-student-developer-pack. This will allow you to develop using a private repositories.

 

Mancala is a game that dates back well over 1,000 years and has many variations of rules. The following rules and board setup will be assumed for this project:

•      The board has two player stores (these where their stones will be stored)

•      The board has five pits on each side, each player has a set of five they can select from when it is their turn

•      The initial board setup has four stones in each pit (see Figure 1)

•      During a player’s turn they select one of their five pits with stones in it and by moving counter clock wise place one stone in each pit.  

o If they reach their store, a stone is placed in their store o If they reach their opponents store, the store is skipped

•      If the last stone is placed in the players store, the player gets another turn

•      If the last stone lands in an empty pit of the player, the stone and all of the stones in the opponent’s adjacent pit are stolen and put into the player’s store

•      If a player does not have any stones it their pits, they lose a turn

•      When all stones are placed in the stores the game is over, the player with the most stones in their store wins

 

An example of a normal turn is shown starting with the selected pit displayed in Figure 2. The result of the turn is shown in Figure 3.

 

 

The mancala game is implemented almost entirely in the CMancalaBoard class. The has CMancalaBoard the following member functions:

 

// Default constructor should initialize the board 

CMancalaBoard(); 

 

// Constructor to specify a board setup with the amount in each 

// pit, store and the turn 

CMancalaBoard(int turn, const int pits[MANCALA_TOTAL_PITS], const int stores[MANCALA_PLAYERS]); 

// Resets the board back to initial setup         void ResetBoard(); 

     

// Returns which player's turn it is int PlayerTurn() const; 

 

// Returns the score of the player, -1 should be returned on bad  

// parameter 

int PlayerScore(int player) const; 

 

// Returns the number of stones in the players pit, -1 should be  

// returned on bad parameters 

int PitStoneCount(int player, int pit); 

 

// Returns true if the game is over bool GameOver() const; 

         

// Returns a string representation of the board of the form: 

// P1          PITS 

//       5   4   3   2   1      

// /---------------------------\ 

// |   | 4 | 4 | 4 | 4 | 4 |   | 

// | 0 |-------------------| 0 | 

// |   | 4 | 4 | 4 | 4 | 4 |   | 

// \---------------------------/ //       1   2   3   4   5 //              PITS          P2 std::string ToString() const; operator std::string() const; 

         

// Does a move for the player, by taking the stones from the  

// specified pit. If the move failed, or it is not the player's 

// turn Move should return false. If the move succeeds true  

// should be returned 

bool Move(int player, int pit); 

More products