Game On: Creating a Worthy Connect Four Opponent with Heuristic Algorithms
CSEF · 2014 Mathematics & Software Fourth Award
Overview
Objectives/Goals The objective was to design a computer program to model the game of Connect Four and to sometimes win against average human beings using defensive, offensive, and look ahead algorithms. Methods/Materials Four algorithms to play Connect Four against a human player were constructed using JavaScript: random, defensive, aggressive, and look ahead. The random algorithm placed pieces randomly on the board compared to the more strategic defensive algorithm that placed pieces using heuristic scoring to block the human opponent. The aggressive algorithm combined both defensive and offensive strategies, also using a heuristic scoring system. The look ahead algorithm built upon the aggressive algorithm by simulating one opponent move ahead on the game board and scoring the possible moves accordingly. The algorithms were tested against a variety of human subjects to find average success rates for the algorithms. Results The look ahead algorithm was the most successful of the four algorithms in trials against human opponents. Conclusions/Discussion Heuristic algorithms like these could be worthy opponents because their success rates are comparable to human players themselves. These are usable algorithms to create an engaging game play experience for a wide variety of practical applications.
Summary statement
I designed a computer program to model the game of Connect Four and to be a worthy opponent against humans using several heuristic algorithms.
Help received
Father helped understand and learn JavaScript language and debugging
Awards (1)
Competition history
- CSEF 2014
Resources
Related projects
CSEF · 2010
A. I. Connect-Four
CSEF · 2019
Creating a Neural Network to Play the Game of Connect Four Using a Genetic Algorithm
CSEF · 2003
Artificial Intelligence: Can a Neural Network Learn to Play Connect 4?
CSEF · 2012
Artificial Intelligence: Teaching a Computer to Play Tic-Tac-Toe
CSEF · 2012
Computer vs. Human: Exploring AI in the Game Blokus
CSEF · 2003
Creating a Tic Tac Toe Computer Program
CSEF · 2012
GoAI: Creating an Artificial Intelligence to Play Go
CSEF · 2011
Artificial Intelligence: Modeling with Tic-Tac-Toe
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects