A85: carry


[Prev][Next][Index][Thread]

A85: carry



>    
> Okay, it looks like this, I'm not gonna include the source cause
> it has a lot of calls and things so i would have to include
> almost the whole source.  I'm gonna get it working hten, I'm
> gonna optimize it, I might need a lot of help with that part! 
>  
> but I have my board, I'll explain with an ASCII graphics. 
>  
>    _1__2__3__4__5_ 
> 1  |  |**|P1|**|  |  P1 = Player 1's pieces 
>    |__|**|__|**|__|  P2 = Player 2's pieces 
> 2  |**|P1|**|P1|**| 
>    |**|__|**|__|**|  In this example P2 can jump P1 either to
> the left 3  |  |**|P2|**|  |  or right!  So, to jump the player,
> you move the    |__|**|__|**|__|  your player (P2) from 3,3 to
> either 2,2 or 4,2. 4  |**|  |**|  |**|  Then it checks to see if
> the place you are moving    |**|__|**|__|**|  to has someone at
> it, if it does then it searches                      one more
> space in the diagnol direction that the piece was moving!  So
> lets say we moved from 3,3 to 4,2.  The program searches and
> finds out that a piece is there, then it sees if it's it's own
> piece, since you can't hop over your own pieces!  It finds out
> that it belongs to player 1 so then it wants to search which
> diagnol 
> dierection you were going.  So it takes your alst place that it
> stored, which was 3,3 and then takes your new place 4,2.  Then
> to ifnd out which direction to go it does this but in asm form
> (Pos)-(Last Pos) and store that as A or whatever it goes into. 
> Then I use the carry flag to see if it is negative, if it's not,
> it is moving to the right since 4-3=1 it didn't need to carry,
> so then it calls the jump to the right routine. So it jumps over
> 4,2 and puts you at 5,1.  My problem is when I try to jump left,
> say instead of jumping from 3,3 to 4,2 we went left from 3,3 to
> 2,2.  This is where it messes up, I don't think I'm using the
> carry coretly cause it should go left since it is negative and
> shoudl call the left routine, but instead it calls the right
> routine and ends up at 5,1. Not 1,1 like it should!  Does anyone
> understand this, or how do I use carry, maybe I'm doing it
> wrong? 
>  
> John 
>
here's another method to do the same thing:

(?,?) = (x coordinate, y coordinate)
let's say the piece starts at (a,b) and jumps a piece at (c,d)
the place the piece lands is (2*c-a,2*d-b)
that's all you need i think...

Tomas Sirgedas



____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com