home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.ai      Awaiting the gospel from Sarah Connor      1,954 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263 of 1,954   
   Ray Dillinger to Spirytus   
   Re: whats wrong with my minimax AB algot   
   18 Feb 04 03:24:36   
   
   From: bear@sonic.net   
      
   Spirytus wrote:   
   >   
   > hello everyone :) i'm quite new to java programming and AI but somehow   
   > managed to implement A* so far, but got problems with minimax with   
   > alpha-beta prunning. in fact i was trying to implement connect4 game   
   > but sometimes my AI player makes very stupid moves and i couldnt   
   > figure out if the problem is with my minimax algorithm or simply with   
   > evaluation function. i've created an abstract class that i hoped could   
   > be reused in other games and i would really appreciate any comments on   
   > my code. i wonder if that minimax with AB prunning is implemented   
   > properly or not and if i need to change anything or problem must be   
   > simply in evaluation function. i've also tried to insert conditional   
   > statement (now its commented) checking if game is finished or not but   
   > thought that maybe evaluation function could do the same and left it   
   > out so far. anyway thank you very much for any comments as such would   
   > be very much appreciated   
      
   Well, in a minimax system, it's usually one of three problems: either   
   the board scoring function doesn't do what you think it ought to do,   
   or the pruning doesn't do what you think it ought to do, or the minimax   
   function fails to distinguish immediate-win versus win-next-turn versus   
   win-X-turns-from-now where x is some number less than the depth you're   
   searching.   
      
   I'm not going to do a complete analysis of your code, and in particular   
   I didn't check to make sure your board value function is well formed or   
   that you got the pruning right - but I notice you did one thing that   
   may result in moves that aren't the smartest.   
      
   This system doesn't care whether it's making a move that wins this turn,   
   or next turn, or the turn after that.  So, even when it has a move on   
   the board that allows it to win immediately, if it happens to first   
   check some other move that allows it to reach a win later, it will make   
   that other move.  In some games, this can repeat indefinitely as it   
   always makes a move that means it *can* force a win two turns from now -   
   and never actually does.   
      
   You might want to counter this by subtracting the value of the variable   
   "ply" from the constant value of the winning board found.   
      
   				Bear   
      
   [ comp.ai is moderated.  To submit, just post and be patient, or if ]   
   [ that fails mail your article to , and ]   
   [ ask your news administrator to fix the problems with your system. ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca