|
|
@ -74,16 +74,23 @@ void ia_call_function(const struct player_state_t player_state, enum api_functio |
|
|
|
va_end(ap); |
|
|
|
} |
|
|
|
|
|
|
|
/* pour associer une branche de l'étoile à un joueur */ |
|
|
|
size_t star_branch(unsigned int nb_player, size_t index) { |
|
|
|
return (nb_player>=2 && nb_player<=4 && index >= nb_player/2)?index-(nb_player>3?2:1)+3:index; |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char** argv) { |
|
|
|
const size_t start_position[6][10] = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, |
|
|
|
{111, 112, 113, 114, 115, 116, 117, 118, 119, 120}, |
|
|
|
{19, 20, 21, 22, 32, 33, 34, 44, 45, 55}, |
|
|
|
{65, 75, 76, 86, 87, 88, 98, 99, 100, 101}, |
|
|
|
{74, 84, 85, 95, 96, 97, 107, 108, 109, 110}, |
|
|
|
{111, 112, 113, 114, 115, 116, 117, 118, 119, 120}, |
|
|
|
{65, 75, 76, 86, 87, 88, 98, 99, 100, 101}, |
|
|
|
{10, 11, 12, 13, 23, 24, 25, 35, 36, 46}}; |
|
|
|
struct player_state_t player_state[6]; |
|
|
|
struct game_state_t game_state; |
|
|
|
int nb_game, nb_player; |
|
|
|
enum bool win; |
|
|
|
size_t branch; |
|
|
|
int i, j; |
|
|
|
|
|
|
|
|
|
|
@ -153,7 +160,7 @@ int main(int argc, char** argv) { |
|
|
|
|
|
|
|
while( nb_game-- > 0 ) { |
|
|
|
#ifdef debug |
|
|
|
fprintf(stderr,"game %d left\n", nb_game); |
|
|
|
fprintf(stderr,"%d %s left\n", nb_game, nb_game>1?"games":"game"); |
|
|
|
#endif |
|
|
|
|
|
|
|
/* appel de start_game */ |
|
|
@ -161,14 +168,23 @@ int main(int argc, char** argv) { |
|
|
|
if( player_state[i].ia_lib_p ) |
|
|
|
ia_call_function(player_state[i], ia_start_game); |
|
|
|
|
|
|
|
/* initialisation du plateau */ |
|
|
|
for(i=0; i < 121; game_state.board[i++] = none); |
|
|
|
|
|
|
|
/* initialisation : on place les pions */ |
|
|
|
for( i=0 ; i < nb_player ; i++ ) { |
|
|
|
player_state[i].play = true; |
|
|
|
branch = star_branch(nb_player, i); |
|
|
|
for( j=0 ; j < 10 ; j++ ) { |
|
|
|
player_state[i].pawn[j] = start_position[i][j]; |
|
|
|
game_state.board[start_position[i][j]] = i+1; |
|
|
|
player_state[i].pawn[j] = start_position[branch][j]; |
|
|
|
game_state.board[start_position[branch][j]] = i+1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for(i=0;i<121; i++) |
|
|
|
if(game_state.board[i]) |
|
|
|
printf("%d %d\n",i, game_state.board[i]); |
|
|
|
|
|
|
|
/* chaque joueur joue */ |
|
|
|
|
|
|
|
|
|
|
|