hi again,
I was given a problem which goes like this.
Token-Tug-O-Warrior is a new board game played by two competitors on
a one-dimensional lattice structure. The home locations for
player1 and player2 are located at the first and last lattice positions, respectively.
//_________________________________________________
During initialisation, a heart-shaped token placed at the centre
location of the lattice structure. Each player then takes turns throwing
a six-sided die and moving the token by the requisite number of positions in
the direction of his/her home location. If a player throws a six (6)
then he is rewarded with another throw. The winner of the game is the
player who manages to “bring the bacon home”. One constraint on
winning is that the boundaries of the lattice must be respected.
That is, if a player needs a throw of three to enter the home location,
and any number greater than this (excluding a six) is thrown, then
that player must forfeit a turn.
/_________________________________________________
The problem I am having, is if the person throws a 6, it constantly goes to forfeit a turn.
what i did is that below the line
I placedCode:die=GetRand(MIN,MAX);
I didnt include the above in my code.Code:while(die == 6) { printf("Player 1:Please Press Enter to roll the dice"); getch(); printf("\n"); printf("You just rolled a %d ",die); //displays what you rolled printf("\n"); player1=player1_move_spaces(game_board,die,player2); //calls function then assigns value to player1 printf("\n"); printf("\n"); }
I dont how to correct the problem so if there is anyone who can lend a hand, i would greatly apprciate it.



LinkBack URL
About LinkBacks


