| Author |
Message |
Steven Gustavson (Steven)
| | Posted on Friday, November 23, 2001 - 2:42 pm: | |
I'm trying to set up a move that will only work for a piece beginning the move in a specific zone. As soon as the piece leaves the zone, the move should end. The piece, otherwise, should keep moving without jumping anything, and not ending on a friendly piece. I've tried the following syntex, as well as a dozen variations, but keep getting "parse errors" without really knowing where the mistake is. Any advice anyone? (define move (while (in-zone? $1) (verify not-friend) add $2) ) |
Dan Troyka (Dtroyka)
| | Posted on Friday, November 23, 2001 - 9:27 pm: | |
The following should work: (define move ((while (in-zone? $1) $2 (verify not-friend? add) ) You were missing a "?" after not-friend. In addition, I have put the $2 before the add. Otherwise the code tests for a friend on the start square and always finds one there, the moving piece, which means that no move is ever generated. Plus putting the $2 before the add allows the piece to leave the zone by one space before the move terminates. |
Dan Troyka (Dtroyka)
| | Posted on Friday, November 23, 2001 - 9:34 pm: | |
oops, let's try that again. (define move ((while (in-zone? $1) $2 (verify not-friend?) add)) ) Okay, barring further typos, that should work. |
Steven Gustavson (Steven)
| | Posted on Friday, November 23, 2001 - 10:45 pm: | |
Ah yeah, this is a step closer. But it seems the piece, while it can land on an enemy (good thing), it can also sail on right past/over them. I'm trying to get it so that it won't "jump", what I mean, is, that it can't move on past another enemy or friendly piece. |
Steven Gustavson (Steven)
| | Posted on Saturday, November 24, 2001 - 7:42 am: | |
I think I've got it. (define move ((while (in-zone? $1) $2 (verify not-friend?) add (verify not-enemy?) add)) ) that seems to work. thanks for the help. ;) |
|