Artificial Intelligence: Can a Neural Network Learn to Play Connect 4?

CSEF · 2003 Mathematics & Software

Overview

Objectives/Goals The goal of my project was to find if a neural network would be able to learn how to play Connect 4 (a board game where the goal is to get four tokens in a row) well enough that it could beat a human opponent. A neural network is an artificial intelligence program that uses a network of connections between input values and output values to eventually learn how to do something. A neural network uses weights to determine the output for the given input. To find a good set of weights, the neural network can be trained. One type of training method for a neural network is a genetic algorithm. The genetic algorithm creates a model of individuals, based on the set of weights. It uses the basic idea of natural selection to eliminate the weak and promote the strong. Methods/Materials I created a computer program that played Connect 4 with a simulated opponent for the neural network to play. Then I tried out different ways of training a neural network. Finally, I created a training method for the neural network, using a genetic algorithm. Results The neural network learned to beat the simulated opponent that I could rarely beat, but I could still beat the neural network because I had a different strategy than the opponent. Conclusions/Discussion The neural network did not learn to play a wide variety of strategies. Therefore, it learned to play the opponent, not the game in general. If I had played the neural network instead of the opponent, it probably would have been better at playing me. In conclusion, the neural network did not have all of the information it needs to be very good at the game of Connect 4. It might be improved by having it play against me or several opponents with different strategies.

Summary statement

My project involved creating and training an artificial neural network to play the game of Connect 4.

Help received

My dad showed me how a genetic algorithm worked and helped with editing.

Awards (1)

  • Category Award

Competition history

  • CSEF 2003 Mathematics & Software · Entry J1212

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google