--hsm
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu<p></p><center>- § -</center><p></p>
<a name="_piece"></a><h3><font color=#CC0000>piece</font></h3>
<b>syntax: (<font color=#CC0000>piece</font> <em>square</em>)</b><br/>
<b>parameter: </b><em>square</em> - which square of the board<br/>
<p><b>return: </b>the piece found at <em>square</em> of the board</p>
<p></p><b>example:</b><blockquote><pre> (piece "e1")
=> "k"</pre></blockquote>
<p></p><center>- § -</center><p></p>
<a name="_side"></a><h3><font color=#CC0000>side</font></h3>
<b>syntax: (<font color=#CC0000>side</font> <em>square</em>)</b><br/>
h1, h2, h3, h4 {
font-family: Georgia, Times New Roman, Times, serif;
font-size: 110%;
}
(replace "<hr>" text "[hr]")
(replace "</hr>" text "[/hr]")
(replace "[hr]" text "<hr>")
(replace "[/hr]" text "</hr>")
(define (format-see-also text)
(letn (link-list (string "<b>see also: <b> - "))
(dolist (lnk (parse text))
(push (string "<A HREF="#_" lnk "">" lnk "</A> ") link-list -1))
(string link-list))
)
(replace ";; *@see-also (.*?)n" page (format-see-also $1) 0)
(define (find-king which-side)
(if (= which-side "w")
(setq k? white-king?)
(setq k? black-king?))
(catch
(dolist (candidate keylist)
(if (k? candidate)
(throw candidate)))))
...
candidate is: f8
candidate is: f7
candidate is: f6
candidate is: f5
candidate is: f4
candidate is: f3
candidate is: f2
candidate is: f1
candidate is: e8
value expected in function = : square
called from user defined function board:white-piece?
called from user defined function board:k?
called from user defined function board:find-king
(define (side square)
((board square) 1))
(define (board:board key value)
(if value
(begin
(push key keylist)
(context 'board key value))
(context 'board key)))
(define (white-piece? square)
(= "w" (side square)))
(define (find-king side)
(if (= side "w")
(setq k? white-king?)
(setq k? black-king?))
(catch
(dolist (candidate keylist)
(println "candidate is: " candidate)
(if (k? candidate)
(throw candidate)))))
(define (white-piece? square)
(= "w" ((board square) 1)))
define (init-board)
(board "a1" (list "r" "w" "w"))
(board "b1" (list "n" "w" "b"))
(board "c1" (list "b" "w" "w"))
(board "d1" (list "q" "w" "b"))
(board "e1" (list "k" "w" "w"))
(board "f1" (list "b" "w" "b"))
(board "g1" (list "n" "w" "w"))
(board "h1" (list "r" "w" "b")))
(context 'board)
(define (board:board key value)
(if value
(context 'board key value)
(context 'board key)))
(define (init-board
(board "a1" (list "r" "w" "w"))
(board "b1" (list "n" "w" "b"))
(board "c1" (list "b" "w" "w"))
(board "d1" (list "q" "w" "b"))
(board "e1" (list "k" "w" "w"))
(board "f1" (list "b" "w" "b"))
(board "g1" (list "n" "w" "w"))
(board "h1" (list "r" "w" "b"))))
(context MAIN)
> board
(lambda (key value)
(if value
(context 'board:board key value)
(context 'board:board key)))
(lambda ((board:board "a1" (list "r" "w" "w")) (board:board "b1" (list "n" "w" "b"))
(board:board "c1" (list "b" "w" "w"))
(board:board "d1" (list "q" "w" "b"))
(board:board "e1" (list "k" "w" "w"))
(board:board "f1" (list "b" "w" "b"))
(board:board "g1" (list "n" "w" "w"))
(board:board "h1" (list "r" "w" "b"))))
MAIN
> (board "a1")
nil
>