Tuesday 15 July 2008

Automated playtesting

So, what's with the sudden interest in AI? Well, for the 2-player tile-based games, I want to see whether they have an inherent first-player bias. That is, does the person going first have a significantly better chance of being the winner than the player going second?

I could enlist a bunch of friends to play the game with me, over and over (like a monkey with a miniature cymbal), but I figure a computer's gonna be a lot faster and less resource-hungry. All I need now is some code that emulates the way human players play the game.

Now, I know this kind of intelligence isn't something I can rattle off in an hour or two. For the sake of my sanity, and to maintain my interest, I'm going to code progressively cleverer AI, starting with some incredibly simplistic stuff. That way, at least I'll get the positive feedback of seeing progress at regular intervals (a lack of which can consign projects like this to the graveyard in short measure).

These are the steps I figure I'll need to take:

  1. Develop code for the game components i.e. the tiles and the board
  2. Develop the rules for valid vs invalid tile placement, and for the scoring
  3. Develop strategies for placing the tiles
  4. Add some kind of human error and/or randomisation
  5. Set it off and log the results for different inputs (strategies, starting player, tile sets, board configurations, etc.)
  6. Crunch the numbers

Sounds simple enough. And I'm really looking forward to getting some hands-on practice with game trees, minimax and alpha-beta pruning, which I assume I'll need for the stategies. Wish I'd actually taken some notes at university now, instead of just trying to stay awake. Wikipedia to the rescue, no doubt.

Actually, it all sounds simple enough until we get to the stats at the end, but I'll worry about that later. :)

3 comments:

Steve said...

I wrote a chess program (in C++) for my final year disertation. No doubt the code completely sucks (I have clear memories of thinking it was pretty shit even then!) but I probably had some half decent stuff explaning alpha/beta pruned minimax (I think I can even REMEMBER it!) so if you want me to look for it (and spoil all your fun) give me a shout...

Mal said...

Yeah, I'd be interested in that, thanks. :)

That said, I've already scoured the web a bit and come to the conclusion that, while I'm happy reading the theory, I really don't want to read any code implementations. It would rob me of most of the fun of doing it myself and making mistakes along the way. I'd end up learning nothing. So, I'd be happy to read your notes, but don't worry about the code. :)

Steve said...

Good plan. The code would be harder to read than the notes anyway - and even though I don't code any more I still have SOME pride :-)