Wining condition? Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Wining condition? « Previous Next »

Author Message
Thomas Schwinghofer (Quaxi)
Posted on Wednesday, January 07, 2004 - 11:02 am:   

Hallo!


I just created a game which is similar to 8-Puzzle. But the difference is that you have to find two identical lines by sliding(n,e,s,w) the pieces. The pieces are randomly placed in the beginning. You win, when the upper and the lower line is identical(a1=a3, b1=b3, c1=c3, d1=3)

the numbers:
board 4x3
11 pieces(4red, 4yellow, 2blue and 1grey)


My problem is that i have no idea, how i should create the wining condition for this game. Any kind of helping would be very nice to me.


Bye and maybe THANKS, Quaxi


p.s.: sorry for my poor english :/
Sean Duggan (Dream)
Posted on Wednesday, January 07, 2004 - 11:26 am:   

There may be easier methods, but one way is the brute force one. Do an or of all the winning conditions. For instance: (definitely non-comprehensive of course)
(or
(and (Piece? A1 Red) (Piece? A3 Red) (Piece? B1 Red) (Piece? B3 Red) (Piece? C1 Yellow) (Piece? C3 Yellow) (Piece? D1 Yellow) (Piece? D3 Yellow))
(and (Piece? A1 Red) (Piece? A3 Red) (Piece? B1 Red) (Piece? B3 Red) (Piece? C1 Yellow) (Piece? C3 Yellow) (Piece? D1 Blue) (Piece? D3 Blue))
)

If you take this course, I would reccomend making a macro into which you could put in the color combinations. I'm not entirely sure how many combinations there'd be... 30 perhaps?
Thomas Schwinghofer (Quaxi)
Posted on Wednesday, January 07, 2004 - 6:04 pm:   

Hi!


Yes, there are exactly 30 combinations.

I just tried your method and it worked out!
Thanks for the help :)

Bye, Quaxi
mohamed el mokhtar messaoudi (Dumbguy)
Posted on Thursday, January 08, 2004 - 11:51 am:   

Hi.
I am coming to grips with my first zrf, and I'd like to know if the following could be coded (if yes, please tell me how, if not, no point in further hassle.) :
Consider a piece of type A with a line of pieces W, Y, and Z (possibly belonging to either player) of types, say, D, E, and F in front of it.
I want X to go forth, in one single move, interact with the first piece (W) in some way (eg. capture it) , change its own type from A to B (for instance) ,continue forward along the line, perform some action on Y (eg. flip it),change type again from B to C (or whatever), interact with Z in some fashion (eg. mutate it), and finally stop.
In short ,how can I get the same piece to attack, in ONE go, an arbitrarily long series of pieces (possibly from either camp), sequentially, with its (the attacker) type shifting after each step according to game's rules, until the last piece in the series is encountered ?
That was not short, sorry.
Would you know of a ZOG game using something similar? Atomic, maybe.
Thanks for any help. ZOG and piece to all.
Sean Duggan (Dream)
Posted on Thursday, January 08, 2004 - 3:44 pm:   

Well, I can't think of one that works exactly like that, but it's pretty easy to see a case where it can happen with a small change of code. Look at the Checkers jump, how it uses add-partial. You can also specify both a type of piece to add and a move-type.

I can't guarantee that this will work without testing it, but it's worth trying. Have your capturing piece turn into a series of different pieces, each of which have a move-type of, say, "continued-capture". Check for when the line ends, and force the next move to add a regular piece again. Or, if there's a defined sequence, you could probably manage it with a while-loop. I'll hash at it a bit, see what I can manage.
Basic idea, I'm thinking, is to use a while loop that does the three movements, checking for the end of the loop after each movement. Pseudo-code:
while (space in front of us is an enemy)
__move forward 1
__capture
__if (space in front of us is an enemy)
____move forward 1
____flip
____if (space in front of us is an enemy)
______move forward 1
______mutate piece
____else
______add
____end if
__else
____add
__end if
end while
add
Sean Duggan (Dream)
Posted on Thursday, January 08, 2004 - 3:56 pm:   

Ok, close but no cigar. That last add is wrong. It should end
____add
__end if
if (space in front of us is NOT an enemy)
__add
end if
end while

The following works for a chess game. Captures on the last move for now, was not sure which you wanted:

(define change-slide (
(while (enemy? $1)
$1
capture
(if (enemy? $1)
$1
flip
(if (enemy? $1)
$1
(change-type Pawn)
else
add
)
else
add
)
(if (not-enemy? $1) add)
)
)
)
mohamed el mokhtar messaoudi (Dumbguy)
Posted on Friday, January 09, 2004 - 12:46 pm:   

Thank you ,Sean.It will be a while before I digest and test your suggestions (I am a slow thinker).I will report back to you, anyway, if only to ask about subtlities of ZOG syntax (as you seem to be one of the very few willing to help newbies, lately).
Thanks again.
Piece and ZOG.
Sean Duggan (Dream)
Posted on Friday, January 09, 2004 - 4:12 pm:   

^_^ I'm just responding more quickly, I think. Benefits of having little enough of a social life to be hovering over a computer screen.
mohamed el mokhtar messaoudi (Dumbguy)
Posted on Saturday, January 10, 2004 - 12:36 pm:   

Hello there, Sean.
I've printed and read your answer to my first posting.Alas,it could not work, as you overlooked the main difficulty I had: THE ATTACKING PIECE CHANGES ITS VERY OWN TYPE AFTER EACH STEP (AND IF NEED BE THE TYPE OF THE ATTACKED ONE),ALL INSIDE THE SAME MOVE,WHICH ITSELF IS A COMPOSITE ONE.

Imagine a chess variant where an attack, once initiated must go on for as long possible.The following move could arise:

A White Rook attacks a Black Pawn.
This Pawn is changed into a White one, and left behind.
Simultaneously,the attacking Rook is turned into a White Queen,and it is this Queen that proceeds, as the move is not yet finished:
The newborn Queen charges a Black Bishop, turning it into an enemy Berolina Pawn, which is again left behind, as the Queen itself becomes a White Pawn.
This Pawn in turn goes forward, performing some action (capturing, swapping, splitting or what have you), or simply stops acccording to preestablished rules.
Well now : all the above constitutes one (long) single move; for only now can the second player (Black) take action, inflicting what similar damages he could on his opponent.

The game I am trying to design is simpler, but you get my drift: could ZOG
a)- keep track of a piece which, in the same move,
a-1)- interacts with other pieces in its course (possibly modifying their properties) and
a-2)- shifts powers after each interaction,
b)- and still recognize it as the same piece under (many) disguise(s) ?

If yes, how would one code this?
( 'while' loops are obviously needed, as would be last-from's, last-to's, lots of cascades,add-partial's, and the usual tricks to check the side that is to move. But besides, all this would be interspesed with to's, go's, back's, flags and directives to handle, and that lot usually just drives me mad : I never know for sure where a piece stands. )

Annoying. Hope you're still willing to help. If not, thanks all the same.
Regards.
Sean Duggan (Dream)
Posted on Sunday, January 11, 2004 - 8:37 pm:   

{nods} That's what I thought you meant the first time. But that was something I had little experience with, so I decided to try for the simpler interpretation. ^_^ I started answering it in my first post, referring to Checkers, and seeing how a piece can be turned into a king by changing checker-jump-add to:
(define checker-jump-add
(if (not-in-zone? promotion-zone)
(add-partial jumptype)
else
(add-partial King jumptype)
)
)

If you try this, you can see that it is possible to change piece types and continue to use their move-definitions, all while using the same piece. The next problem would be convincing the pice to simply change things rather than capture them... I'll do some messing around to see if I can find an answer to your problem. Or you may get an answer from one of the other fine people here who've held back, thinking I already gave an answer with my quick slipshod response. ^_^
mohamed el mokhtar messaoudi (Dumbguy)
Posted on Monday, January 12, 2004 - 12:09 pm:   

Thanks, Sean. My game is indeed related to Checkers ( in fact, it's Just Another Combination Of Draughts And Reversi, hence the name I am calling it: Jacodar. Graphics ready long since, code a pain in the neck #->( )
It's the 'piece' bit that escaped me in (add-partial piece jumptype).I'll be off to try it, and let you know if it improves things to any extent, one of these days.
Piece and ZOG. (Yeah, it's a bad pun, and wearing rather thin by now. Won't use it anymore, I promise ^_^)

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: