Connect Four Final Report
This project consisted of creating a MATLAB script for the game Connect Four. We created code that set up a 6 by 7 board. The rules for the game are exactly the same as any Connect Four game. Two players play against each other: black versus red. The player hovers the mouse over the board and then clicks on any column and their chip will fall to the appropriate row. This means that if there are no chips in that column, it will fall to the bottom, but if there are already chips in that column, it will fall to the row directly above it. The code detects if you try and place a chip in an already taken spot, and it does not allow you to do that. We also made code that determines when there is four in a row and someone has won the game.
The goal of this project was to make a computer game using MATLAB, and Connect Four seemed like the most fun. We wanted our MATLAB version of Connect Four to be as realistic to the actual board game as possible. We wanted all the same rules to apply. The motivation for this project came from the desire to give Professor Cheever a fun game to play over winter break, and from the aspiration to make a game people can really play on the computer. This project is interesting because the code involves some complicated nested for loops and if then statements. This project took a lot of problem solving, but with lots of trial and error we were successful with creating Connect Four on MATLAB.