This is my first-ever programming project. It was my final assignment for Introduction to Computer Science course in my first semester at university.
It is a 13x13 grid Gobang game, with a simple AI simulation for the computer player. The game is written in C language.
The project includes 3 main C source code files (Functions.c, ComputerPlayer.c, and Game.c) and one library file (Library.h).
First, the "Library.h" file is where I list the structure(s) and functions needed for the game.
Second, the "Functions.c" file is where I define functions listed in "Library.h" file. The "InitialBoard" function is to print out the initial game board. The "DisplayBoard" function is to print out the game board after every time a player makes a move. The "Humanplay" function is to let the human player make a move. The "Firstplayer" and "Secondplayer" function are for two sides to make their move when two players play. The "IsWin" function is to check whether one side has won the game. The "IsFull" function is to check whether the game board is fully filled, if it is full then the game is tied. The "PrintWinner" function is to announce the winner when they won the game. The "save" function is to record every move that players made. The "Replay" function is to read the record that was saved and to print in the screen.
The "ComputerPlayer" file is made exclusively to intelligently programmed the computer to respond, attack and counter the opponent's move to make the game harder for the human player.
The "Game.c" file is where the game is implemented. It includes the main function and different modules to execute the game based on players' preferences. There are two main modules, one is human playing against human which is "twoplayer" function, and the other one is human playing against the computer, it is divided into two sub-modules, where the human player can choose the attacking position or the defending position.