I created a simple chess engine in C # over the past month and have made good progress on it. It uses a simple Alpha-Beta algorithm.
To fix Horizon-Effect, I tried implementing Quiescence Search (and failed several times before it worked). Engine power seems to have improved a bit from this, but it's awfully slow!
Previously, I could search for a depth of 6 layers in about 160 seconds (somewhere in the middle of the game), with a quiet search, the computer takes about 80 seconds to go to the search depth of 3!
The brute force counter of a node is about 20,000 nodes at a depth of 3, and the node's rest counter is up to 20 million!
Since this is my first chess engine, I really don't know if these numbers are normal, or if I made a mistake in my Quiescence-Algorithm. I would appreciate it if someone more experienced could tell me what the typical BF Nodes / Quiescent node relationship is.
Btw, just to see: (this method is called by the BF tree whenever the searchdepth value is 0)
public static int QuiescentValue(chessBoard Board, int Alpha, int Beta) { QuiescentNodes++; int MinMax = Board.WhoseMove; // 1 = maximierend, -1 = minimierend int Counter = 0; int maxCount; int tempValue = 0; int currentAlpha = Alpha; int currentBeta = Beta; int QuietWorth = chEvaluation.Evaluate(Board); if(MinMax == 1) //Max { if (QuietWorth >= currentBeta) return currentBeta; if (QuietWorth > currentAlpha) currentAlpha = QuietWorth; } else //Min { if (QuietWorth <= currentAlpha) return currentAlpha; if (QuietWorth < currentBeta) currentBeta = QuietWorth; } List<chMove> HitMoves = GetAllHitMoves(Board); maxCount = HitMoves.Count; if(maxCount == 0) return chEvaluation.Evaluate(Board); chessBoard tempBoard; while (Counter < maxCount) { tempBoard = new chessBoard(Board); tempBoard.Move(HitMoves[Counter]); tempValue = QuiescentValue(tempBoard, currentAlpha, currentBeta); if (MinMax == 1) //maximierend { if (tempValue >= currentBeta) { return currentBeta; } if (tempValue > currentAlpha) { currentAlpha = tempValue; } } else //minimierend { if (tempValue <= currentAlpha) { return currentAlpha; } if (tempValue < currentBeta) { currentBeta = tempValue; } } Counter++; } if (MinMax == 1) return currentAlpha; else return currentBeta; }
c # algorithm chess alpha-beta-pruning
xXliolauXx
source share