The Tic-tac-toe Game Program is a program created by Tenny, Annie and Bryan. User can play tic-tac-toe game on this program by inputing which position (from 0 to eight) they want to place their chess pieces. The system will automatically calculate the score of each player and judge whether each round is a tie or not, or which team wins. We use 0 to represent blank space, 1 for pieces by player 1 and 2 for pieces by player 2.

The two parts that I worked on were the checkWon part and checkTie program. The checkWon subprogram is in the main program. Its function if to check whether any side has won the game. As the rule is rather simple, we listed all the possible combinations of winning image and return the side that wins and scores that add to the winning side. The condition to judge a winning is that three pieces from one side stands on a row.

The other one is checkTie. If there is no 0 on the board and no one wins, then the game is tie.

Reflection
After the first version, Mr. Pete asked us to add a scoring system to the game. So the idea to improve my part was that return the score that should be added to the winning side. Then the whole program is completed.