Monday, November 25, 2024

Artificial Intelligence Machine Learning and Hexapawn

A presenter at the recent New England CSTA New England Conference mentioned the game Hexapawn.  Hexapawn is hardly new. It was first introduced in 1962. I first ran into it in the early 1970s and found it to be an interesting challenge. One I was to intimidated to try at the the time Be that as it may, the paper introducing Hexapawn used it as something that was open to what we call today machine learning. That is to say, the more one plays it the better the computer gets at playing. The term my professor uses was heuristic programming.. Machine learning is a more accurate term for programs that learn though.

When I think about it, we were learning about artificial intelligence 50 years ago. Progress has been slow. It seems like “true AI” has been ten years away for all of that time. I am skeptical that we are there yet though clearly we are getting closer.

Returning to Hexapawn. There are several ways one can build code to play against a person. One way, the way involving machine learning is for the program to save every move and evaluate if it leads two a win or a loss. Each game leads to moves that are clearly not going to win and others that are more likely to win. This information influences each new game.

An other way is to hard code in moves based on a set of rules. I confess to playing with this strategy a bit. For example, a rule might be as simple as “if there is a move that places a piece in the wining row – take it.” Or perhaps, “if a move prevents the human from moving – take it.”

Rule based AI had a period of popularity especially in the 1980s. OPS5 was a rules based programming language that was used to create an “expert system” to configure computers. Configuring computers back in the mini computer era was a complex process. I worked for one company that believed that configuring computers was to difficult a task for computers. Configuring computers was an important part of my job there. When I left there and went to work for Digital Equipment Corporation I found that they had solved that question.

Which method is better for a game like Hexapawn? Programming rules based seems a little easier. It probably works for a limited game like Hexapawn but I doubt it scales. A machine learning program probably takes more initial work. In the long run it probably results in a more reliable winning game.

Hexapawn is a small enough project that it probably makes a project for helping students write actual artificial intelligence code. Are you using it?

FWIW I blogged about Hexapawn several years ago at Hexapawn–An Interesting Programming Project

No comments: