Your task for this assignment is to implement a player for the game Connect 4 in C or Pascal. Briefly, in a game of Connect 4 players take turns dropping their colored chips into a 7x6 grid, which pile up at the bottom. To win, a player must connect four of their chips in a row (horizontally, vertically, or diagonally).
In coding your player you can implement any strategy you want -- from random moves to a full-fledged time-limited minimax search. I'm not expecting any background in game playing algorithms -- the basic idea is to have fun and get creative writing a non-trivial program in a procedural language. Your grade will be based your effort and creativity, your coding style, and on the performance of your player (yes, we will have a tournament!).
Your program should compute a single move in the game. It should read the current board configuration as input (details below) and produce a move to make as output within 1 second. I am providing a Python script "match.py" to run your programs, which prints the board configuration, lets players take turns, and detects wins, ties, illegal moves, and time limit violations. This script allows (1) to let a human play against your player, and (2) pitch two computer players against each other. Once all programs have been submitted we will run a tournament to determine the best player and an overall ranking.
Then the input to your program would look like this:| | | O | | X | | O O X | | X X O X X | | O X O O X | +---------------+ 1 2 3 4 5 6 7
The 8th line in the input indicates that it is player 2's turn ('O').OXOXO XX OO OXO XXX O
The output of a good player program in this case should be '7' since otherwise player 1 could win in the next move by getting four X's in a row in column 7. Your program can print anything it wants (e.g. the current board configuration and debugging output), as long as it prints the move to make (an integer between 1 and 7) on a single line as the very last line of its output to stdout. It must produce all its output within 1 second.