Check out Janggi (Korean Chess), our featured variant for December, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

PawnX: new modest vatiant[Subject Thread] [Add Response]
Matteo Perlini wrote on Mon, Nov 26, 2012 10:24 AM UTC:
Hi M. Winther,

>>>It is generally recommended for newcomers to Zillions programming to begin with a simpler game.<<<

I know, but I cannot limit my imagination. :-)

>>>I suppose, the simplest way to solve this is to introduce yet another move-type which has the highest priority of all.<<<

I think it is enough just two type of move: normal and "tasty". In the tasty moves, with higher priority, you verify (KING-NOT-IN-CHECK AND IT-IS-POSSIBLE-TO-CAPTURE-A-PAWN).

>>>So you must loop through the board squares until you find the friendly king, and verify that it is threatened.<<<

I'm having big trouble here. I wrote:

(piece
(name Controller)
(dummy)
(moves
(
capture king-check
START next
(while on-board?
(if (and attacked? (piece? King))
(create Marker king-check) )
next
)
add
)
)
)


The idea behind is: a scan all the board and if any king is in check it is moved a marker in the dummy square named "king-check". I use "capture king-check" to clean the dummy square. (Assume I already defined all the links with "next", starting from the dummy square START.)

The problem is this piece of code doesn't work. What am I doing wrong?