-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patharena.py
26 lines (23 loc) · 856 Bytes
/
arena.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
from nikolajs_dummy import NikolajsDummyCalculator
from rasmus import rasmus_simple, rasmus_brute, rasmus_numba
from oscar import oscar_recursive, oscar_non_recursive
class DummyEngine():
def __init__(self, models): self.models = models
def is_valid(self):
"""
For every model, check if it has a callable function .Z and an attribute .name
"""
for m in self.models:
if hasattr(m, "Z") and callable(getattr(m, "Z")) and hasattr(m, "name"):
print(f"Model '{m.name}' is valid.")
#TODO: Import your model class (e.g. NikolajsDummyCalculator) and add it to the list of models
E = DummyEngine(models=[
NikolajsDummyCalculator(),
rasmus_simple(),
rasmus_brute(),
rasmus_numba(),
oscar_recursive(),
oscar_non_recursive()
])
# We print all valid models
E.is_valid()