Simple AI...

Blitz3D Forums/Blitz3D Programming/Simple AI...

JA2(Posted 2007) [#1]
I'm making a game similar to columns with 1 and 2 player modes. I'm about to start the AI code for a computer controlled opponent but I have no idea where to start with it? How can I program the AI to make intelligent decisions about where to drop blocks?

Any advice and/or example code snippets would be much appreciated :)


LineOf7s(Posted 2007) [#2]
Some links to start you off:

http://www.vidarholen.net/contents/junk/tetris/

http://www.gamedev.net/community/forums/topic.asp?topic_id=391139

http://colinfahey.com/tetris/tetris.html

[edit] That first one's actually pretty good [/edit]


JA2(Posted 2007) [#3]
Thanks for the links :)

I've only just had the time to look at these. It only took about half an hour to add the AI, just need to add in some rotation and it's finished already.


LineOf7s(Posted 2007) [#4]
Well done! :o)

Which did you think helped the most?


JA2(Posted 2007) [#5]
It was the gamedev topic that helped me the most :)

I'm just finding the edges for each square and getting the height of each stack to tell where to drop the next block. I'm using 2 arrays, 1 for the blocks already placed on the board and another contains the edge/height values. The AI player just moves left and right to the right column and drops the block. Rotating the block to use the other end or sideways is a bit trickier tho LOL