negamax

Is there something wrong with my quiescence search?

断了今生、忘了曾经 提交于 2021-02-10 20:14:23
问题 I keep getting weird behavior in my negamax-based AI when I try to implement QuiesenceSearch. I based it on the pseudo-code from here: int Quiesce( int alpha, int beta ) { int stand_pat = Evaluate(); if( stand_pat >= beta ) return beta; if( alpha < stand_pat ) alpha = stand_pat; until( every_capture_has_been_examined ) { MakeCapture(); score = -Quiesce( -beta, -alpha ); TakeBackMove(); if( score >= beta ) return beta; if( score > alpha ) alpha = score; } return alpha; } And this is my code:

Adding Alpha Beta pruning to Negamax in Java

早过忘川 提交于 2019-12-14 03:55:24
问题 I am making a chess game in Java and (I think) have successfully implemented Negamax for the AI player. I am having some trouble adding alpha beta pruning to this to improve the algorithm. I have tried following tutorials and example code but just can't get my head around how it works. Below is the code I currently have to get the best move: private Move getBestMove() { System.out.println("Getting best move"); System.out.println("Thinking..."); List<Move> validMoves = generateMoves(true); int

Converting Minimax to Negamax (python)

耗尽温柔 提交于 2019-12-10 10:44:19
问题 I'm making an Othello player, and implemented a minimax algorithm with alpha-beta pruning. Then I did a bunch of research on the best ones online and keep hearing about a "negamax" algorithm that they all use. It seems like most people think negamax is faster than minimax (i think because it doesn't switch between min and max player?), so I'd like to turn my minimax algorithm into negamax if that's not too difficult. I was wondering if people had any insight on how much faster using negamax

Converting Minimax to Negamax (python)

[亡魂溺海] 提交于 2019-12-06 06:31:04
I'm making an Othello player, and implemented a minimax algorithm with alpha-beta pruning. Then I did a bunch of research on the best ones online and keep hearing about a "negamax" algorithm that they all use. It seems like most people think negamax is faster than minimax (i think because it doesn't switch between min and max player?), so I'd like to turn my minimax algorithm into negamax if that's not too difficult. I was wondering if people had any insight on how much faster using negamax is, and any tips or code on how to turn my minimax code into a negamax algorithm that'd be appreciated!