Attribution: This is a cached copy of a third party project. Many of these sites are from 20 years ago and the majority are no longer running. We show only the first page of the project. We do not save all pages since copyright belongs to the third-party author.
Title: Creating a Tic Tac Toe Computer Program Objectives/Goals The objective of this project was to achieve creating a code that could never lose, when going second Methods/Materials To achieve this goal,using my laptop and the program MATLAB I went through a series of proceduces. Firsty, I created a script that detected ties,win, and loses. Testing its effectiveness, I created a random player (player that places x's or o's randomly about the board), and had the two random playersplay against each other, having the script test itself. At the point of perfection I analyzed strategies,so that i could program counter-attacks against the moves that would result in a loss. To program strategies preventing loss, I used roughly 300 if-then statements, creating a "smart player". To test the efficiency of the "smart player", I had random player go against the smart player, and made any neccesary corrections, repeating this process till the point of perfection. At which point I tested against human subjects Results To prove my hypothesis the computer program was placed against a "random player" and a human. The random player was simply a program that placed x/o's randomly about the board. Against the "random player" the "smart" computer program only tied 19.97%, the rest of the games the computer program won, 80.03%. The three human subjects, played against the computer program and never won, tied 86% of the games and lost 14%. Therefore the results consist of 0% of the games overall, of the humans and "random player", were lost Conclusions/Discussion The computer program was successful in that it was able to never lose, as seen when it played three human players. In the 100 games against the humans 14% was lost, the rest tied. Not only did it never lose to a human but it was also able to never lose, but instead win, 80.03% of 10,000 games when playing against a random player. This proves my hypothesis correct; therefore it is possible to create a computer game that never loses, although it goes on the second turn Summary Statement Creating a Tic Tac Toe Computer Program that never lost, when it goes second Help Received Father helped with understanding how to program