-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
72 lines (59 loc) · 1.34 KB
/
test.js
File metadata and controls
72 lines (59 loc) · 1.34 KB
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
/**
* Created by claudio on 27/11/16.
*/
var lib = require('./index.js');
var baseMatrix = [
[-1,-1,0,-1],
[-1,-1,0,-1],
[0,0,0,0],
[0,0,0,0],
];
var lines = [
[[0,2],[2,0]],
[[2,3],[3,0]]
];
var oneLine = [
[[0,2],[2,0]],
];
var complexMatrix = [
[-1,-1,0,-1, 0, 0, 0],
[-1,-1,0,-1, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
[0,0,0,0, 0, 0, 0],
];
var complexLines = [
[[0,4],[6,0]],
[[2,3],[3,0]]
];
/*complexLines = [
[[6,6],[0,4]],
[[2,3],[3,0]]
];*/
var matrixDemo = [
[-1,-1,[1],-1],
[-1,-1,[1],-1],
[[1],[1],[1],[2]],
[[2],[2],[2],[2]],
];
var matrixDemo2 = [
[-1,-1,[1],-1],
[-1,-1,[1],-1],
[[1],[1],[1,2],[2]],
[[2],[2],[2],0],
];
var matrixDemo3 = [
[-1,-1,[1],-1],
[-1,-1,[1],-1],
[[1],[1],[1,2],[2]],
[[2],[2],[2],[2]],
]; //TODO in that case one more angle is counted for 2 because we don't know the "start", maybe we should enumerate the point of a line
//console.log(findMatricesOfLine(complexMatrix, complexLines, 1));
//console.log(bestMatrix(baseMatrix, lines));
var t0 = new Date().getTime();
console.log(lib(complexMatrix, complexLines));
var t1 = new Date().getTime();
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.");