-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_sim.py
More file actions
36 lines (28 loc) · 810 Bytes
/
simple_sim.py
File metadata and controls
36 lines (28 loc) · 810 Bytes
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
from fizicks import Motion, Position, Velocity
from bandit.object import Object
from bandit.space import Space
space = Space()
class Ball(Object):
def __init__(self, position, velocity, mass):
super().__init__()
self.position = Position(*position)
self.velocity = Velocity(*velocity)
self.mass = mass
self.debt = []
def _update(self):
Motion.update(self)
def state(self):
state = super().state()
return {
"position": self.position,
"velocity": self.velocity,
"mass": self.mass,
"debt": self.debt,
**state,
}
ball = Ball([0, 0, 0], [1, 0, 0], 1)
space.add_object(ball)
print(space.state())
print('***********************')
space.update()
print(space.state())