# ball.py class Ball: character = "O" def __init__(self, position): self.position = position self.velocity = (1, 1) def play_turn(self, game): x, y = self.position vx, vy = self.velocity new_x = x + vx new_y = y + vy board_x, board_y = game.board_size if new_x < 0 or board_x <= new_x: self.velocity = (-vx, vy) elif new_y < 0 or board_y <= new_y: self.velocity = (vx, -vy) else: self.position = (new_x, new_y)