File tree 7 files changed +62
-55
lines changed
7 files changed +62
-55
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -118,4 +118,17 @@ const runAstar = (props: Props) => {
118
118
} , 100 / currentSpeed ) ;
119
119
} ;
120
120
121
- export default runAstar ;
121
+ const aStarDesc =
122
+ " ### A* Info\
123
+ \nA* pronounced A-Star was originally created in an attempt to create a general purpose robot as part of the Shakey\
124
+ project in the 1960’s and 70’s. A* is a best-first search algorithm.\
125
+ \n### Runtime: \
126
+ \nThe time complexity is polynomial when the search space is a tree, there is a single goal state,\
127
+ and the heuristic function h meets the following condition:\
128
+ \n| h ( x ) − h ∗ ( x ) | = O ( log h ∗ ( x ) ) \
129
+ \nwhere h* is the optimal heuristic, the exact cost to get from x to the goal.\
130
+ \n### Helpful links:\
131
+ \n[The Coding Train (video part1)] (https://www.youtube.com/watch?v=aKYlikFAV4k&t=968s) \
132
+ \n[Computerphile (video)] (https://www.youtube.com/watch?v=ySN5Wnu88nE )" ;
133
+
134
+ export { runAstar , aStarDesc } ;
Original file line number Diff line number Diff line change @@ -70,4 +70,14 @@ const runBFS = (props: Props) => {
70
70
return ;
71
71
} ;
72
72
73
- export default runBFS ;
73
+ const bfsDesc =
74
+ "### BFS Info\
75
+ \nBreadth-First Search is a graph or tree traversing algorithm that looks at all nodes at the current level \
76
+ before moving onto the next deepest set of nodes. It was created by Konrad Zuse in 1945 and later reinvented by Edward F. Moore in 1959. \
77
+ \n### Runtime:\
78
+ \nO( | V | + | E |) where V is the number of nodes and E the number of edges.\
79
+ \n### Helpful links: \
80
+ \n[TheHippieCat (video)] (https://www.youtube.com/watch?v=WvR9voi0y2I)\
81
+ \n[Nesbox (README)] (https://github.com/nesbox/TIC-80/wiki/Pathfinding%EA%9E%89-BFS-Algorithm)" ;
82
+
83
+ export { runBFS , bfsDesc } ;
Original file line number Diff line number Diff line change @@ -67,4 +67,14 @@ const runDFS = (props: Props) => {
67
67
} , 100 / currentSpeed ) ;
68
68
} ;
69
69
70
- export default runDFS ;
70
+ const dfsDesc =
71
+ "### DFS Info\
72
+ \nDepth-first search is a pathfinding or tree spanning algorithm that follows one branch to its deepest point before backtracking. \
73
+ It was created in the 19th century by French mathematician Charles Pierre Trémaux. \
74
+ \n### Runtime:\
75
+ \nO( | V | + | E |) where V is the number of nodes and E the number of edges.\
76
+ \n### Helpful links:\
77
+ \n[Brilliant (articel)] (https://brilliant.org/wiki/depth-first-search-dfs)\
78
+ \n[Go GATE IIT (video)](https://www.youtube.com/watch?v=iaBEKo5sM7w)" ;
79
+
80
+ export { runDFS , dfsDesc } ;
Original file line number Diff line number Diff line change @@ -96,4 +96,15 @@ const runDjikstras = (props: Props) => {
96
96
} , 100 / currentSpeed ) ;
97
97
} ;
98
98
99
- export default runDjikstras ;
99
+ const djikstrasDesc =
100
+ "### Djikstra's Algorithm Info\
101
+ \nDjikstra's shortest path first Algorithm is a pathfinding algorithm created by Edsger W. Djikstra in 1956. \
102
+ It uses a min-priority queue to find the shortest path of a weighted graph. \
103
+ \n### Runtime: \
104
+ \n(Min-priority queue) O(| V | +| E |log| V |) (where | V | s the number of nodes and | E | is the number of edges)\
105
+ \n(Array) O(V^2)\
106
+ \n### Helpful links:\
107
+ \n[Computerphile (video)](https://www.youtube.com/watch?v=GazC3A4OQTE)\
108
+ \n[Clément Mihailescu (video)] (https://www.youtube.com/watch?v=msttfIHHkak&t=2826s)" ;
109
+
110
+ export { runDjikstras , djikstrasDesc } ;
Original file line number Diff line number Diff line change 1
1
import _ from "lodash" ;
2
- import runBFS from "./BFS" ;
3
- import runDFS from "./DFS" ;
4
- import runAstar from "./A*" ;
5
- import runDjikstras from "./Djikstras" ;
2
+ import { runBFS , bfsDesc } from "./BFS" ;
3
+ import { runDFS , dfsDesc } from "./DFS" ;
4
+ import { runAstar , aStarDesc } from "./A*" ;
5
+ import { runDjikstras , djikstrasDesc } from "./Djikstras" ;
6
6
import { Coord , MazeInfo } from "../../../models/maze" ;
7
7
import { SpaceTypes } from "../../Space/types" ;
8
8
import { getMazeSize } from "../Maze" ;
@@ -159,4 +159,8 @@ export {
159
159
getLowestFScore ,
160
160
getValidNeighbors ,
161
161
removeFromArr ,
162
+ aStarDesc ,
163
+ bfsDesc ,
164
+ dfsDesc ,
165
+ djikstrasDesc ,
162
166
} ;
Original file line number Diff line number Diff line change @@ -23,8 +23,9 @@ import * as yup from "yup";
23
23
import { Maze } from "../../models/maze" ;
24
24
import { SpaceTypes } from "../Space/types" ;
25
25
import { Algorithms } from "../Maze/algorithms/types" ;
26
- import algos from "../../algos" ;
27
26
import { getMazeSize } from "../Maze/Maze" ;
27
+ // Algorithm information
28
+ import { aStarDesc , bfsDesc , dfsDesc , djikstrasDesc } from "../Maze/algorithms" ;
28
29
29
30
import "./Menu.scss" ;
30
31
@@ -228,13 +229,13 @@ class MenuBar extends React.Component<MenuProps, _MenuState> {
228
229
if ( al === null ) {
229
230
al = "Select an algorithm" ;
230
231
} else if ( al === Algorithms . astar ) {
231
- al = algos . a ;
232
+ al = aStarDesc ;
232
233
} else if ( al === Algorithms . bfs ) {
233
- al = algos . BFS ;
234
+ al = bfsDesc ;
234
235
} else if ( al === Algorithms . dfs ) {
235
- al = algos . DFS ;
236
+ al = dfsDesc ;
236
237
} else if ( al === Algorithms . djikstras ) {
237
- al = algos . Djikstras ;
238
+ al = djikstrasDesc ;
238
239
}
239
240
return al as string ;
240
241
} ;
You can’t perform that action at this time.
0 commit comments