Yesterday and today I spent some time coding some basic AI into Blitz Blox. The AI really doesn't do anything right now except
- Pick a random column
- move cursor to that column
- drop a block
Rinse, wash, repeat. While that may not seem like much, it's actually just the foundation on which I'm going to build the more advanced AI. See the AI has two functions, Planning and Execution, which occur simultaneously as scheduled function calls (remember I'm dealing with TorqueScript here). When the Planning function is called, and the AI is in a planning state, the AI determines its move. The more complex its thinking (the harder the difficulty is set) the more times this function is called before a decision is reached. When the Execution function is called, it moves the AI's cursor one column and checks if that's the column the AI wants to be in. If so, and the AI has made a decision on what to do, it drops a block onto the play field.
Simple enough, the hard part is going to be making it appear smart. To do that I still have a few changes to make to the gameplay. In my last entry about Blitz Blox, I was wrestling with the problem of how blocks should interact once they are on the playfield (which I refer as the "stack"). I've decided to take Emmanuel's suggestion, as it really is the only way to keep things under control in various situations. I'm also going to apply a discharge precedence - when a block is first dropped onto the playing field, it discharges before being affected by any surrounding blocks. When a block on the stack drops to a lower row, it is first affected by surrounding blocks before being allowed to discharge.
After that's done I'm going to get all the special blocks implemented, and then I can begin cracking hard on getting the AI up to snuff. We'll see what I can get done next week. Hopefully by Wed I'll be well into getting the special blocks working, and by the end of the week starting to bulk up the AI some more.
In other news, my car is stuck in the damn ice that we didn't shovel the first day it snowed (Wed). And while it was like a 1/4 in of ice, 2-3 in of snow and like 1/2 in of ice layered back then - now that it's thawed and frozen again and again these past two days it's pretty much just a solid sheet of ice now.
Freakin great. [flaming]