More minmax woes

Did I ever tell you that minmax is hard to get right? I realized by inspecting a crash that there was a fundamental flaw in my minmax implementation. Not in the algorithm itself, but rather in the rollbacking of the state that takes place on every try. I realized that the algorithm doesn’t rollback exactly to the good point in time when trying a new choice. It’s not conceptually hard to fix, but it will still require rewriting some code. The main difficulty is that the part of the code that knows where to rollback is currently not aware of the part of the code that does minmax. At least I have unit tests for all the limit cases so I hope I can be back to business in no time.

UPDATE: On top of that, my computer just died on me.. No Mox for me for the next week 😦

To be continued…

Advertisements

About fparadis2

Lead Game programmer
This entry was posted in Mox. Bookmark the permalink.

6 Responses to More minmax woes

  1. Hellfish says:

    Maybe my understanding of minmax is flawed but why would the rollback code need to be aware of what the minmax code does? As far as I understand,
    1.Save the original state the game was in when the AI”s turn comes.
    2.Try as many actions as computing time allows, assigning score.
    3.Roll back to original state.
    4.Perform the action with the highest score.

    Therefore, if your game state can be robustly saved and loaded, the minmax code should be none the wiser,really?

    • fparadis2 says:

      Your understanding looks fine 😉
      Each “try” requires setting up a transaction and rolling it back after the try. And tries form a tree so you end up with a tree of transactions. The problem, in my case, is that the transaction is not started *exactly* the moment the “try” starts, but rather the first time a choice has to be made by the AI (which is often the same, but not always obviously as I found out).

  2. Huggybaby says:

    Hey Mox,

    If you would like a forum at Slightlymagic just let me know. The more the merrier, and we’d love to have you.

    Thanks!

  3. Ben says:

    It has been over a week. I hope things are going better for you.

  4. www says:

    1 month have passed away, are you still with the project?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s