Init
This commit is contained in:
50
world/commons/field.py
Normal file
50
world/commons/field.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing_extensions import override
|
||||
from world.commons.field_landmarks import FieldLandmarks
|
||||
|
||||
|
||||
class Field(ABC):
|
||||
def __init__(self, world):
|
||||
from world.world import World # type hinting
|
||||
self.world: World = world
|
||||
self.field_landmarks: FieldLandmarks = FieldLandmarks(world=self.world)
|
||||
|
||||
def get_our_goal_position(self):
|
||||
return (-self.get_length() / 2, 0)
|
||||
|
||||
def get_their_goal_position(self):
|
||||
return (self.get_length() / 2, 0)
|
||||
|
||||
@abstractmethod
|
||||
def get_width(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def get_length(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class FIFAField(Field):
|
||||
def __init__(self, world):
|
||||
super().__init__(world)
|
||||
|
||||
@override
|
||||
def get_width(self):
|
||||
return 68
|
||||
|
||||
@override
|
||||
def get_length(self):
|
||||
return 105
|
||||
|
||||
|
||||
class HLAdultField(Field):
|
||||
def __init__(self, world):
|
||||
super().__init__(world)
|
||||
|
||||
@override
|
||||
def get_width(self):
|
||||
return 9
|
||||
|
||||
@override
|
||||
def get_length(self):
|
||||
return 14
|
||||
Reference in New Issue
Block a user