Question: i need help creating a c++ program where the user will play a game of mankala against a CPU. Write a C++ program where a
i need help creating a c++ program where the user will play a game of mankala against a CPU.
Write a C++ program where a human will play the computer in a game of Mankala. We will make the smart computer once we get this first part working.
Use simple characters to illustrate the board and letters to identify the pits, similar to that show below:
4 4 4 4 4 4
0 0
4 4 4 4 4 4
A B C D E F
code:
#include
using namespace std;
int player1turn(int P1[6], int P2[6], int P1score, int P2score) cout << "player one's turn" << endl; for(int i = 0;i < 6; i++){ cout << P2[i] << " "; } cout << endl; << P1score << "\t\t " << P2score << endl << " "; for(int i = 0;i < 6; i++){ cout << P1[i] << " "; } cout << endl; << "A B C D E F" << endl; cout << "where do you wanna move your stones "; cin >> mov; mov = toupper(mov); while(mov != 'A' or mov != 'B' or mov != 'C' or mov != 'D' or mov != 'E' or mov != 'F'){ cout << "enter one of the letters above " << endl; cout << "where do you wanna move your stones "; cin >> mov; mov = toupper(mov); } whole = mov - 65; cout << whole; int main() { int P1[6] = {4,4,4,4,4,4}; int P2[6] = {4,4,4,4,4,4}; int P1score = 0; int P2score = 0; char mov = ""; int whole = 0; int han = 0; cout << "player one's turn" << endl; for(int i = 0;i < 6; i++){ cout << P2[i] << " "; } cout << endl; << P1score << "\t\t " << P2score << endl << " "; for(int i = 0;i < 6; i++){ cout << P1[i] << " "; } cout << endl; << "A B C D E F" << endl; cout << "where do you wanna move your stones "; cin >> mov; mov = toupper(mov); while(mov != 'A' or mov != 'B' or mov != 'C' or mov != 'D' or mov != 'E' or mov != 'F'){ cout << "enter one of the letters above " << endl; cout << "where do you wanna move your stones "; cin >> mov; mov = toupper(mov); } whole = mov - 65; cout << whole; han = P1[whole];
return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
