This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Need help with Minimax Algorithm  RSS feed

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!