Mysterious parse error Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Mysterious parse error « Previous Next »

Author Message
Mark Thompson (Markt)
Posted on Wednesday, July 10, 2002 - 7:44 pm:   

I'm working on implementing a game on a board with squares of 4 colors, in which all the squares of each color have been defined as a zone. I have a piece called a Dababante with a slide move that is confined to one color, but which can also make a step to an adjacent cell in any other color -- but ONLY if the player has no other Dababante on that color already. A player's four Dababantes begin two on red and two on yellow, but once one moves to green and another to blue, they're confined to one color -- unless one gets taken, in which case the survivors can move to whichever color doesn't have a Dababante on it. Hence the more get taken, the more powerful the survivors become.

The code I've written is supposed to use the macro "daba-step" to perform this single step, testing whether any square of that color already contains a friendly Dababante. It's below, and it seems okay to me. But it gives me a "parse error," and my efforts to find the bug or work around it have not succeeded. It says,
"expecting 'USYMBOL' or ''('' at ) (s (if not-friend? (mark (if (in-zone? red-zone) ( Ia1 (while (and (on-board?"

Would anyone be able to explain to me what I'm doing wrong?

(define check-color
(
$1 ; move to first cell of this color in the chain
(while (not (and friend? (piece? Dababante))) $2)
; loop through all the cells of that color looking for an
; allied Dababante
(set-flag color-available (not (and friend? (piece? Dababante))))
)
)

(define daba-step
; move to any adjacent cell, but only if the player has no dababante
; on that color already; note that this means the remaining dababantes
; grow more powerful when some are taken
(
$1
(
if not-friend?
(
mark
(if (in-zone? red-zone) (check-color Ia1 redlink)
else
(if (in-zone? green-zone) (check-color Ib2 greenlink)
else
(if (in-zone? blue-zone) (check-color IIa2 bluelink)
else
(if (in-zone? yellow-zone) (check-color IIb1 yellowlink))
)
)
)
back
(if (flag? color-available) add)
)
)
)
)

Mark Thompson
Chicago, IL
Dan Troyka (Dtroyka)
Posted on Wednesday, July 10, 2002 - 10:39 pm:   

Hey Mark -

Try removing the outer set of parentheses in the check-color macro, so that it starts:

(define check-color $1 ...

Do the same after the "if not-friend?" test in the daba-step macro.

Basically you do not need to group the commands following an "if" statement.

Hope this helps! It sounds like an interesting game.

Regards,
Dan Troyka

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: