Author: Steven Edwards
Date: 14:21:35 02/24/04
Here's another code sample from Symbolic; it's intended use is to measure the progress gradient from node to node in a search of a KBNK position. All functions called in this sample are ChessLisp intrinsics. Also, note the Corner of Doom tropism calculation. (defun KBNKMerit (MyPos FColor) "Return the KBNK merit for the given position and first color" (let* ( (Merit 1000) ; The base return value (SColor (OtherColor FColor)) ; Second color (FKMan (ManFromColorPiece FColor King)) (FBMan (ManFromColorPiece FColor Bishop)) (FNMan (ManFromColorPiece FColor Knight)) (SKMan (ManFromColorPiece SColor King)) (FKSq (FirstSqOfBB (BBLocByMan MyPos FKMan))) (FBSq (FirstSqOfBB (BBLocByMan MyPos FBMan))) (FNSq (FirstSqOfBB (BBLocByMan MyPos FNMan))) (SKSq (FirstSqOfBB (BBLocByMan MyPos SKMan))) (TaxiFKSK (Distance FKSq SKSq)) (TaxiFNSK (Distance FNSq SKSq)) (FBColor (SquareColor FBSq)) (GoalSqs (SqListFromBB (BBAnd (ParityBB FBColor) CornerBB))) (MinDistGoalSq (min (Distance SKSq (first GoalSqs)) (Distance SKSq (second GoalSqs)))) (SKRimDist (DistanceFromBB SKSq RimBB)) (SKMobileCount (CardOfBB (BBAndNot (BBAtkFrSq MyPos SKSq) (BBAtkByColor MyPos FColor)))) (HMClock (getprop MyPos 'HalfMoveClock)) (HazardCount (CardOfBB (BBAndNot (BBAnd (BBAtkByColor MyPos SColor) (BBLocByColor MyPos FColor)) (BBAtkByColor MyPos FColor)))) (Hazard (* HazardCount (if (eql (getprop MyPos 'ActiveColor) FColor) 100 400))) ) (decf Merit (* TaxiFKSK 4)) (decf Merit (* TaxiFNSK 2)) (decf Merit (* MinDistGoalSq 8)) (decf Merit (* SKRimDist 3)) (decf Merit (* SKMobileCount 1)) (decf Merit (* HMClock 5)) (decf Merit Hazard) Merit))
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.