Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Symbolic: From bitboards to ideas

Author: Vincent Diepeveen

Date: 09:37:36 03/13/04

Go up one level in this thread


On March 13, 2004 at 11:52:07, Steven Edwards wrote:

>Consider the position BWTC.0025:
>
>[D] r1bq1r1k/ppp1N1p1/7p/2bp1pN1/2Bn1B1Q/8/PP3PP1/R3R1K1 w - - 0 1
>
>It's a mate in three starting with 1. Qxh6+; however, I picked it for an example
>as it also has a number of possible knight forks for White.
>
>A traditional chess programs can discover knight forks only by search.   A goal
>for Symbolic is to recognize tactical motifs via pattern matching, use these
>ideas for plan formation, and then use the plan to guide a very narrow search to
>produce a verification of the plan.
>
>So, here's some sample test code to recognize, without search, potentially
>interesting knight forks.  It's an example of bridging the gap between bitboards
>and ideas.

oh what a horrible code.

Am i glad that i program in C.

>(defun SKF (MyFEN)
>    "Interactive tester for SuggestKnightForks"
>    (let* ((PosVal (PosValFromFEN MyFEN)) (MoveVals (GenerateVal PosVal)))
>        (SuggestKnightForks PosVal MoveVals)))
>
>(defun SuggestKnightForks (MyPosVal MyMoveVals)
>    "Return a list of potential knight fork ideas"
>    (let*
>        (
>            (Ideas nil)
>            (AColor (ActiveColorFromPosVal MyPosVal))
>            (PColor (OtherColor AColor))
>            (VictimBB
>                (BBAndNot
>                    (BBLocByColorPV MyPosVal PColor)
>                    (BBLocByManPV MyPosVal (ManFromColorPiece PColor Knight))))
>            (MoveVals
>                (SelectMoveValsByFrMan
>                    MyMoveVals
>                    (ManFromColorPiece AColor Knight)))
>        )
>        (dolist (MoveVal MoveVals)
>            (let ((Idea nil) (VictimManSqList nil))
>                (setf VictimManSqList
>                    (SortRevManSqList
>                        (ManSqListFromPosValBB
>                            MyPosVal
>                            (BBAnd
>                                (AttackByKnightBB (ToSqFromMoveVal MoveVal))
>                                VictimBB))))
>                (when (> (length VictimManSqList) 1)
>                    (setf Idea
>                        (list
>                            (list 'try MoveVal)
>                            (list 'escape (first VictimManSqList))
>                            (list 'capture (second VictimManSqList))))
>                    (format t "Idea: %u %n" Idea)
>                    (push Idea Ideas))))
>        Ideas))
>
>Running the above with BWTC.0025 produces:
>
>Idea: ((try Nxf5) (escape (BlackPawn h6)) (capture (BlackPawn g7)))
>Idea: ((try Ng6+) (escape (BlackKing h8)) (capture (BlackRook f8)))
>Idea: ((try Nf7+) (escape (BlackKing h8)) (capture (BlackQueen d8)))
>Idea: ((try Ne6) (escape (BlackQueen d8)) (capture (BlackRook f8)))
>Idea: ((try Nc6) (escape (BlackQueen d8)) (capture (BlackPawn a7)))



This page took 0.01 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.