Your job is to write a program that finds the optimal number of moves it takes to get from the lower-left corner of a rectangle to the upper-right corner directly opposite.
Your program will accept input as an ordered pair
(width, height). These will be the dimensions of the rectangle you will work with. Your program will create an ASCII-art of the solution (use
. for empty square and
# for part of the solution,
X for starting square) and count the number of moves it takes to reach the endpoint. Diagonal moves are not allowed. If there are multiple solutions, choose one to output.
The shortest program in bytes wins.
..## ..#. .##. .#.. X#..
Move count: 7