#### SlashDK

##### MV VIP to the MAX

Twin robots

You have a board divided into N×N squares and two robots, R2D2 and C3PO. Eachsquare on the board has a number written on it.

R2D2 starts at the top left corner square of the board and C3PO starts at the top right corner square of the board. Your aim is to move the robots so that R2D2 reaches the bottom right corner square and C3PO reaches the bottom left corner square. You have a remote control with two buttons, blue and yellow, that control the robots as follows.

• Whenever you press the blue button, R2D2 moves one square to the right and C3PO moves one square down.

• Whenever you press the yellow button, R2D2 moves one square down and C3PO moves one square left.

The robots are not allowed to move off the board—if pushing a button would force either one of the robots to move off the board, the button push has no effect and both robots stay where they are.

For each robot, you compute a score which is the sum of the numbers on the squares that it visits along the path that it follows from its starting position to its final position. The combined score of the two robots is the sum of their individual scores. Your aim is to compute the maximum combined score that the two robots can achieve.

For example, suppose you have a 4 × 4 board as follows.

6 0 3 −1

7 4 2 4

−3 3 −2 8

13 10 −1 −4

In this example, if R2D2 follows the path marked by ∗ and C3PO follows the path marked by †, as shown below, their combined score is 56.

6∗ 0 3† −1†

7∗ 4∗† 2† 4

−3 3∗† −2∗ 8∗

13† 10† −1 −4∗

It can be verified that this is the best combined score that can be achieved for this board.

I've managed to make functions for the movements and adding the achieved values, but I am not able to think of a logic that would go through all possible paths through the array.