ECE 2524

Introduction to Unix for Engineers

Review: Tic-Tac-Toe

Usage

The Tic-Tac-Toe game instructions were easy to follow. Since it uses python, as the instructions suggested, it can be run just by entering: $ python game.py However, I tried using “Komodo Edit 8” python compiler to run the program since I already had the program, but some parts of the code appeared to be non-indented. As we know in Python, the code needs to be indented properly to compile. I am not sure why that happened, so I just used the terminal.

The game runs very smoothly and the ascii artwork definitely gave the program a nice touch. The game interface was very easy to use. However, I encountered a few problems while playing the game. In the 2 player mode, after the player 1 turn ends, it shows “False”. It was probably entered during the debugging period and can be removed without any trouble. Also, during the “player vs AI” mode, the game crashes for some set inputs. I found if player enters these set of inputs in order the game crashes: 2, 3, 4, 6 2, 3, 4, 8 2, 3, 4, 9

Since instead of running loops to check for AI moves, this code uses set hardcoded values, most likely some cases were overlooked which might have caused this error.

Style

The game is well organized and easy to follow. Class, functions, and variable were named according to their attributes, which made it easier to follow the code. However, in my opinion, instead of using one long file, some more files could be created to separate the task of each function. Also, using loops instead of using many if-else conditions would have shortened the code a bit. For a 3x3 game board it might not be hard, but for 4x4 or 5x5 board, keeping track of all the if-else conditions would be very difficult.

The ascii art could be read from a text file which will make it easier if any change is needed in the future.

Philosophy

This project embodied the Unix design philosophy in its core. It has simple parts connected by a clean interface. Simplicity is followed throughout the entire code and makes it easier for others to understand without any trouble. The comments throughout the code also needs some praising. Therefore, the code is very “Unixy”.