Question: Please write a C programing code Tic-tac-toe (or noughts and crosses) is a popular children's game that is easy to learn and play (see https://en.wikipedia.org/wiki/Tic-tac-toe).

Please write a C programing code

Please write a C programing code Tic-tac-toe (or "noughts and crosses") is

a popular children's game that is easy to learn and play (see

Tic-tac-toe (or "noughts and crosses") is a popular children's game that is easy to learn and play (see https://en.wikipedia.org/wiki/Tic-tac-toe). For this lab you are to implement a simple module (i.e. you will write implementation file ttt.c) that allows you to represent and place marks on a tic-tac-toe board. Here is the specification file ttt.h (available on the class Canvas pages); #ifndef TTT_H #define TTT_H #define EMPTY typedef struct btype *board; /* assume that the upper left corner of the board is square 1,1 all functions are undefined when passed an illegal row,col */ board createBoard(); // returns an empty board (all squares set to EMPTY) void putX(board b, int row, int col); // puts an 'X' at row,col void puto (board b,int row, int col); // puts an 'O' at row,col char get(board b, int row, int col); // returns value at row, col char *toString(board b); // returns a string representation of board b; // string returned does not have to be the minimum // size to store the board. See sample run for format. #endif Here is a sample driver file tttDriver.c (also on the Canvas class pages) that you can use to test your code: #include #include "ttt.h" int main(void) { board b = createBoard(); putX(b,1,1); putX(b,2,2); put0(6,1,2); put(1,3,3); printf(" 1 I "); 1 for(int r = 1; r #include "ttt.h" int main(void) { board b = createBoard(); putX(b,1,1); putX(b,2,2); put0(6,1,2); put(1,3,3); printf(" 1 I "); 1 for(int r = 1; r

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!