g5l / path-finding

Robot for the shortest path of two points.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path Finding

See the robot walking

Open the index.html file in browser and check the javascript console

Problem

Given the following 2d matrix (this is a sample input, you should consider alternative inputs):

[[1,1,1,1],
[0,1,1,0],
[0,1,0,1],
[0,1,9,1],
[1,1,1,1]]

Create a virtual robot, that can walk up, right, left and bottom. The robot cannot leave the borders. Find the shortest path to 9. 1 is a walkable place. 0 is a hole, and you must avoid it. Your initial position is 0x0, the 9 position is 2x3.

Possible Solutions

About

Robot for the shortest path of two points.


Languages

Language:JavaScript 79.7%Language:HTML 20.3%