Here is a screenshot. Sorry about the eraser, there was some personal info down there. I need the program to somehow print in the middle of a 40 row by 80 column screen. Any help is appreciated. Others are displayed, but I don't feel comfortable posting them all unless someone is willing to help me via email. Thanks again.
Here are the main functions displayed:
Code:
void print_puzzle (int size, char puzzle[], char clue[], int round)
{
int i;
printf(" ===============================\n");
printf(" Round %d\n", round+1);
printf(" ===============================\n\n");
printf("Clue: %s\n\n", clue); /*prints clue*/
for (i = 0; i < size; ++i){
printf("%2c",puzzle[i]); /*prints word hidden*/
}
printf("\n\n");
}
void print_score(int players, int score[])
{
int p;
printf("\n");
for (p = 0; p < players; ++p){
printf(" Player %d ", p+1); /*prints player numbers*/
}
printf("\n");
for (p = 0; p < players; ++p){
printf(" ======== ");
}
printf("\n");
for (p = 0; p < players; ++p){
printf(" $%d ", abs(score[p])); /*prints each players score*/
}
printf("\n\n");
}
int player_turn(int player_num, int player, int score[], char phrase[], char puzzle[], char clue[], int size, int round){
int solved = 0; /*solve is initialized to zero to indicate puzzle has not been solved*/
char player_continues = 1;
char options[10]; /*string to hold choice*/
while (player_continues == 1){
char choice = ' '; /*choice initialized to nothing*/
print_score(player_num, score);
print_puzzle(size, puzzle, clue, round);
printf("Player %d, what do you want to do?\n\n", player+1);
while (choice != 'S' && choice != 'O' && choice != 'B') {
printf("(S)pin, S(o)lve or (B)uy a vowel -> ");
if(fgets(options,10,stdin))
{
sscanf(options, "%c", &choice); /*player types in choice and it is stored in options*/
}
choice = to_upper(choice); /*converts choice to uppercase to prevent case sensitivity*/
printf("\n");
}
if (choice == 'S'){ /*if player chooses spin*/
player_continues = spin(player, score, phrase, puzzle, size);
}
else if (choice == 'O'){ /*if player chooses solve*/
solved = solve(player, score, phrase, size, clue, round);
player_continues = 0;
}
else /* buy a vowel */{
player_continues = buy_vowel(player, score, phrase, puzzle, size);
}
}
return solved;
}