-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
75 lines (68 loc) · 1.15 KB
/
test.js
File metadata and controls
75 lines (68 loc) · 1.15 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
73
74
75
var Creature = require('./app/creature.js');
#var noth = null;
var creatures = [];
var start_test = function(){
creatures = [];
creatures.push(
new Creature(
"frank1",
{x:0,y:0},
5,
5,
'#f00',
HERBIVORE,
PLANT,
CARNIVORE
)
);
creatures.push(
new Creature(
"frank2",
{x:30,y:100},
5,
5,
'#0F0',
HERBIVORE,
PLANT,
CARNIVORE
)
);
/*
creatures.push(
new Creature(
"frank3",
{x:100,y:100},
5,
5,
'#0b0'
)
);
creatures.push(
new Creature(
"frank4",
{x:900,y:500},
5,
5,
'#fF0'
)
);*/
//console.log(creatures[0]);
//creatures[0].position = {x:300,y:200};
//creatures[0].move_to_destination();
//console.log(creatures[0]);
creatures.forEach(function(item){
if(item.alive){
tings = [];
for (x = 0; x< creatures.length; x++){
if(creatures[x].name !== item.name){
//tings.push( {type:creatures[x].type,position:creatures[x].position } );
tings.push( creatures[x] );
}
}
item.set_nearby( tings );
data = item.take_action();
console.log(data);
}
});
}
start_test();