Archived

This topic is now archived and is closed to further replies.

Stratigo AI

This topic is 5844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I entered a duel with my Comp Sci III. teacher about which one of us can make the best Stratigo clone. Where going to let people to vote after Christmas break to see which one of us wins. Right now my game has quite a bit going for it. It''s REALLY customizable, has a Direct Draw engine with specail effects and includes skins, as well as being a fully playable 2 player game. Graphically it looks like I got him beat as he is using the Windows GUI. However... I''m now at the most important part, the AI. Basically my game is a 10x10 array of guys, each with a Number, Known and Owner property. An interface class draws them all out right and the functions to move and end turns and everything are all in place so all I really need is a function that can pick a good next move based on what the computer knows. (I''ll need placement AI to but that will be pretty easy and work off a few paterns) What I was thinking was a big double for loop to go through all the boards subscripts, seeing is a guy belonged to the computer then seeing what was ajasent to it. Then it would assign a point value to that move and at the end move with the greatest value. This does have several drawbacks though, most off all the fact it can only think about peices it''s touching, not peices 1 or 2 tiles away. So, before my post gets any longer... can anyone think up a better way? Thanks!

Share this post


Link to post
Share on other sites
Your code sobviously should remember what the pieces are that have been revealed through prior encuonters. It should also remember the pieces which have never moved as possible bomb suspects. It should protect its bomb defusers. It should use scouts to determine the value of other pieces. It should sometimes try and ''fake out'' the other guy by moving a piece in such a way as to make the other guy think it is a different piece. You should attempt to hunt pieces you know the value of.

You need some AI for board setup also. One strategy I like is to setup the flag and a piece one higher ranking than the bomb defuser protected completely by bombs so when a bomb defuser comes and defuses a bomb near the flag you can capture it with the higher ranking piece.

Share this post


Link to post
Share on other sites
I done something like this for my final year project (in Java). The way I got around it was for the AI to associate a score with each ranking piece. Then it went through a simple loop for each of it''s own pieces.

It used probability to determine if any unknown opponent pieces had a chance for defeating it. if so then it would determine whether or not to attack / move depending on the importance of that piece in danger.

It would attack if it knew the value of the opposing piece, knew it would win and that it couldn''t be taken within the next turn (using the above probability).

It would attack if it didn''t know the value of the opposing piece but either a) the probability was good. b) the opposing piece was of interest (next to an old bomb perhaps), c) the piece examined was v.weak and of little importance.

It just came down to estimating values for each move and then picking the best one from the list.


anyway just some ideas :-)

Share this post


Link to post
Share on other sites
Stratego is a (relatively) simple game to play. Write down the 5 or 6 steps you go through as you play. Now for each of those items, write down the question you ask yourself and the possible answers. You should now have a sort of flow-chart.

Just turn this into code and you have it. Of course, it won''t be BigBlue, but it will play well.

-M

Share this post


Link to post
Share on other sites
Well, i looked at a little stuff on the minimax algorithim and i think i fugured out how to do it (not sure if this is close to the minimax or not, seems like it though) Basically it will be set up like a 4 way recursive tree (i know, fun code... ) What i want it to do though is start at a computer peice, then go to the 4 ajacent peices, if it hits the end of the board or lands of a peice it returns that peices rating and the number of tiles away it is, if not it re-calls itself to find the 3 peices adacent to it and so on (it doesn''t look at the one that sent it). It then rates them and moves. Already I do see a few problems (like the diagonals are checked 2 times) but I think it will make a good engine. So, any ideas or oppions?

Share this post


Link to post
Share on other sites