Stratego/src/game/Engine.java
public static boolean battle(Piece ally, Piece enemy)
	{
		if (ally.getOwner() == enemy.getOwner())
			return false;
		
		Board board = Board.getBoard();
		boolean result;
		
		result = (ally.getLevel() <= enemy.getLevel());
		
		if (enemy instanceof Bomb)
		{
			if (ally instanceof Miner)
				result = true;
			else
				result = false;
		}
		
		if (ally instanceof Spy)
		{
			if (enemy instanceof Marshal)
				result = true;
			else
				result = false;
		}
		
		if (enemy instanceof Flag) // Game ends
		{
			result = true;
			endGame();
		}
		
		if (result)
			board.removePiece(enemy);
		else
			board.removePiece(ally);
		
		return result;
	}
/**
	 * Simulates a battle between ally piece an enemy piece
	 * When flag is captured the game ends
	 * 
	 * @param ally
	 * @param enemy
	 * @return true if ally wins
	 *         <p>
	 *         false if ally loses
	 */
Simulates a battle between ally piece an enemy piece
When flag is captured the game ends

@param ally
@param enemy
@return true if ally wins

false if ally loses
Simulates a battle between ally piece an enemy piece When flag is captured the game ends @param ally @param enemy @return true if ally wins false if ally loses
public static boolean battle(Piece ally, Piece enemy)
	{
		if (ally.getOwner() == enemy.getOwner())
			return false;
		Board board = Board.getBoard();
		boolean result;
		result = (ally.getLevel() <= enemy.getLevel());
		if (enemy instanceof Bomb)
		{
			if (ally instanceof Miner)
				result = true;
			else
				result = false;
		}
		if (ally instanceof Spy)
		{
			if (enemy instanceof Marshal)
				result = true;
			else
				result = false;
		}
		if (enemy instanceof Flag) 
		{
			result = true;
			endGame();
		}
		if (result)
			board.removePiece(enemy);
		else
			board.removePiece(ally);
		return result;
	}
public static boolean battle ( Piece ally , Piece enemy ) { if ( ally . getOwner ( ) == enemy . getOwner ( ) ) return false ; Board board = Board . getBoard ( ) ; boolean result ; result = ( ally . getLevel ( ) <= enemy . getLevel ( ) ) ; if ( enemy instanceof Bomb ) { if ( ally instanceof Miner ) result = true ; else result = false ; } if ( ally instanceof Spy ) { if ( enemy instanceof Marshal ) result = true ; else result = false ; } if ( enemy instanceof Flag ) { result = true ; endGame ( ) ; } if ( result ) board . removePiece ( enemy ) ; else board . removePiece ( ally ) ; return result ; }
Simulates a battle between ally piece an enemy piece
 When flag is captured the game ends
Simulates a battle between ally piece an enemy piece When flag is captured the game ends
// Game ends