Spirit of Samhain
User
 Newbie
| Posts: 4 |   | Karma: 0
|
re:Lazy eval return values? - 2006/08/15 18:43
The most simple implentation would be to rewrite the Eval() function like this -I assume you understand C pseudo-code- Eval( pos, alpha, beta ) // we add alpha/beta as parameters. { // roughly evaluate position by computing only material balance. SCORE materialBalance = material[thisSide] - material[opponent]; largest possible positional score wont bring it // back into the window then abort the cpu consuming part of the eval and return. if( materialBalance < alpha - LARGEST_POSITIONAL_SCORE ) return alpha; if( materialBalance > beta + LARGEST_POSITIONAL_SCORE ) return beta; material for instance-. Lazy evaluation can save a significant amount of cpu time. And if used properly I don`t think this is a dangerous thing to do. In my program I use a 2 pass lazy evaluation and it works fine. Hope this answers your question ---------
If a woman has to choose between catching a fly ball and saving an infant's life, she will choose to save the infant's life without even considering if there are men on base.
Popular posts by Spirit of Samhain Seirawan`s Opening Solution Seeking pruning algorithms - neep h...
|