• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with Minimax Algorithm

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to implement a minimax algorithm based on this pseudo code below. Could anyone tell me if this pseudo code is correct, because I'm haivng a hell of a time getting it to work. Some things I don't get are:

1. In the MinMove function why do they use move > best_move (identical to max move). Shouldn't the min move try to minimiz max's advantage, thus it should be < (or better yet <= )?

2. Assuming best_move and move are integer values, how can I assign a null type value or -infinity / +inifity? Since minimax starts evaluating from bottom up, say for example it is evaluating the last MaxMove (very top of tree - root) and it's default best_move value = 0, and the move value returned is -1, but there are currently no moves returned by MaxMove, so it must return the -1 move, but will not since it is less than zero. What if there are a couple different moves that return a loss (-1) and MaxMove will not include any of them because they are less than zero, thus causing the program to error out.

3. Why is the if -> GameEnded function not also included in the MinMove?

Sorry for the all the questions, but I've been at this for a long time, and most online resources really suck. All I'm after is an algorithm that is actually correct, and I'm almost positive this one is not.

I found it at this site in case anyone is interested:
http://ai-depot.com/LogicGames/MiniMax.html


[ August 12, 2006: Message edited by: Bob Zoloman ]
 
Bob Zoloman
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it to work, in case anyones interested this is the pseudo code that works for me.


[ August 12, 2006: Message edited by: Bob Zoloman ]
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic