I seem to have taught my game AI the meaning of despair.
Take a look at this board position, for example. With four turns left in the game, any human player would move the 4 of stars aside, and take the 5 of suns three spaces towards home. What did mine do instead? Go ahead and take a look.
It moves the far-away 1 of stars out of its goal position! Now, why would it do such a thing? Well, let’s take a look at the final board position the human player would have, with the approach I described, and the one the computer player got.
The human player got his 5 of suns three spaces closer to home than it started, but had to move the 4 of stars one square out of place to do it. Net gain: two moves. The computer player advanced the 5 of suns and the 5 of moons each by one square, and wasted two moves dancing the 1 of stars back and forth. Net gain: also two moves.
Now, as it turns out, this isn’t even the right thing to optimize for (which I’ll get into in a future post). But if it were, it’d be fair to say the computer is behaving in a perfectly rational, but utterly un-humanlike and even unsportsmanlike way. Given two options that provide the same gains, the human player is at least going to choose the one that shows a little courage. Responding to a futile situation with futile moves simply isn’t cricket.
The computer, on the other hand, chooses randomly when faced with objectively equal options. And since there is a multitude of futile moves available, such a move is actually much more likely. The plucky forward move is just plain outnumbered.
This is a good illustration of one of the core principles of game AI: the objective is not to act as an effective opponent. The objective is to provide an entertaining playmate. And while challenging the player’s ability is usually an important part of that, it’s not the same thing. In this case, the AI manages to look like a fool (if you don’t get why it made that decision) or a spoilsport.
It’s interesting that this comes up even in the context of a two-player, perfect information, strategy game. Such games are an extreme example of challenge-based gameplay. Human players might well imagine that the only consideration they expected of their opponent was to play to their best advantage (though, there are interesting stories that refute that notion as well).
But what about when options arise that are equal in that objective regard? Here, like some extremophile in a hostile environment, we still find pure social convention.