Graph
Graph
typedef struct {
Player board[SIZE][SIZE];
} HexBoard;
while (1) {
displayBoard(&board);
if (currentPlayer == BLUE) {
printf("Blue's turn. Enter row and column: ");
scanf("%d %d", &row, &col);
if (isValidMove(&board, row, col)) {
makeMove(&board, row, col, BLUE);
if (checkWin(&board, BLUE)) {
printf("Blue wins!\n");
break;
}
currentPlayer = RED;
} else {
printf("Invalid move. Try again.\n");
}
} else {
printf("Red's turn (AI).\n");
computerMove(&board, RED);
if (checkWin(&board, RED)) {
printf("Red wins!\n");
break;
}
currentPlayer = BLUE;
}
}
displayBoard(&board);
return 0;
}