-1
I’m making a program that would be a board game that when all 4 players reach the house 100 the program to, however my code is not stopping at the 100:
#include <locale.h>
#include <stdlib.h>
#include <time.h>
int main(){
setlocale(LC_ALL, "");
int i;
int aux;
int jogador[4] ={1,2,3,4};
int pos[4] = {0,0,0,0};
int volta[10];
int avanca[10];
srand(time(NULL));
while(pos[i] != 100){
for(i = 0; i < 4; i++){
aux= rand()%7;
if(aux == 0){
aux= rand()%7;
pos[i] += aux;
printf("\n\tJogador %d joga novamente\n", jogador[i] );
printf("\njogador: %d -> jogada: %d -> posicao: %d \n", jogador[i], aux, pos[i]);
} else {
pos[i] += aux;
printf("\njogador: %d -> jogada: %d -> posicao: %d \n", jogador[i], aux,pos[i]);
}
}
}
system("pause");
return 0;
}```
Hello, but now the loop understands that every player must repeat the move. I built an architecture to make it easier to read what needs to be done but I’m having trouble stopping when all four players are in the 100 and to advance and return according to the position the player is in. I will send you the diagram I made: https://i.stack.Imgur.com/Ckgyd.png
– Dibnelson