Apr 21 2008

Thud: board organisation, 2-way interaction

Published by Dougal at 10:41 pm under Friends, Programming

What’s the latest on Thud?, I’m sure I heard you say. Well, bits and pieces. I’m still at the point where I don’t really have a good strategy for the AI, I’m just playing. But whenever I have an idea it takes a while to link it in to the current system. So I’d like to get some strategy combinators working. That might help to add a bit more structure to my code, which is looking quite messy now.

Also, I made some enquiries about other board game implementations and received some good replies from the Haskell Café list. A couple of notable ideas:

  • Don’t bother holding an array for the board, just carry around separate lists for each piece. Makes it easy to locate friends and foes on an otherwise-quite-large board.
  • Use Prompt to abstract ideas of user/computer interaction. I’ll have to look into this again but from what I remember it was quite an elegant way of containing a two-sided conversation (between user and computer, for example).

I also wrote a bit of simple network code to see how to write a server. I can connect to a known port with telnet and send the server messages; it sends back the number of characters in each line in return. It then hangs up on receiving “quit!” — not complex, but pretty close to what I need.

Trackback URI | Comments RSS

Leave a Reply