Red Knight is chasing two pawns. Which pawn will be caught, and where?
Input will be two integers:
N
vertical position of Red Knight (0
or1
).P
horizontal position of two pawns (between2
and1000000
).
Output has to be a tuple (python, haskell, Rust, prolog, C#), an array (javascript), an object (java), or a structure (C) with:
"Black"
or"White"
- which pawn was caught- Where it was caught (horizontal position)
// This class is preloaded
class PawnDistance {
private String color;
private long distance;
public PawnDistance(String s, long d) {
color = s;
distance = d;
}
}
Input = 0, 4;
Output = new PawnDistance("White", 8);
- Red Knight will always start at horizontal position
0
. - The black pawn will always be at the bottom (vertical position
1
). - The white pawn will always be at the top (vertical position
0
). - The pawns move first, and they move simultaneously.
- Red Knight moves
2
squares forward and1
up or down. - Pawns always move
1
square forward. - Both pawns will start at the same horizontal position.