Why does this Piece of code cause a c... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Why does this Piece of code cause a crash? « Previous Next »

Author Message
Y Dienyddiwr Da (Dienyddiwr)
Posted on Thursday, May 03, 2001 - 3:31 am:   

(define drag (
$1 (verify empty?) cascade
back (opposite $1) from $1 add
))

It effectivly drags the piece behind the one
you are moving with it...
It does so the first move, but states that piece
that doesnt exist was reporting moves???
move again, and the program outright crashes!
what happened?
Y Dienyddiwr Da (Dienyddiwr)
Posted on Thursday, May 03, 2001 - 4:25 am:   

states that ~A~ piece doesnt exist.

sorry, its late here ^,^
Jeff Mallett (Jeffm)
Posted on Thursday, May 03, 2001 - 8:14 am:   

The piece of code is bad because it can (and does) try to move a piece from a position that is empty, just like the program states. Change it to:

(define drag (
$1 (verify empty?) cascade
back (opposite $1) (verify not-empty?) from $1 add
))

As for crashing, I've tried to duplicate it, but it's not happening to me.
Y Dienyddiwr Da (Dienyddiwr)
Posted on Thursday, May 03, 2001 - 3:09 pm:   

Ah, thank you very much, that solved it quite well.

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: