Skip to content

Commit

Permalink
update 1.1
Browse files Browse the repository at this point in the history
Greatly improved performances for canvas of big dimensions.
Improved the visuals when scrolling (the header and palette are always visible).
The h value coefficient is now customizable.
The movement's cost is now customizable.
Added italian translation to the page.
Added settings documentation.
Fixed many bugs.
  • Loading branch information
TendTo committed Aug 25, 2020
1 parent 6697862 commit 70b568d
Show file tree
Hide file tree
Showing 15 changed files with 625 additions and 121 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)<br>
[Settings documentation](doc/doc_settings.md)

## 🤝 Contributing

Expand Down
49 changes: 37 additions & 12 deletions doc/DOC.md → doc/doc_code.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 23 additions & 0 deletions doc/doc_settings.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion graphic/end.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphic/htmlValidator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions graphic/language.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion graphic/start.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 70b568d

Please sign in to comment.