Making Tic Tac Toe using C programming language. It is not allowed to use indexing to access the array that represents the tic-tac-toe board. Instead, you are required to use address arithmetic and dereferencing to access it
programming in C. Tic-Tac-Toe is a game where two players alternate putting their mark (either X or O) on a game board until one player wins or there are no spaces available to mark (see Tic-Tac-Toe Wikipedia (Links to an external site.)). In a typical game of tic-tac-toe, the game board is a 3×3 grid and the winner is the first to get 3 of their marks “in a row” either horizontally, vertically, or diagonally. For this assignment, you’ll be completing the program n_in_a_row.c, which processes a file containing the current game state, represented as a 2D grid of Xs and Os. Your task is to verify if the current state of the game board is valid or not.
The game board size will be generalized to use a grid of n rows and n columns. This will require you to work with a dynamically allocated 2D array (heap allocation). The first value in the input file will be the value of n, the board size. Note the total number of Xs plus Os on the board will be in the range of 0 to n*n.
A key objective of this assignment is for you to practice using pointers. To achieve this, you are not allowed to use indexing to access the array that represents the tic-tac-toe board. Instead, you are required to use address arithmetic and dereferencing to access it. Submitting a solution using only indexing to access the tic-tac-toe board will result in a 50% reduction of your score. You may use indexing to access any other arrays that might be used by your program.
You’re welcome to develop the solution in phases. You could first code a solution that uses indexing. Once you have that solution working, you can replace indexing with pointer arithmetic before final testing and submission. If you do this approach, make sure to replace all accesses to your board to use address arithmetic and dereferencing to avoid a penalty.
You’re strongly encouraged to use incremental development to code your solution rather than coding the entire solution followed by debugging that entire code. Incremental development adds code in small increments. After each increment is added, you test it to work as desired before adding the next increment of code. Bugs in your code are easier to find since they’re more likely to be in the new code increment rather than the code you’ve already tested.