5 deleted 46 characters in body
source | link

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

if adjacent tile is not occupied:
     move current piece to adjacent tile

else:
do:
  if current adjacent tile is occupied by the enemy: AND
     check if  a tile is free in the same direction // this is where our current piece will end
     if so:
       mark enemy piece for removal // queue it up to process after 
       additional logic goes here, like keeping track of where the piece moves to
       valid move has been found
     if not:
       move is invalid

while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

if adjacent tile is not occupied:
     move current piece to adjacent tile

else:
do:
  if current adjacent tile is occupied by the enemy:
     check if  a tile is free in the same direction // this is where our current piece will end
     if so:
       mark enemy piece for removal // queue it up to process after 
       additional logic goes here, like keeping track of where the piece moves to
       valid move has been found
     if not:
       move is invalid

while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

if adjacent tile is not occupied:
     move current piece to adjacent tile

else:
do:
  if current adjacent tile is occupied by the enemy AND
     check if a tile is free in the same direction:
       mark enemy piece for removal // queue it up to process after 
       additional logic goes here, like keeping track of where the piece moves to
       valid move has been found
  if not:
     move is invalid

while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

4 added 78 characters in body
source | link

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

doif adjacent tile is not occupied:
if     move current piece to adjacent tile

else:
do:
 is occupiedif andcurrent adjacent tile is occupied by the enemy:
     check if  a tile is free in the same direction // this is where our current piece will end
     if so:
       mark enemy piece for removal // queue it up to process after 
       additional logic goes here, like keeping track of where the piece moves to
       valid move has been found
     if not:
     move current piece tomove adjacentis tileinvalid
     break
while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

do:
if current adjacent tile is occupied and is occupied by the enemy:
   check if  a tile is free in the same direction // this is where our current piece will end
   if so:
     mark enemy piece for removal // queue it up to process after 
     additional logic goes here, like keeping track of where the piece moves to
     valid move has been found
   if not:
     move current piece to adjacent tile
     break
while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

if adjacent tile is not occupied:
     move current piece to adjacent tile

else:
do:
  if current adjacent tile is occupied by the enemy:
     check if  a tile is free in the same direction // this is where our current piece will end
     if so:
       mark enemy piece for removal // queue it up to process after 
       additional logic goes here, like keeping track of where the piece moves to
       valid move has been found
     if not:
       move is invalid

while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

3 edited body
source | link

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1, currentX1][currentX-1] // top left
 boardgrid[currentY-1, currentX+1]1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

do:
if current adjacent tile is occupied and is occupied by the enemy:
   check if  a tile is free in the same direction // this is where our current piece will end
   if so:
     mark enemy piece for removal // queue it up to process after 
     additional logic goes here, like keeping track of where the piece moves to
     valid move has been found
   if not:
     move current piece to adjacent tile
     break
while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1, currentX-1] // top left
 boardgrid[currentY-1, currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

do:
if current adjacent tile is occupied and is occupied by the enemy:
   check if  a tile is free in the same direction // this is where our current piece will end
   if so:
     mark enemy piece for removal // queue it up to process after 
     additional logic goes here, like keeping track of where the piece moves to
     valid move has been found
   if not:
     move current piece to adjacent tile
     break
while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

Going by this.

Working with a grid is fairly easy because you can directly check adjacent tiles.

You can check for valid moves during the attempt to move a piece or pre-check when you select a piece. So let's get one thing out of the way:

You can not move head on, you're only interested in tiles that are diagonal to the current tile. Checking adjacent tiles is as simple as

 boardgrid[currentY-1][currentX-1] // top left
 boardgrid[currentY-1][currentX+1] // top Right
 etc

Your tiles probably have some sort of state. Whether it's occupied and by whom. Based on this information it's really easy to check for validity.

pseudo code:

do:
if current adjacent tile is occupied and is occupied by the enemy:
   check if  a tile is free in the same direction // this is where our current piece will end
   if so:
     mark enemy piece for removal // queue it up to process after 
     additional logic goes here, like keeping track of where the piece moves to
     valid move has been found
   if not:
     move current piece to adjacent tile
     break
while( valid move has been found )

Once your piece jumps, the rules state that you must continue jumping if any adjacent tile is occupied by the enemy. So when you jump, at the new position you check the diagonal tiles again and repeat the process.

If you want to animate your pieces you can queue up the valid moves and perform them in a sequence. Hope this helps.

2 added 46 characters in body
source | link
1
source | link