This repository has been archived on 2025-05-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
SmartDots/game.py
2019-07-16 16:06:30 +02:00

24 lines
814 B
Python

from typing import List
from obstacle import Obstacle
from vector import Point
class Game:
def __init__(self, width: float, height: float, start: Point, goal: Point,
obstacles: List[Obstacle], checkpoints: List[Point]):
self.width: float = width
self.height: float = height
self.start: Point = start
self.goal: Point = goal
self.obstacles: List[Obstacle] = obstacles
self.checkpoints: List[Point] = checkpoints
self.generation: int = 1
self.current_target: int = 0
self.target_countdown: int = None
self.mutation_start: int = 0
def get_current_target(self) -> Point:
if self.current_target < len(self.checkpoints):
return self.checkpoints[self.current_target]
return self.goal