Commit 51d2d55a authored by gem2578's avatar gem2578 Committed by Marcus M. Scheunemann

Added test to make sure it is a Brain

parent 3ce252a6
# Useful Classes
## Team
## Team (Class)
> Team(Side)
#### put()
> put(Brain, pos) -> None
> put(Brain, (100, 250)) -> None
## Side
## Side (Enum)
- LEFT
- RIGHT
#### other()
> other() -> Side
## ObjectType
## ObjectType (Enum)
- BALL
- GOAL
- PLAYER
## CupObject
## CupObject (Class)
- type -> ObjectType
- pos -> Vector2
- side -> Side OR None
## Brain
## Brain (Class)
- pos -> Vector2
- ball -> CupObject
- self_goal -> CupObject
......@@ -41,5 +41,5 @@
#### run()
> run(Team(LEFT), Team(RIGHT)) -> None
## Vector2
## Vector2 (Class)
docs: https://www.pygame.org/docs/ref/math.html#pygame.math.Vector2
import pygame
from sprite.player import Player
from sprite.player import *
class Team(pygame.sprite.Group):
......@@ -7,8 +7,10 @@ class Team(pygame.sprite.Group):
super().__init__()
self.side = side
def put(self, Brain, pos):
self.add(Player(Brain(self.side), pos))
def put(self, BrainClass, pos):
if not issubclass(BrainClass, Brain):
raise Exception('the class passed dose not inherit Brain ')
self.add(Player(BrainClass(self.side), pos))
def setup(self, ball, goals, other_team):
for player in self.sprites():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment