Game of Nim (PROJECT HELP!)
My Professor want as to make a game that is called game of nim and this will be pass on october 8. i want your help so that we can pass it on time. the game goes like this;
The game will be played by 2players:
Player 1 Turn:
ROW1: I I I
ROW2: I I I I I
ROW3: I I I I I I I
Number of Row: 3
Number of Stick to remove: 5
ROW1: I I I
ROW2: I I I I I
ROW3: I I
Player 2 Turn:
Number of Row: 1
Number of Stick to remove: 3
ROW1:
ROW2: I I I I I
ROW3: I I
Until the one who pick the last stick will be the looser.
P.S: I STARTED THE CODE BUT I DON'T THINK IT IS RIGHT
AND I'M JUST A BEGINNER. SO PLEASE I REALLY NEED YOUR HELP.
Code:
#include <stdio.h>
main()
{
int row1;
int row2;
int row3;
int i = 1;
int player=1;
int sum;
int row;
while (i<sum)
{
printf("\nPlayer %d's turn! \n\n",player);
player++;
if(player == 3)
player = player - 2;
printf("\nRow 1: ");
for(row1 = 0; row1 < 3; row1++)
{
printf("\t|");
}
printf("\nRow 2: ");
for(row2 = 0; row2 <5; row2++)
{
printf("\t|");
}
printf("\nRow 3: ");
for(row3 = 0; row3 <7; row3++)
{
printf("\t|");
}
printf("\nEnter row number: ");
scanf("%d", &row);
sum= i* 15;
}
return 0;
}