Search for Science Fair Projects

1000 Science Fair Projects with Complete Instructions

Computer Science Science Fair Project

Neural Networks and Connect 4 Strategy

Hard
Neural Networks and Connect 4 Strategy | Science Fair Projects | STEM Projects
Can a neural network (a program that learns through practice) teach itself to play Connect 4 well enough to beat a person? You build the network and train it using a genetic algorithm. This method creates many versions of the program and keeps the ones that perform best. The network plays against a simulated opponent over many rounds. It learns to beat that opponent reliably. But when a human player with a different strategy steps in, the human still wins. The network learned to beat one style of play rather than the game itself. Training it against several opponents with different strategies could help it play more broadly.

Hypothesis

The hypothesis is that a neural network can learn to play Connect 4 well enough to beat a human opponent.

Science Concepts Learned

Artificial Intelligence

Artificial intelligence is software that learns from examples to make choices on its own. Here, a neural network teaches itself to play Connect 4 by training against a simulated opponent over many rounds. A genetic algorithm drives the process — it creates many versions of the program and keeps the ones that perform best, gradually sharpening its choices. When a human player with a different strategy steps in, though, the human still wins. The network learned to beat one style of play rather than the game itself, which shows that AI decisions depend heavily on the range of examples it trains against.

Neural Network

A neural network is a program that learns through practice — studying many examples until it can spot patterns on its own. In this experiment, you build one and train it to play Connect 4 using a genetic algorithm: the method creates many versions of the program and keeps the ones that perform best. After many rounds against a simulated opponent, the network learns to beat that opponent reliably. When a human player with a different strategy steps in, though, the human still wins. That result reveals something important: the network learned to recognize one style of play rather than the game itself. Training it against several opponents with different strategies could help it play more broadly.

Genetic Algorithm

A genetic algorithm creates many versions of a program and keeps the ones that perform best — mimicking natural selection inside a computer. Here, that process trains a neural network to play Connect 4. The algorithm builds many network players, tests them against a simulated opponent, and selects the strongest performers to produce the next generation. As rounds continue, the network learns to beat that opponent reliably. When a human steps in with a different strategy, though, the human still wins — because the network learned to beat one style of play, not the game itself.

Method & Materials

You will create a computer program that plays Connect 4 with a simulated opponent, and then use a genetic algorithm to train a neural network.
You will need a computer, a Connect 4 board, and tokens.

MEL Mathhands-on math experiment kits delivered monthly — makes abstract concepts tangible. (Affiliate link)

See whats included

Results

The neural network was able to beat the simulated opponent, but the human player was still able to beat the neural network. This shows that the neural network did not have all the information it needed to be very good at the game.

Why do this project?

This science project is unique because it uses a neural network to learn how to play a board game, and it shows that artificial intelligence can be used to learn how to play a game.

Also Consider

Experiment variations to consider include having the neural network play against multiple opponents with different strategies, or having the neural network play against the human player.

Full project details

Additional information and source material for this project are available below.
Share this Science Project:

Related Science Fair Project Ideas

CPU Speed vs. RAM Size in Computer Performance
Swap the CPU and RAM in a desktop computer and time the difference to find out which upgrade matters more.
Hard
Programming the Diffusion Equation
Write a program in Scheme that solves differential equations and use it to model how atoms spread through solids.
Hard
Billiard Ball Angles and Corner Pockets
Simulate 6,300 billiard ball paths and discover that a single property of the launch angle predicts whether the ball reaches a corner.
Hard
Share this Science Project: