Commit e262145c authored by gem2578's avatar gem2578

Merge branch '8-convert-to-python-package' into 'master'

Update structure to package structure

Closes #8

See merge request !10
parents 86e43a02 0117f8d3
from .group import Team
from .model import Side
from .brain import Brain, FollowBall
from .match import Match
from . import Team, Match, FollowBall
def main():
empty_team = Team()
one_player_team = Team()
one_player_team.put(FollowBall, (100, 300))
match = Match()
match.play(one_player_team, empty_team)
print(match.get_score())
match.play(empty_team, one_player_team)
print(match.get_score())
if __name__ == "__main__":
main()
from .brain import Brain
from .follow_ball import FollowBall
from abc import ABC, abstractmethod
from model.object_type import ObjectType
from model.cup_object import CupObject
from ..model import ObjectType, CupObject, Side
from pygame.math import Vector2
from model.side import Side
class Brain(ABC):
......
from brain.brain import Brain
from ..brain import Brain
from pygame.math import Vector2
class FollowBall(Brain):
......
from .team import Team
from .team_item import TeamItem
from .team_goal import TeamGoal
from .single_ball import SingleBall
from pygame.sprite import GroupSingle
from sprite.ball import Ball
from ..sprite import Ball
class SingleBall(GroupSingle):
......
import pygame
import config
from sprite.player import Player
from brain.brain import Brain
from .. import config
from ..sprite import Player
from ..brain import Brain
class Team(object):
......
from group.team_item import TeamItem
from sprite.goal import Goal
from .team_item import TeamItem
from ..sprite import Goal
class TeamGoal(TeamItem):
......
import pygame
from model.side import Side
from ..model import Side
class TeamItem(pygame.sprite.Group):
......
import pygame
import config
from group.team import Team
from group.team_item import TeamItem
from group.team_goal import TeamGoal
from group.single_ball import SingleBall
from model.side import Side
from sprite.score import Score
from brain.follow_ball import FollowBall
from . import config
from .group import Team, TeamItem, TeamGoal, SingleBall
from .model import Side
from .sprite import Score
from .brain import FollowBall
pygame.init()
pygame.display.set_caption("Python Cup")
......@@ -48,7 +45,7 @@ class Match(object):
pygame.display.flip()
def check_events(self):
def check_events(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.done = True
......@@ -86,20 +83,3 @@ class Match(object):
for score in self.score_board:
data[score.side] = score.score
return data
def main():
empty_team = Team()
one_player_team = Team()
one_player_team.put(FollowBall, (100, 300))
match = Match()
match.play(one_player_team, empty_team)
print(match.get_score())
match.play(empty_team, one_player_team)
print(match.get_score())
if __name__ == "__main__":
main()
from .cup_object import CupObject
from .object_type import ObjectType
from .side import Side
from pygame.math import Vector2
from model.side import Side
from .side import Side
class CupObject():
......
from .player import Player
from .ball import Ball
from .goal import Goal
from .score import Score
import pygame
import config
import sprite.round_sprite as rs
from .. import config
from . import round_sprite as rs
class Ball(rs.Round):
......
import pygame
import config
from model.side import Side
from .. import config
from ..model import Side
class Goal(pygame.sprite.Sprite):
......
import pygame
import config
import sprite.round_sprite as rs
from model.side import Side
from .. import config
from . import round_sprite as rs
from ..model import Side
class Player(rs.Round):
......
import pygame
from model.side import Side
from ..model import Side
pygame.font.init()
......
from pythocup import Match
from group.team import Team
from model.side import Side
from brain.follow_ball import FollowBall
from pythocup import Team, Match, FollowBall
def main():
......
from pythocup import Team, Match, Brain, FollowBall
from pygame.math import Vector2
class GoToBall(Brain):
def action(self):
move = self.ball.pos - self.pos
return move, Vector2(0,0)
def main():
team_a = Team()
team_a.put(GoToBall, (100, 250))
team_b = Team()
# team_b.put(FollowBall, (100, 250))
match = Match()
match.play(team_a, team_b)
print(match.get_score())
if __name__ == "__main__":
main()
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