Async Programming Fun

You should implement your program using promises.  We will randomly select inspect programs to ensure that you used the promise syntax. 

Use the isomorphic fetch library. Remember to do a npm install. const fetch = require("isomorphic-fetch")

 

Promise Syntax 

Find the shortest path to an exit by navigating the JSON maze. Below is an example of each entry in the JSON mase. Read the JSON Object from this following endpoint https://www.cs.virginia.edu/~dgg6b/jsonMaze/enter.json

 The navigate through the maze until you find an exit. (An exit is a JSON object where the “exit” property is set to true). Return the list of path ids that correspond to the shortest path through the maze.  This maze is special it does not have any loops.


{"id":"4b03d81e-dc86-40c2-b9c4-d8d37a89ae17",
"left":"8a748d94-03d6-41e9-818c-0744605549d2",
"right":"55d86280-cdce-4910-9450-b36d5385821b",
"exit":false,
"urlLeft":"",
"urlRight":""}

The left URL can be constructed by doing  https://www.cs.virginia.edu/~dgg6b/jsonMaze/8a748d94-03d6-41e9-818c-0744605549d2.jsonThe Right URL can be constructed by doing https://www.cs.virginia.edu/~dgg6b/jsonMaze/55d86280-cdce-4910-9450-b36d5385821b.jsonYour program should only use the promise syntax.  Answer the collab quiz it will ask you to enter the path ids in order of the entrance to the exit.

%d bloggers like this: