haha

jdfkgjkf
There are black rooks and white rooks randomly in the 100 by 100 arena. The rook can move on both horizontal and vertical without being blocked by the same color one. The rooks have a higher priority from left to right and from top to bottom. The Rocks with greater priority move firstly. Firstly, the rook find competitor in the row, then in the column. If the rook found the competitor, it would move to attack the competitor.
Collision of a black rook and white rook causes the destruction of both rooks without any trace, damage to other rooks.
The rooks will stop when no competitor within the area that they can move.
If any rook meet a rock, they can’t continue moving.
If all rooks are destroyed or stopped, the game is over. Please, write a function which returns the number of remaining rooks in the area after the match.

[Example]
If you look down the arena in the sky, you can see the picture below:
Rock is shown as red cell.
As a result, the return number should be 6 because there are 3 while rooks and 3 black rooks left.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.