There are two inputs, the first input is a map in 2D array, where 2 represents an obstacle and 0 represents a regular ground, and 1 represents the player's location (implies that the player is standing on ground), the second input is the player's movement range.
A player can move on the map (horizontally, vertically, but not diagonally) within the movement range (0 to movement range inclusive), and the player can travel through an obstacle, but only one at a time. At last, a player cannot stand on an obstacle.
The program outputs an 2D array of booleans, showing all possible squares the player can move to.
Here are some examples:
Input
________
_____#__
___+__#_
#__#____
________, range=2
(_ = 0, + = 1, # = 2)
Output
___+____
__+++___
_+++++__
__+_+___
___+____ (+ = true, _ = false)
Input
__________
__________
______#___
__#_+##___
__________
____#_____
__________, range=4
Output
___+++____
__+++++___
_+++++_+__
++_++_____
_+++++++__
__++_++___
___+++____
There will be two winners: shortest brute-force and shortest efficient algorithm (the map and the movement range can get arbitrarily large)