45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
#include <stdlib.h>
|
|
#include <graph.h> // Bibliothèque graphique
|
|
#include "graphics_utils.h"
|
|
#include "blocus.h"
|
|
#include <stdio.h>
|
|
|
|
void play_single_player(Game* game);
|
|
void play_two_players(Game* game);
|
|
|
|
int main() {
|
|
int grid_size = 0;
|
|
int mode = 0; // 1 : Un joueur, 2 : Deux joueurs
|
|
|
|
while (1) {
|
|
InitialiserGraphique();
|
|
CreerFenetre(100, 100, 800, 600);
|
|
|
|
// Écran 1 : Choix de la taille de la grille et du mode
|
|
grid_size = choose_grid_size(&mode);
|
|
|
|
// Écran 2 : Lancement de la partie
|
|
Game game;
|
|
initialize_game(&game, grid_size);
|
|
|
|
if (mode == 1) {
|
|
play_single_player(&game);
|
|
} else {
|
|
play_two_players(&game);
|
|
}
|
|
|
|
// Écran 3 : Résultat
|
|
display_winner(game.winner);
|
|
|
|
FermerGraphique();
|
|
|
|
// Recommencer ?
|
|
printf("Recommencer ? (1: Oui, 0: Non)\n");
|
|
int replay;
|
|
scanf("%d", &replay);
|
|
if (!replay) break;
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|