kata/rover/rover.py
Bruno BELANYI add6940dce rover: use Pydantic for Vector and Rover classes
Pydantic is similar to Dataclasses, but enables run-time type-checking.
2019-11-15 21:04:16 +01:00

22 lines
338 B
Python

import enum
from pydantic import BaseModel
class Vector(BaseModel):
x: int = 0
y: int = 0
class Direction(enum.Enum):
NORTH = "N"
SOUTH = "S"
EAST = "E"
WEST = "W"
class Rover(BaseModel):
pos: Vector = Vector(x=0, y=0)
planet_size: Vector = Vector(x=100, y=100)
dir: Direction = Direction.NORTH