This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

na200
na200 presents ...

2011/4/17

Noughts & Crosses

This is a typical Noughts and Crosses computer game with very simple (but unbeatable) AI.

I wrote this as part of revision of one of my AI modules. I found the Greenfoot environment very useful for this, as it takes care of most of the graphics part of things, allowing one to focus on the actual logic of the program.

The game is currently configured for a 3x3 grid. This can be easily changed in the program code (via changing one of the constant values). However, performance of the program will be greatly affected due to the simplicity of the algorithm used to determine moves for the computer player.

The current implementation of 'Minimax' searches the whole gametree to determine potential winning moves, which is fine for the current configuration. However, for larger problem-sizes, the search-space definitely needs to be reduced. Things like game-specific heuristics, alpha-beta pruning, etc. can be used to achieve this.

4131 views / 12 in the last 7 days

Tags: mouse game demo with-source artificial ai intelligence gametree minimax

open in greenfoot

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.

No Comments

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.