• Post Reply Bookmark Topic Watch Topic
  • New Topic

minimax algorithm?!?!  RSS feed

 
Sarah isme
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, i'm new here, i hope i posted this is the right place
...........
i am having trouble trying to apply this "minimax algorithm" thing to my basic game (its called "grundy's game") its on the web somewhere, i am just developing my own basic version.

i have googled for hours to try and find a good explanation of the minimax algorithm and/or how to apply it, but i have found nothing decent!

that is, how do you know which value to give to things and stuff like this, nowhere seems to explain this! (or is it really obvious, and so thats why they don't??)

would anyone here be able to point me in the right direction or help me out?

Thanks

sarah
 
Kenneth Albertson
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sarah isme:
how do you know which value to give to things and stuff like this, nowhere seems to explain this!
The algorithm is a general search strategy which can be applied to different games. But the state values depend on the game, and are independent of the algorithm. You need to study the game, rather than the search algorithm. Your end result has two parts: search algorithm + state valuation algorithm.
 
Sarah isme
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well the game is this game called "Grundy's Game" you can see it at
http://www.cut-the-knot.org/Curriculum/Games/Grundy.shtml

could you (If you have time) breifly explain how you use this minimax algoithm, i just don't get it at themoment
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sarah isme:
could you (If you have time) breifly explain how you use this minimax algoithm, i just don't get it at themoment


The min-max algorithm is basically use play out a game. The algorithm tries to find the best next move, by playing out many moves ahead. It gets its name by how it figures it out. It tries to maximize the score when it plays its moves, and it minimizes the score when it plays the opponents. In the end it will choose the best next move by minimizing and maximizing the possible outcomes.

Of course, the minimizing part is just a guess. The opponent is under no obligation to pick the best move.

Henry
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sarah,

Welcome to Java Ranch! I hope we can help you. In fact, I've tried to post an explanation several times, but I crashed the computer the first time and the second time I closed my browser on accident.

I think there are plenty of resources on the Web that can explain it better than I can. Perhaps it will help if you tell us what you don't understand about the minimax algorithm.

Also, is this for a class in college? If so, do you have a textbook that explains the minimax algorithm? I susgest you read through it since there is probably a simple example.

One suggestion I have is to try to implement a simpler game, such as Tic-Tac-Toe using the minimax algorithm. If you can get that working, you should understand it a lot more so that you can get it working on this other game you need to do.

I hope this helps. Please answer my questions above and I will do what I can to help.

Layne
 
Sarah isme
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh ok i get it now!

thanks for all your replies everyone

i got it working! yay!

-Sarah
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!