Simulates drone delivery across a user-defined grid, modeling navigation and drop-off logic. Utilizes a customized Dijkstra's algorithm to find the optimal path to and from the delivery destination while avoiding collisions with obstacles. Try it here
- Navigate to root directory of the project
- Type
npm i - Type
npm start
Manual: Moves the drone from its starting position to the location specified by a string of control codes (as specified in the Control Codes section).There is an option to enable wind (more details in the Wind section).Delivery: Generates random delivery destination, executes delivery there and back. Wind is not available in this mode.
- To change the direction the drone is currently facing, use any of the. Changing the direction does not move the drone,
w- Weste- Eastn- Norths- South
- To move the drone forward 1 unit in the direction it is currently facing, add
fto the string. To move the drone more than 1 unit, add morefs to the string. For instance,ffffwill move the drone forward 4 units. - Ex:
wffnf- turns the drone to the west, moves 2 units west, turns the drone to the north, moves 1 unit north
If wind is enabled, the drone will continually move 1 unit in a random direction every few seconds until delivery is complete. Disable wind to ensure that the drone only visits the specified.
Trees are obstacles that the drone is unable to fly through, which means it will have to find a path around any trees in order to complete its delivery. They are randomly generated, and the amount of trees on the grid can be controlled with the Tree Probability option in the Dimensions settings.
Rows: Number of rows in the grid.Cols: Number of cols in the grid.Tree Probability: Number between 0 and 1 representing the probability of each square being a tree. Ex: a probability of 0.2 means that the grid will consist of approximately 20% trees.
Row: Starting row of drone.Cols: Starting col of drone.Direction: Starting direction of drone.
[w, s, e, n]: Direction of drone at current positiond: Delivery destinationo: Original drone positiont: Treex: Empty space
Remaining battery percentage in upper right hand corner (each turn costs 0.5 battery units, each forward movement 1 unit). The drone cannot complete its delivery if its battery level reaches .