Skip to content

Commit 8c9b818

Browse files
committed
Partial commit
1 parent 686bbbb commit 8c9b818

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed

controller.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
class Controller {
2+
3+
constructor() {
4+
5+
this.machines = [new Machine];
6+
this.data = [];
7+
this.dataStatus = [];
8+
this.controllerStatus = "OFF";
9+
this.avg = 0;
10+
11+
/*The controller can be in:
12+
DONE: Sorting done
13+
WORK: Waiting for step
14+
OFF: Waiting for all parameters and machines to be set
15+
*/
16+
17+
}
18+
19+
setMachines(n) {
20+
21+
if (this.controllerStatus != "OFF") {return false;}
22+
23+
for (let i = 0; i < n; i++) {
24+
25+
this.machines[i] = new Machine;
26+
27+
}
28+
29+
this.controllerStatus = "OFF";
30+
return true;
31+
32+
}
33+
34+
check() {
35+
36+
if (this.machines.length == 0) {return false;}
37+
if (this.data.length == 0) {return false;}
38+
if (this.dataStatus.length != this.data.length) {return false;}
39+
40+
}
41+
42+
step() {
43+
44+
for (let i = 0; i < this.machines.length) {this.machines[i].step();}
45+
46+
}
47+
48+
}

index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>J-Ressort v1</title>
5+
<script src="lib/p5.min.js"></script>
6+
<link rel="stylesheet" type="text/css" href="style.css">
7+
<meta charset="utf-8" />
8+
</head>
9+
<body>
10+
<script src="controller.js"></script>
11+
<script src="interface.js"></script>
12+
<script src="machine.js"></script>
13+
</body>
14+
</html>

interface.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function setup() {
2+
3+
4+
5+
}
6+
7+
function draw() {
8+
9+
10+
11+
}

lib/p5.min.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

machine.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Machine {
2+
3+
constructor() {
4+
5+
this.data = [];
6+
this.avg = 0;
7+
this.machineStatus = "OFF";
8+
9+
}
10+
11+
step() {
12+
13+
if (this.machineStatus != "WORK") {return false;}
14+
15+
16+
17+
}
18+
19+
}

style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
canvas {
6+
display: block;
7+
}

0 commit comments

Comments
 (0)