| Author |
Message |
Karl Scherer (Karl)
| | Posted on Thursday, February 01, 2001 - 4:33 pm: | |
When programming Zillions games, I often would like to be able to click on the board (e.g. push a button) and then have several visible or invisible pieces (such as those stored as data) changing place or swapping position. This would greatly reduce the code in some cases. For example. in the game "CAPETOWN" (out in a few days) one single command of type (move-piece position1 position2) would replace 32 (thirtytwo !!) commands of the type (if (piece? Piecetype1 position1) (change-type Piecetype1 position2) ) (if (piece? Piecetype2 position1) (change-type Piecetype2 position2) ) (if (piece? Piecetype3 position1) (change-type Piecetype3 position2) ) ... ... (if (piece? Piecetype32 position1) (change-type Piecetype32 position2) ) Similar statements are applicable to the 'copy-piece' and 'swap-piece' command. (Note that 'cascade' does not solve this problem for various reasons.) Cheers, Karl |
|