You are playing a board game called Jolly Jumpers. The game begins with some number of pawns on a 4x4 board. On each turn, you must either:
- Have one pawn jump over another pawn vertically. To do this, the jumping pawn must be vertically adjacent to the pawn it is to jump, with an empty space on the far side. The jumping pawn moves to the empty space, while the jumped pawn is removed from the game. Jumping a pawn scores two points.
- Move a pawn one space horizontally. The space it moves to must be empty. Moving a pawn means you lose one point.
You start the game with a score of zero points, and the goal of the game is to score as high as possible. You may stop moving at any time, including before your first move. The layout of the board will be given to you in the String[] layout, the first element of which represents the topmost row of the board. Empty squares will be denoted with the '.' character and pawns will be denoted with '#'.
For the layout given, return the maximum score you can achieve using any number of moves. |