A SIMPLE LAST PIECE PROMOTION THINGY.... Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » A SIMPLE LAST PIECE PROMOTION THINGY.... « Previous Next »

Author Message
Kevin M. Crocker (Zeta1ret)
Posted on Saturday, July 05, 2003 - 4:24 am:   

HIYA GUYS...DONT YOU JUST LOVE DA 'Z'...ALL GEEKS HAIL THEE O 'Z'...
okay...nuff of that...

i am programing a variant that basically auto-promotes a pawn to a queen if it is the last pawn on the board for that color...

said another "more-english" way...

i want some Z-code that when, say, black is down to one pawn, that one pawn auto promotes to queen regardless of what square it is on...
It would be easy if i could use the PIECES-REMAINING function...but as i understand it, that is a [goal] ending...

is there any easy simple dont-wanna-think-to-hard way?
eagerly waiting for a lil'help...
over and out!
Fergus Duniho (Fduniho)
Posted on Thursday, July 10, 2003 - 9:32 pm:   

I don't think there is any easy simple dont-wanna-think-too-hard way to do what you want. First, Zillions has no easy way of checking whether you're down to one Pawn except for checking whether it should end the game. This, of course, is not what you want. Second, you want something to happen to a certain piece, wherever it is, even when it isn't the last or next piece to move. Zillions has no easy way of doing this.

But there are more complicated ways to do what you want. One way is to have a dummy player operate between each move to check whether a lone Pawn remains and to promote it when one does. But this might severely hurt how well Zillions plays your game.

Another option would be to have each Pawn check for the presence of other friendly Pawns and promote to a Queen if there are no others. Give it a different move-type with a higher priority. Here is what it might look like if you first link all the spaces on the board in an endless loop with the next direction.

(mark next (while (and (not-piece? Pawn) not-friendly?) next) (if marked? (add-partial Queen)))

I have not tested whether this will work, but it might. If it does work, it will not promote the Pawn immediately, but the next time you move the Pawn, you will be able to immediately promote it to a Queen and then move it as one.
Kevin M. Crocker (Zeta1ret)
Posted on Friday, July 11, 2003 - 2:42 am:   

Thanks buddy...will try it out...
Kevin M. Crocker (Zeta1ret)
Posted on Saturday, July 12, 2003 - 5:44 am:   

...okay, so i tried the above code (thanks alot to!) even tweaked it a bit...but it doesnt seem to do anything...
i have the sqares linked in a direction called pawnpromot...
and a move that that is defined by the above code...but the computer player, nor i, seem to auto promote...
...im not receiving errors or anthing...Z just seems to go...

"ya want me to mark all the pieces that are not pawns, sure...now make a normal move!, HELL NO YOUR NOT GETTING A QUEEN...and don't ask me again...no!"

am i missin' something here?

thats a big 10-4 ol buddy,
over and out...
kmc
Kevin M. Crocker (Zeta1ret)
Posted on Tuesday, July 15, 2003 - 2:23 am:   

YIPPIE...
GOT IT TO WORK...WELL, ALMOST...

first of all, anyone who might be curious (but as adept at programming some of us...) would like to see the macro for auto promotion, here it is....

(DEFINE PAWNPRO
(MARK PAWNSCAN* (WHILE (OR (NOT-PIECE? PAWN) NOT-FRIEND?) PAWNSCAN*) (IF MARKED? BACK (ADD-PARTIAL QUEEN))))

*PAWNSCAN IS A DIRECTION, LINKING ALL THE SQUARES IN THE CHESS BOARD IN ONE CONTINOUS LOOP....THANKS FERGY!

however, with this...it promotes no prob...
but takes a whole turn to do this...
i want to then be able to make one legal move (either with the new queen, or ANY other piece)...

how do?

any help?

thanks....
-k
Fergus Duniho (Fduniho)
Posted on Sunday, July 20, 2003 - 9:12 pm:   

You were right to replace the 'and' with an 'or'. I did it in my head without thinking through DeMorgan's theorem properly. If it is still not fully working, I suppose that Zillions requires a piece to remain the same type for add-partial to work. If that's the case, I recommend doing the same as above, except that you set an attribute instead of changing to a Queen right away. Then, when the attribute is set, let the Pawn move as a Queen and also change into one when it finishes its move.
Kevin M. Crocker (Zeta1ret)
Posted on Monday, July 21, 2003 - 4:48 am:   

hey...was quickly discovering that this was probably the case...
Thanks alot for the help pal, really!

will get right to it!

over and out
-k

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: