Making an easy AI

Winning in 0.7.1Version 0.7.1 of Tic-tac-toe Collection includes new AI difficulty settings. It turns out making an easy AI was quite hard.

At some point I plan to write an in depth post into how the AI works, but for now all you need to is effectiveness is based on how long it thinks for compared to how many possible moves there are. In this way it is quite unsophisticated.

So, for easy, I made the AI think for less time, and for hard, I made it think for more (I also made normal a little easier while I was at it). In general, this worked well. The problem was, even when I made it really easy, it was still impossible to be at it at standard game of Tic-tac-toe.

Standard Tic-tac-toe is a bit of problem all round frankly. I want the game to generally be a fun game, in which players have a good chance of winning (or losing). And that is not true of standard Tic-tac-toe. But not including it seems odd, so I have to try and accommodate it. Since you can’t beat the AI on normal anyway, I was already facing the problem that normal and hard would be the same, so I felt that it was important that at least easy would be different.

So in the end, I had to make the easy AI a little stupid. It still does scale it’s thinking down but now it also has a chance of just choosing a move at random. That chance should be low for games with more moves, so it doesn’t become silly on larger boards. But it does mean you can, occasionally, win a game of Tic-tac-toe.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.