-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nut
163 lines (106 loc) · 2.31 KB
/
main.nut
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* This is a pre-release - DO NOT FIDDLE */
/* TODO: variable maxStep */
class Dstar
{
maxsteps = null;
c1 = null;
_start_tile = null;
_goal_tile = null;
constructor(_maxsteps, _c1) {
_maxsteps = 80000;
_c1 = 1;
this._maxsteps = maxsteps;
this._c1 = c1;
}
function keyHashCode(u);
function isValid(u);
function getPath();
function occupied(u);
function init(sX, sY, gX, gY);
function makeNewCell(u);
function getG(u);
function getRHS(u);
function setG(u, g);
function setRHS(u, rhs);
function eightCondist(a, b);
function computeShortestPath();
function close(x, y);
function updateVertex(u);
function insert(u);
function remove(u);
function trueDist(a, b);
function heuristic(a, b);
function calculateKey(u);
function cost(a, b);
function updateCell(x, y, val);
function getSucc(u, state);
function getPred(u, state);
function updateStart(x, y);
function updateGoal(x, y);
function replan();
};
function Dstar::keyHashCode(u) {
}
function Dstar::isValid(u) {
}
function Dstar::FindPath() {
}
function Dstar::occupied(u) {
}
function Dstar::InitializePath(sX, sY, gX, gY) {
}
function Dstar::makeNewCell(u) {
}
function Dstar::getG(u) {
}
function Dstar::getRHS(u) {
}
function Dstar::setG(u, g) {
}
function Dstar::setRHS(u, rhs) {
}
function Dstar::eightCondist(a, b) {
}
function Dstar::computeShortestPath() {
}
function Dstar::close(x, y) {
}
function Dstar::updateVertex(u) {
}
function Dstar::insert(u) {
}
function Dstar::remove(u) {
}
function Dstar::trueDist(a, b) {
}
function Dstar::heuristic(a, b) {
}
function Dstar::calculateKey(u) {
}
function Dstar::cost(a, b) {
}
function Dstar::updateCell(x, y, val) {
}
function Dstar::getSucc(u, state) {
}
function Dstar::getPred(u, state) {
}
function Dstar::updateStart(x, y) {
}
function Dstar::updateGoal(x, y) {
}
function Dstar::replan() {
local res = computeShortestPath();
local infinity = 9999;
//Gah - unclear variable
if (res < 0) {
path = null;
return false;
}
else if (getG(s_start) == infinity) {
path = null;
return false;
}
while (cur != tile_goal) {
local n = []; getSucc(cur, n);
}