| Author |
Message |
Jean Pierre Bergeron (Strikerone)
| | Posted on Monday, August 16, 2004 - 3:00 am: | |
I just cant figure out how to tell a piece to move n squares; n being the number of pieces present in its own row, column or diagonal. The piece will then capture the oponents piece on the next square (checkers) Thanks a lot for the help. Please send the answer by email also. ivolokhov@sympatico.ca |
Sean Duggan (Dream)
| | Posted on Monday, August 16, 2004 - 8:57 am: | |
Both counting the number of pieces in a row or telling a piece to move N spaces is possible, but is probably more trouble than it's worth. Both things would require counting, which is not supported natively. If you look through prior topics, you'll see some discussion on how to use flags for binary counts. If you specify exactly how the piece moves, though, it could be someone here can provide a clever hack to make it work. |
Karl Scherer (Karl)
| | Posted on Monday, August 16, 2004 - 12:23 pm: | |
Here is the code for it: ;First define 1 more dummy positions than there are positions in a row: ;here I take the chess board with 8 cols and row. ;also define directions for each length of jump ; e.g. ss3 for jumping 3 to the south: (board (directions (ee1 1 0)(ee2 2 0)(ee3 3 0).... (ww1 1 0)(ww2 2 0)(ww3 3 0).... (nn1 1 0)(nn2 2 0)(nn3 3 0).... (ss1 1 0)(ss2 2 0)(ss3 3 0).... ) ... (dummy z1 z2 z3 z4 z5 z6 z7 z8 z9) ... ) ;link all z-positions (or define them as a grid) (links x (z1 z2)....(z8 z9) ) ;now define the piece with all possible moves: (piece Jumper (moves (Move ss 1)(Move ee 1)(Move ww 1)(Move nn 1) (Move ss 2)... ... (Move ss 8)... ) ; now code the moves: (define Move ( from $1$2 to (Check-row $2) add )) ;the macro Check-row counts the pieces in the row: (define Check-row (go from) (while (on-board? w) w) ;goto start of row ;now count each piece in the row (if not-empty? (Count)) (while (on-board? s) s (Count) ) ;now we check whether the number found is what we want: z$2 (verify (position-flag? count?)) ;find counting marker (set-position-flag count? false) ;clear for next counting ) ;finally, we program the counter macro: (define Count z1 ;goto counting area (while (and (on-board? x)(not-position-flag? count?)) x) ;find marker (if (not-position-flag? count?) ;nothing counted yet - z1 (set-position-flag count? true) ; - then set marker to first place else ;counting marker found (set-position-flag count? false) ;delete old counter flag x ;goto next z-position (set-position-flag count? true) ;set new counter flag ) ) |
Ken Franklin (Kenz)
| | Posted on Monday, August 16, 2004 - 5:37 pm: | |
See also Sabotage. I had a second one-line grid below the main gird's board visible image showing numbered pieces. It may be visible by maximizing the Zillions window. On each move, I verify the corresponding linked starting position (same column) from the 2nd grid then whether so many mainboard squares (any direction) ahead are all empty. Therefore, I used a series of defined moves according to Number moved along with a series of directions: mov5 (moves 5 spaces) eone etwo ethree ... (east directions) An adjustment to the starting column's 2nd gird NUM piece and an ending adjustment to the finishing column's NUM piece complete each move block. |
Jean Pierre Bergeron (Strikerone)
| | Posted on Tuesday, August 17, 2004 - 1:04 am: | |
I just cant figure out how to tell a piece to move n squares; n being the number of pieces present in its own row, column or diagonal. The piece will then capture the oponents piece on the next square (checkers) Thanks a lot for the help. Please send the answer by email also. ivolokhov@sympatico.ca |
Jean Pierre Bergeron (Strikerone)
| | Posted on Tuesday, August 17, 2004 - 1:08 am: | |
I am so thankfull to you guys. All answers where strongly apreciated. Of course I'll upload the finished result. again, thanks. |