I\'m writing a code for tic tac toe and am having problems writingthe code to in
ID: 3609020 • Letter: I
Question
I'm writing a code for tic tac toe and am having problems writingthe code to initialize game board and check if there is a winner(highlighted in red). Any help in theright direction would greatly be appreciated. This is how its setup...#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define XPLAYER 0
#define OPLAYER 1
#define OPEN -99
#define TIEGAME 2
#define LIVEGAME 3
int gameboard[9];
// Prototypes of subroutines involved
void initialize_board();
int check_winner();
int check_valid_move();
void display_board();
// Tic-Tac-Toe
//
// | |
// ------------
// | |
// ------------
// | |
//
// The array "gameboard" is tracking the following:
// 0 | 1 | 2
// ------------
// 3 | 4 | 5
// ------------
// 6 | 7 | 8
//
// The array "gameboard" is tracking the following:
void initialize_board()
{
//write code to initialize all board spotsto OPEN
}
int check_winner()
{
//write code to see if player has wongame
// Return 0 if game is won by XPLAYER
// Return 1 if game is won by OPLAYER
// Return 2 if game is a tie
// Return 3 if game is still going on
}
int check_valid_move(int spot)
{
// write code to see if player has wongame
// Return 0 if spot is not valid
// Return 1 if spot is valid
}