-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
32 lines (32 loc) · 958 Bytes
/
app.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
var rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
var rov = require('./Rover.js')
var rover;
var inputNo = 1;
var output;
rl.on('line', function (data) {
if (inputNo == 1) {
var dataSplit = data.split(" ");
rover = new rov(dataSplit[0], dataSplit[1]);
inputNo++;
} else if (inputNo == 2) {
var dataSplit = data.split(" ");
rover.setPosition(dataSplit[0], dataSplit[1], dataSplit[2]);
inputNo++;
} else if (inputNo == 3) {
rover.processRover(data);
output = rover.printPosition();
inputNo++;
} else if (inputNo == 4) {
var dataSplit = data.split(" ");
rover.setPosition(dataSplit[0], dataSplit[1], dataSplit[2]);
inputNo++;
} else if (inputNo == 5) {
rover.processRover(data);
console.log(output);
console.log(rover.printPosition());
process.exit();
}
})