forked from cwthompson/mouse_ai_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmouse.js
55 lines (48 loc) · 995 Bytes
/
mouse.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
var fs = require('fs');
function containsObject(obj, list) {
var i;
for (i = 0; i < list.length; i++) {
if (list[i].x === obj.x && list[i].y === obj.y) {
return true;
}
}
return false;
}
var mouse = {
number: 0,
steps: 0,
name: 'Mouse',
location: {
x: 0,
y: 0
},
move: function(room) {
},
getLocation: function () {
return this.location;
},
getName: function () {
return this.name;
},
setName: function (name) {
this.name = name;
},
updateLocation: function (room) {
this.location = {
x: room.x,
y: room.y
}
},
resetMouse: function () {
this.number ++;
this.setName('Mouse '+this.number);
this.steps = 0;
this.location = { x: 0, y: 0 };
},
getSteps: function () {
return this.steps;
}
}
module.exports.getMouse = function () {
return mouse;
};