-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·92 lines (84 loc) · 1.9 KB
/
main.py
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
import logging
from core.components import (
Manager,
Position,
Visible,
Name,
Movable,
AI,
Vision,
Viewer,
UnderUserControl,
EntityBuilder,
)
from core.systems import (
World,
AISystem,
ViewSystem,
CleanupSystem,
AllowActionSystem,
FOVSystem,
UserControlSystem,
)
logging.basicConfig(filename='tech.log', level=logging.DEBUG)
def main():
entities = [
EntityBuilder(
name=Name('test1'),
position=Position(0, 9),
visible=Visible('x'),
movable=Movable(),
under_user_control=UnderUserControl(),
vision=Vision(),
viewer=Viewer(),
),
EntityBuilder(
name=Name('test2'),
position=Position(0, 0),
visible=Visible('y'),
movable=Movable(),
ai=AI(),
vision=Vision(),
),
EntityBuilder(
name=Name('wall'),
position=Position(4, 4),
visible=Visible('#'),
),
EntityBuilder(
name=Name('wall'),
position=Position(5, 4),
visible=Visible('#'),
),
EntityBuilder(
name=Name('wall'),
position=Position(6, 4),
visible=Visible('#'),
),
EntityBuilder(
name=Name('test3'),
position=Position(9, 9),
visible=Visible('z'),
movable=Movable(),
ai=AI(),
vision=Vision(),
),
]
cm = Manager()
for entity in entities:
cm.add(entity)
systems = [
CleanupSystem,
FOVSystem,
AllowActionSystem,
AISystem,
FOVSystem,
ViewSystem,
UserControlSystem,
]
world = World(cm, systems)
for i in range(30):
world = world.step()
if __name__ == '__main__':
main()