-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lookups.js
59 lines (49 loc) · 1.06 KB
/
Lookups.js
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
var neighborList = [
// DIAGONALS
{ x: 1, y: 1 },
{ x: 1, y: -1 },
{ x: -1, y: -1 },
{ x: -1, y: 1 },
];
if (allowOrto) {
neighborList = neighborList.concat(
// HORIZANTALS & VERTICALS
{ x: 0, y: 2 },
{ x: 2, y: 0 },
{ x: 0, y: -2 },
{ x: -2, y: 0 }
)
}
// Symbols
/**
* @param allSymbols is a array that stores the symbols,
* which are a array of objects representing the spots
* with a draw function with coordinates and size as inputs
* Fell free to suggest new symbols
*/
var allSymbols = [];
var blank = [];
blank.draw = function () { }
allSymbols.push(blank);
var invSlash = [
{ x: 0, y: 0 },
{ x: 1, y: 1 },
{ x: 2, y: 2 },
{ x: 3, y: 3 },
{ x: 4, y: 4 }
];
invSlash.draw = function (x, y, size) {
line(x, y, x + size, y + size);
}
allSymbols.push(invSlash);
var slash = [
{ x: 0, y: 4 },
{ x: 1, y: 3 },
{ x: 2, y: 2 },
{ x: 3, y: 1 },
{ x: 4, y: 0 },
];
slash.draw = function (x, y, size) {
line(x, y + size, x + size, y);
}
allSymbols.push(slash);