commit 6f9ee150c1faf3027cffe8c1182ae4154b471eaf
parent 146e7c95777eb9ebb6382f3beb9f2d1d15f09b0d
Author: Alexander Burger <abu@software-lab.de>
Date: Fri, 15 Jul 2011 15:54:08 +0200
Piece value adjustments and other minor changes
Diffstat:
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/games/README b/games/README
@@ -1,4 +1,4 @@
-10may11abu
+15jul11abu
(c) Software Lab. Alexander Burger
@@ -75,7 +75,7 @@ Your positions are marked with 'T', the computer's with '0'.
-The 'chess' game is minimalistic (441 lines of code). Nevertheless, it plays
+The 'chess' game is minimalistic (444 lines of code). Nevertheless, it plays
some slow - though correct - chess. Start it as:
$ pil games/chess.l -main +
diff --git a/games/chess.l b/games/chess.l
@@ -1,4 +1,4 @@
-# 04aug07abu
+# 15jul11abu
# (c) Software Lab. Alexander Burger
# *Board a1 .. h8
@@ -120,7 +120,7 @@
(dm name> () 'Q)
-(dm val> () 95)
+(dm val> () 90)
(dm moves> ()
(make
@@ -137,7 +137,7 @@
(dm name> () 'R)
-(dm val> () 50)
+(dm val> () 47)
(dm moves> ()
(make (tryMoves *Straight)) )
@@ -166,7 +166,7 @@
(dm name> () 'N)
-(dm val> () 33)
+(dm val> () 28)
(dm ctl> ()
(when (=0 (: cnt)) -10) )
@@ -378,7 +378,7 @@
# Capture ((p1 (p2) (p1 . f2)) . ((p1 . f1) (p2 . f2)))
# Castle ((K (K) (C . f2) (R . f4)) . ((R . f3) (K . f1)))
# Promote ((P (P) (Q . f2)) . ((Q) (P . f1)))
-# Capt/Prom ((P (p1) (P) (Q . f2)) . ((Q) (P . f2) (p1 . f1)))
+# Capt/Prom ((P (p1) (P) (Q . f2)) . ((Q) (P . f1) (p1 . f2)))
(de moves (Color)
(filter
'((Lst)
@@ -496,7 +496,9 @@
(T (bookMove 'd2 'd4)) )
(move (car (push '*Undo (cadr M))))
(off *Redo)
- (cons (car M) (mapcar cdar (cdr M))) ) )
+ (cons
+ (cdr (asoq (caaadr M) (cdadr M)))
+ (pick cdr (cdaadr M)) ) ) )
(de yourMove (From To)
(when
@@ -506,8 +508,7 @@
(== (caar Lst) (get From 'piece))
(== To (pick cdr (cdar Lst))) ) )
(moves *You) )
- (prog1
- (car (push '*Undo @))
+ (prog1 (car (push '*Undo @))
(off *Redo)
(move @) ) ) )
@@ -547,7 +548,9 @@
((not Args) (xchg '*Me '*You) (myMove))
((== '- (car Args)) (and *Undo (undo)))
((== '+ (car Args)) (and *Redo (redo)))
- ((yourMove (car Args) (cadr Args)) (display T) (myMove)) ) ) )
+ ((yourMove (car Args) (cadr Args))
+ (display T)
+ (myMove) ) ) ) )
# Print position to file
(de ppos (File)
diff --git a/games/xchess b/games/xchess
@@ -1,8 +1,8 @@
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
-# 29apr11abu
+# 15jul11abu
# (c) Software Lab. Alexander Burger
-(load "/usr/share/picolisp/games/chess.l") # (load "@games/chess.l")
+(load "/usr/share/picolisp/games/chess.l")
(de reply @
(prinl (glue " " (rest)))
@@ -13,7 +13,7 @@
(let L (car *Undo)
(reply "move"
(pack
- (cdr (assoc (caar L) (cdr L)))
+ (cdr (asoq (caar L) (cdr L)))
(pick cdr (cdar L)) ) ) ) ) )
(in NIL