Elevator Pitch: This app allows two people to play Tic Tac Toe against
each other (non-remote), or you can choose to play the computer. The computer is
programmed to make good moves, but not perfect moves. Can you beat it?
Description: This Tic Tac Toe app uses various features of Android and
AppInventor to create a simple game. Two players can play on one device, or the computer
can be selected as an opponent. If the computer is selected as an opponent, the app will
randomly decide whether the user or the computer moves first. In any case, the player that
moves first will always be assigned the letter X. The other player gets to be O.
Since complicated algorithms in AppInventor tend take a lot of work and AppInventor blocks,
one early goal was to see if the app could avoid having to check all the columns, rows,
and diagonals for every move. By numbering the cells of the grid following the numbering
scheme of a three by three magic square, it turns out that checking for winning and
blocking moves is greatly simplified.
When the app starts up you should see three choices: Play Human (to play against another player
on the same device), Play Computer (to play a game against the computer), and Rules
(to see a short description of Tic Tac Toe). The first player to move automatically gets X
and the other player gets O. If you choose to play the computer, the app will randomly decide
whether you or the computer moves first. Moves are made by touching an unoccupied cell on the
grid. The winner is the first player to get three of their marks in a row, either horizontally,
vertically, or diagonally. It is common for neither player to win. Once a game is over, a
message dialog will tell you what the outcome was. Click Ok to dismiss the dialog. Touch the
Reset button on the app to go back to the main screen and start a new game. If you decide to
play the computer and the board starts out with no moves made, that is because the computer
is waiting for you to make the first move. A status of whose move it is and the outcome of the
game is displayed on the left side under the game board.
Technical Requirements: The following screenshots demonstrate that this
app exceeds the minimum requirements. There are nineteen global variables,
fourteen event handlers, and nine procedures/functions. Selection is heavily used within
the project as evidenced by more than twenty if/then or if/then/else structures. Repetition
is covered by more than ten for/each structures. The thumbnails in the list below function as links
to larger, more readable images of the source code.
Screenshots of the Tic Tac Toe App: The following screenshots are thumbnails that link to larger,
more readable images.