Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started