game.c source file on Gradescope.
You can submit as many times as you want up until the deadline.
Make sure the final version of your implementation is committed and pushed to your git repository by the deadline.
Your task for this assignment is to implement a two player Connect Four game. The sections below outline the rules for the game you’ll be implementing, what you’ll need to get started on the assignment, and how your work will be assessed.
Connect Four is a two player turn-based game with some similarities to tic-tac-toe. The game is played on a grid with seven columns and six rows. Each player has tokens that are all the same color; the first player to move uses yellow tokens, and the second player uses red tokens. A player wins by placing four of their tokens in a row, column, or diagonal. Each player takes a turn by dropping a token into one of the seven columns, but the board stands vertically so tokens will drop to the lowest open space in the chosen column
The animation below, originally from Wikipedia, shows a sequence of moves in a Connect Four game ending in a win for red:

There are a few important cases you’ll need to worry about in your implementation:
Implement the two-player connect four game described above. There are some specific requirements for the game implementation described below, so make sure you read them carefully before starting your work.
You must complete your work for this assignment using a git repository on the class git server.
When you log in you should see a repository called connect-four-USERNAME, where USERNAME is your college username.
You have access to modify this repository directly, so do not create a fork.
Instead, run the commands below to clone the repository and open it with VSCode:
$ cd ~/csc161/homework
$ git clone https://git.cs.grinnell.edu/csc161/connect-four-USERNAME.git connect-four
$ cd connect-four
$ code .
Make sure you replace USERNAME in the example above with your Grinnell username (not your full email address) so you have the correct repository path.
Notice that this time we are using git clone with an extra option at the end.
This tells git to save the cloned repository in a directory named connect-four instead of connect-four-USERNAME.
If you are unable to access your git repository, please contact the instructor immediately!
The repository could be configured incorrectly, but you may also have an issue with the configuration of your user account on the git server that we should address as soon as possible.
The starter code includes a Makefile, so you can compile the code by running make:
$ make
clang -g -Wall -o game game.c
The game implementation is in game.c and is compiled to a program named game.
Run the game with the command ./game:
$ ./game
You are required to use a one-dimensional array to complete this homework assignment. You may be tempted to use a 2D array given the fact that the board is a grid, 2D arrays are not allowed for this assignment. Your game board representation must include all the cells of the board in a single array; you are not allowed to use separate arrays for each row or column of the board.
You are free to decide how you map elements of the array to cells in the game board, but I recommend using row major order.
In row major order, the first seven elements of the array will be the first row, the next seven are the second row, and so on.
You are also free to decide what type of value you use to represent a cell on the game board.
There are several reasonable choices but you may find it helpful to use an enum type, which you will read about soon after this assignment is released.
When you display your board, you should print it in the format shown below:

This display shows two tokens from each player indicated by “R” and “Y”, but also displayed in color. The starter code for this assignment includes examples of how you can print to the terminal in these colors. Notice that the columns are labeled with single letters. Users will type these letters to submit their move each turn.
The string constants we use to display in color are difficult to understand. We’ll do more with terminal colors in our next assignment, but we will have a library that handles the confusing constants for us so we can just ask for specific colors by name.
You might end up with a terminal that prints everything in bold red or yellow text, especially if your game crashes while you are testing it.
If that happens, you can run the reset command to clear the screen and reset terminal colors:
$ reset
Your assignment will be assessed on binary scale: it either meets the requirements for the assignment and receives credit, or it does not. If the work you submit does not receive homework credit you can use a token to resubmit it. You can also use a token to submit the assignment up to 48 hours late. Keep in mind, assignments that are not submitted are not eligible for resubmission.
To receive credit, your connect four implementation must meet the following requirements:
You can complete this entire assignment using concepts we’ve covered in class as of the assignment’s release, but you may find it helpful to incorporate material we cover in class after the assignment is released. You are welcome to use concepts covered in class during the assignment period, but you may not use any C features we have not discussed before the assignment deadline. Using concepts we haven’t covered by the time you turn in your work will result in a grade deduction.
As with all work you do in this course, the academic honesty policy applies to your work on this homework assignment. Please review the syllabus for policies on individual homework to make sure you understand the resources you can and cannot use for this work. Academic honesty violations will be reported to the committee on academic standing, and can result in penalties for your grade on this assignment or the entire course if you are found responsible for the violation.