8
Objective
The black pawn wants revenge. Plot out its last attack.
Rules
The black pawn (L
) starts at the top row and moves downwards to the bottom row. Maximise points taken, indicating the path with X
. Pawns (P
) are 1, bishops (B
) and knights (N
) 3, rooks (R
) 5, and queens (Q
) 9. There won't be any kings in the input.
If there is more than one path that has the maximum amount of points, output any of those paths. There will not be any situations where the pawn cannot reach the bottom row.
Examples
Input:
----L---
-----P--
------P-
--R--P-Q
----P-P-
---P-P-P
--P-N---
-P------
Output:
----L---
-----X--
------X-
--R--P-X
----P-X-
---P-X-P
--P-X---
-P--X---
Input:
--L-----
-P------
P-------
-P------
P--Q----
-P------
P-------
-P------
Output:
--L-----
-PX-----
P-X-----
-PX-----
P--X----
-P-X----
P--X----
-P-X----
What should happen if the pawn can't reach the bottom row? – Reto Koradi – 2015-10-17T00:17:20.787
Actually, the text never says that it has to reach the bottom row. Is that the intention? Say, in the second example, would it be valid for the path to stop in the 5th row, after the pawn captured the queen? – Reto Koradi – 2015-10-17T03:36:21.697
@RetoKoradi Huh. I haven't actually thought of that. Yeah, the pawn should reach the bottom row. You can assume that any cases where the pawn can't reach the bottom row won't occur in the input. – absinthe – 2015-10-17T04:50:40.683
1And when it reaches the bottow row, it is promoted as a queen and kill everyone elese ... – coredump – 2015-10-17T09:16:57.777
What about El Passant? – None – 2016-07-29T08:59:26.950