diff --git a/README.md b/README.md index d02fb48..78c16c1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ A live version is available [here](https://tendto.github.io/AstarPathfindingAlgo ![](graphic/demo.gif) ## :books: Documentation -[Documentation](doc/DOC.md) +[Code documentation](doc/doc_code.md)
+[Settings documentation](doc/doc_settings.md) ## 🤝 Contributing diff --git a/doc/DOC.md b/doc/doc_code.md similarity index 83% rename from doc/DOC.md rename to doc/doc_code.md index e1c626d..75179e6 100644 --- a/doc/DOC.md +++ b/doc/doc_code.md @@ -1,15 +1,40 @@ -## Documentation - -### Constants -Vertical and Horizontal cost: 10 -Diagonal cost: 14 - -### Heuristics - To find the h value, there are 4 possible heuristics contemplated: -- **Manhattan distance:** estimate the distance considering only horizontal-vertical movements. Ignores obstacles -- **Diagonal distance:** estimate the distance considering all the 8 possible directions. Ignores obstacles -- **Euclid distance:** estimate the distance as the crow flies. Ignores obstacles -- **Dijkstra (h = 0):** always set h = 0. It behaves exactly like Dijkstra's algorithm +## Code documentation + +### index.html +```javascript +/** + * Used to enable the tooltips + */ +$(function()) + +/** + * Prevents the use of unwanted characters + * @param {any} ob - html input field + */ +function checkInput(ob) + +/** + * Checks that the value is between the constrains + * @param {any} ob - html input field + * @param {number} min - minimum value allowed + * @param {number} max - maximum value allowed + */ +function validateInput(ob, min, max) + +/** + * Change the status value and shows the modal + */ +function callSettings() + +/** + * Show the results of the algorithm + * @param {number} distance - distance result from the start point to hte end point + * @param {number} stepCounter - times of calls to the function 'stepSolution' + * @param {number} fcounter - times an fvalue got evalueted + * @param {number} time - time enlapsed + */ +function setResults(distance, stepCounter, fcounter, time) +``` ### main.js ```javascript diff --git a/doc/doc_settings.md b/doc/doc_settings.md new file mode 100644 index 0000000..5d53da3 --- /dev/null +++ b/doc/doc_settings.md @@ -0,0 +1,23 @@ +## Settings documentation + +### Settings explaination ++ Rows: number of rows of the canvas. Min 1 - Max 99 ++ Columns: number of columns of the canvas. Min 1 - Max 99 ++ Cell size: size of the cells of the canvas. Min 6 - Max 99 ++ Framerate: framerate of the animation. An higher value will make the animation faster. Min 0.1 - Max 60 ++ **+** direction cost: cost of moving vertically or horizontally. It will influence both h and g values. Min 0 - Max 50 ++ **x** direction cost: cost of moving diagonally. It will influence both h and g values. Min 0 - Max 50 ++ H coefficient: coefficient applied to the h value. A lower coeffient will make so the algorithm will seek the shortest path, but will be less efficient. An higher value will make so the algorithm will finish earlier, but the path may not be the shortest. Min 0 - Max 99 ++ Special ground: traversing the special ground will cost the specified value times more than traversing the normal ground. It will only influence the g value ++ Heuristics: heustic used to calculate the h value. See below for more information on each one ++ Can move diagonally: whether or not diagonal movement is allowed + ++ Cancel: revert the settings ++ Apply: apply the settings + +#### Heuristics +There are 4 possible heuristics contemplated: +- **Manhattan distance:** estimate the distance considering only horizontal-vertical movements. Ignores obstacles +- **Diagonal distance:** estimate the distance considering all the 8 possible directions. Ignores obstacles +- **Euclid distance:** estimate the distance as the crow flies. Ignores obstacles +- **Dijkstra (h = 0):** always set h = 0. It behaves exactly like Dijkstra's algorithm \ No newline at end of file diff --git a/graphic/end.svg b/graphic/end.svg index 9c42724..43dd46c 100644 --- a/graphic/end.svg +++ b/graphic/end.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/graphic/htmlValidator.png b/graphic/htmlValidator.png new file mode 100644 index 0000000..dd20e49 Binary files /dev/null and b/graphic/htmlValidator.png differ diff --git a/graphic/language.svg b/graphic/language.svg new file mode 100644 index 0000000..da9f844 --- /dev/null +++ b/graphic/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphic/start.svg b/graphic/start.svg index b8ea7af..4c1c058 100644 --- a/graphic/start.svg +++ b/graphic/start.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/index.html b/index.html index 2fe8105..d32ea06 100644 --- a/index.html +++ b/index.html @@ -14,17 +14,16 @@ - - + + A* pathfinding -
-