Jump to content

Recommended Posts

Here's an Extended Basic version of the classic board game Stratego where your opponent is the computer. The theme is the battle of Waterloo pitting Napoleon Bonaparte (you, with the blue units), Emperor of France, against the coalition forces led by the Duke of Wellington (the computer, with the red units).

While the AI will put up a stiff defense, its success, or yours, will depend heavily on the initial setup of the forces on the field. The computer will vary its setup from game to game in order to avoid predictability.

Designing the AI was pretty challenging because this is a game of incomplete information, and actually zero information at the start, and so the usual tree searches fail spectacularly. It turns out that programming common sense and strategic acumen is ridiculously difficult, particularly when memory is limited. There is definitely room for improvement, but with under 30 bytes of RAM left I had to make some tough choices, although I think the overall AI strength is pretty decent. At the very least it will not make idiotic mistakes :)

Being an XB game fitted into 2 separate but linked programs, one for the initial setup and another for the main gameplay, it is pretty slow, so joystick jockeys need not apply. Average response time during the early and late game is about 55 seconds but can take several minutes during the middle game, and a complete game can easily take a couple of hours.

 

UPDATE 4/7/19

 

With the help of Senior Falcon and his outstanding XB compiler, we were able to get Stratego to compile! Along the way, both the game and the compiler were enhanced, so make sure you check out the latest version of the latter, ISABELLA 2.0, under the XB development thread.

Now, Stratego runs over 6x faster, with an average response time of 10 seconds only, and it gets shorter as the number of units dwindles! The AI has been beefed up as well since compilation freed up more memory, and I even managed to uncover a couple of deep bugs within the depth of that complex code.

The game is now far more playable from a time-requirement standpoint, and I'm very pleased with the end-product.

:)

 

UPDATE 4/13/19

 

This last update does not make any enhancements to the gameplay. It combines the 2 parts of Stratego into one large program that is compiled using Senior Falcon's XB32K utility, thus eliminating the need to save/load data from disk when transitioning between the 2 parts, and in the process reducing the loading delay by a couple of minutes. This is mostly apparent for real hardware users however. Oh and the program now autoloads from XB. The manual has also been updated with the addition of a back cover as well. I think I'm going to officially sign off on this project at this point and call it done. :)

 

post-25753-0-36414400-1549596714_thumb.gif

Splash screen

 

post-25753-0-39258200-1549596735_thumb.gif

Setting up the forces

 

post-25753-0-75628700-1549596823_thumb.gif

Ready for battle!

 

post-25753-0-65498700-1549596913_thumb.gif

Combat resolution

 

post-25753-0-65433900-1549596855_thumb.gif

 

post-25753-0-74724200-1549596961_thumb.gif

Napoleon ravaging Wellington's deep lines

 

post-25753-0-32953700-1549597048_thumb.gif

Wellington attempting a desperate right flank counter-attack

 

post-25753-0-28974200-1549597112_thumb.gif

Can you guess where the flag is?

 

post-25753-0-68107500-1549597194_thumb.gif

Napoleon wins the day!

 

Enjoy!

 

Here's the disk label courtesy of Omega. I do plan on creating a printed manual and disk package in very limited quantities hopefully in the next month or so.

 

 

post-25753-0-91156400-1549597327_thumb.png

Stratego Manual.pdf

STRATEGO.dsk

  • Like 24

Share this post


Link to post
Share on other sites

Holy cow!!!! One of my favorite board games from childhood!!!!

 

Can't wait to try this one out! :)

 

 

Thanks Vorticon! :D

  • Like 2

Share this post


Link to post
Share on other sites

Just one bit of warning for those of you trying it out: it takes several minutes to load after the setup is done (when it says Preparing for Battle). This is because it is saving the setup data to disk, loading the main program which is very large, then loading the setup data from disk again. Could not be helped as there was no way to have the game all fit into a single program...

Also, the sounds in emulation are not great, and I would recommend playing on real hardware for the best experience. While you could use Overdrive mode in Classic 99 which speeds things up considerably, it also makes the controls very touchy and the sounds are further distorted.

Share this post


Link to post
Share on other sites

The sounds might be better in MAME. Since my last upgrade broke it, I have not been bothered to work it back up (though I should.)

  • Like 1

Share this post


Link to post
Share on other sites

Walid, please put me on the list for a full package. I need me some of that in my life. :D

  • Like 1

Share this post


Link to post
Share on other sites

Wow, what a coincidence! I was just playin this on my Power Mac. Now I will have to play on my TI99! :)

 

Let me know how the AI compares!

Share this post


Link to post
Share on other sites

Walid, please put me on the list for a full package. I need me some of that in my life. :D

 

For our 2 dedicated junior TIer's, Buck and Cesar, each will get a complimentary copy :)

  • Like 3

Share this post


Link to post
Share on other sites

 

Let me know how the AI compares!

 

 

Sure I wish we could do computer against computer and see how the AI faires

Share this post


Link to post
Share on other sites

 

 

Sure I wish we could do computer against computer and see how the AI faires

 

You kind-of could, via a wet-ware interface device between the two computers.

Share this post


Link to post
Share on other sites

very nice! with tipi you could do multiuser :)

 

If you would like to sell through my store lmk. otherwise I will just buy a few copies and stock them..

 

Greg

  • Like 1

Share this post


Link to post
Share on other sites

very nice! with tipi you could do multiuser :)

 

If you would like to sell through my store lmk. otherwise I will just buy a few copies and stock them..

 

Greg

Greg, I don't plan on selling the packages, but you are welcome to create and sell them on your site if you would like and keep the profits. My way to support your store :). I am only going to make a few copies which will go to the handful of contributors to the game as well as Buck and Cesar. I will also keep a copy to use as a door prize for the next Chicago Faire companion Friday event.

  • Like 5

Share this post


Link to post
Share on other sites

I can't wait to play this! I actually thought of Stratego as a programming project once and immediately dismissed it for AI reasons. I'm excited to see how you've done it.

  • Like 1

Share this post


Link to post
Share on other sites

The AI concept is pretty simple here and mainly consists of many simple heuristic rules each covering a specific situation. For example, one rule would state "don't attack a known enemy piece of higher value". I attach a score to each rule, and rules override each other depending on the score while others have a special urgent trigger which calls for immediate action regardless of the score. You will recognize those when the response time is much shorter than usual. The main challenge encountered while working on the AI is how to balance the score assignments, and I think I have easily played several dozen games, each time taking careful notes of the computer responses, then going back and tweaking the scores. Frequently one change would break some other rule somewhere, leading to more debugging :P The program cycles through all the computer pieces, and subsequently picks randomly from a set of the 5 top scores. If several top scores are equal, the first 4 choices are the same but the 5th is the next best one, which helps reduce repetition, therefore it's not always obvious what the computer will do at any one point, particularly in the end game..

All the computer units have a general "drive" and a few have more specialized ones. The main difficulty with Stratego is how to deal with unknown enemy units. Humans have a poorly defined intuition on what might constitute a good move strategically and trying to program that into the computer was impossible within the confines of the memory available, but on the other hand the computer has perfect memory and will track an uncovered enemy unit without fail as well as those which have moved, helping reduce uncertainty somewhat. If I had more memory, I could have created a probabilistic map of the entire field to help guide strategy...

Overall, however, it's interesting to see how a set of simple rules can generate complexity, and frequently the computer would surprise me with its decision.

I would very much welcome feedback on the AI strength for my own edification and for application to future games :)

Edited by Vorticon
  • Like 2

Share this post


Link to post
Share on other sites

If memory is the issue you should make a SAMS version!

 

That would solve most of the issues.

 

A RXB version would put all the Assembly & Data into SAMS 4K pages.

 

As these are Program Image loaded would speed up loading and set up.

Edited by RXB
  • Like 1

Share this post


Link to post
Share on other sites

I did some minor finetuning of the AI which improves play in some selected circumstances. The disk image in the first post has been updated. There is so much more I would have liked to enhance, but I only have 14 bytes left... Regarding using RXB, the SAMS card wouldn't help here because all the data is already off-loaded to disk. I really need something like 64K of RAM :)

On a side note, there is a possibility that the program could be made to compile with Senior Falcon's XB compiler. The main hitch is the fact that I make heavy use of the SUB facility in XB with array argument passing, something the compiler does not currently support, but Harry is optimistic there might be a way to fix that. Stay tuned!

Share this post


Link to post
Share on other sites

For what it's worth, it is possible to use all 32K for an XB program. You put lines of XB code into low memory, probably with an assembly sub. Then the main program is loaded into high memory. Then the line numbers from the low memory code have to be added to the line number table in high memory. Once the program is set up this way, XB doesn't care that the actual code is in low memory as long as the line number table is where it expects. One shortcoming is that editing the program would not be as simple as it is normally in XB. Also, the program would have to be saved in 2 segments, one for low memory and one for high memory.

 

Edit:

Try this: CALL INIT::CALL LOAD(-31952,63,255,63,255,"",-31868,63,255,63,255)

Now when you load an XB program it will be loaded into low memory. You can verify this with Classic99's debugger.

Edited by senior_falcon
  • Like 2

Share this post


Link to post
Share on other sites

So in the case of Stratego, the main game program is chain-run after the setup program is done. If the main program is in 2 segments, how would I go about loading it from the setup program?

Also, would you mind posting the actual assembly code for the CALL LOAD statement so I can better understand how you do this?

Share this post


Link to post
Share on other sites

Walid, I may try to convert Stratego to Forth. Do you think it too much work?

 

...lee

 

The main difficulty is going to be the subroutines conversion. Also, it's quite a long program. Happy to assist you in this endeavor if you are up to it. It would make a great show and tell at the next Chicago Faire companion event!

I am attaching the source code in TIdBiT format which should make things much more readable.

Stratego Initialization.txt

Stratego Main Gameplay.txt

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...