Author: Robert Hyatt
Date: 19:58:00 01/22/04
Go up one level in this thread
On January 22, 2004 at 10:03:55, Steven Edwards wrote: >Here's some example code for the ChessLisp intepreter in my program Symbolic: > >;;;; emp.lsp: Enumerate movepaths > >(defun emp (theFEN theDepth) > "Enumerate distinct movepaths from a FEN string to a depth" > (cond > ((not (string? theFEN)) > "Error: first argument must be a FEN string") > ((not (and (integer? theDepth) (nonnegative? theDepth))) > "Error: second argument must be a nonnegative integer") > (t > (let ((thePos (PosFromFEN theFEN))) > (if (null? thePos) > "Error: invalid position" > (emp-aux thePos theDepth)))))) > >(defun emp-aux (thePos theDepth) > "Enumerate distinct movepaths from a position to a depth" > (cond > ((= theDepth 0) 1) > ((= theDepth 1) (length (Generate thePos))) > (t > (let ((theSum 0) (theEnv nil) (theMove nil) (theML (Generate thePos))) > (dolist (theMove theML) > (Execute theMove thePos theEnv) > (incf theSum (emp-aux thePos (1- theDepth))) > (Retract theMove thePos theEnv)) > theSum)))) you know, when I was first introduced to Lisp a _long_ time ago, I looked the person right in the eye and said "that is a write-only language." My opinion has not changed. :) Thank goodness vi supports the % key. :)
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.