-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathMiniDuckSimulator.py
36 lines (29 loc) · 1.08 KB
/
MiniDuckSimulator.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
from DecoyDuck import DecoyDuck
from Duck import Duck
from FlyBehavior import FlyBehavior
from FlyNoWay import FlyNoWay
from FlyRocketPowered import FlyRocketPowered
from MallardDuck import MallardDuck
from ModelDuck import ModelDuck
from RubberDuck import RubberDuck
from Squeak import Squeak
from QuackBehavior import QuackBehavior
class MiniDuckSimulator:
@staticmethod
def main(*args):
mallard: MallardDuck = MallardDuck()
# canFly: FlyBehavior = lambda: print("I can't fly")
# squeak: QuackBehavior = lambda: print("Squeak")
canFly: FlyBehavior = FlyNoWay()
squeak: QuackBehavior = Squeak()
rubberDuckie: RubberDuck = RubberDuck(flyBehavior=canFly, quackBehavior=squeak)
decoy: DecoyDuck = DecoyDuck()
model: Duck = ModelDuck()
mallard.performQuack()
rubberDuckie.performQuack()
decoy.performQuack()
model.performFly()
model.setFlyBehavior(FlyRocketPowered())
model.performFly()
if __name__ == "__main__":
MiniDuckSimulator.main()