Fire and Ice Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Fire and Ice « Previous Next »

Author Message
Terry Christian (Christian)
Posted on Monday, January 10, 2005 - 8:59 am:   

I'm trying to programme the game 'Fire and Ice'. The pieces move as follows:
a piece may move to any square in its row or column, but when it does so it leaves an item in the square it was originally in.

For example: if Fire is in C4, and A4 is empty, it may make move C4-A4, and Fire will be in A4, whereas Ice will now be in C4.

How to program?
Sean Duggan (Dream)
Posted on Monday, January 10, 2005 - 10:54 pm:   

Adapted from the ZRF Guide (http://home.t-online.de/home/j_markmann/zrf.html for now... I've seen other versions. Well worth downloading your own copy.):

(define FireMove
(
$1
(while on-board?
(if empty?
to
(go from)
(create Ice)
(go to)
add
)
$1)
)
)

Just define FireMoves in all 4 cardinal directions. Note, this move definition is very bad on looping boards, ie boards where the edges connect.

Explanation of the code:
Move $1 once
As long as we're on the board, if the current position is empty then set this as the place where we will mark the move as ending (so we can get back easily as much as anything else), return to the original position, create an ice, go back to our to-point, then do the add. Move $1 once.

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: