def __hitWall(self, cookie): service = PlayerService() player = service.get(cookie.playerId) previousSpace = self.playerGrid.getMapSpace(cookie.position) previousSpace.cookies.remove(cookie) player.getHitByCookie(cookie) service.save(player) return (cookie, player)
def __hitWall(self, cookie): service = PlayerService() player = service.get(cookie.playerId) previousSpace = self.playerGrid.getMapSpace(cookie.position) previousSpace.cookies.remove(cookie) player.getHitByCookie(cookie) service.save(player) return (cookie, player)
def __hitPlayer(self, cookie, nextMapSpace): service = PlayerService() previousPlayer = service.get(cookie.playerId) previousSpace = self.playerGrid.getMapSpace(cookie.position) previousSpace.cookies.remove(cookie) hitPlayer = nextMapSpace.players[0] hitPlayer.getHitByCookie(cookie) service.save(hitPlayer) if len(previousPlayer.cookies) == 0: raise WinnerFound(previousPlayer.playerId) return (cookie, hitPlayer)
def __hitPlayer(self, cookie, nextMapSpace): service = PlayerService() previousPlayer = service.get(cookie.playerId) previousSpace = self.playerGrid.getMapSpace(cookie.position) previousSpace.cookies.remove(cookie) hitPlayer = nextMapSpace.players[0] hitPlayer.getHitByCookie(cookie) service.save(hitPlayer) if len(previousPlayer.cookies) == 0: raise WinnerFound(previousPlayer.playerId) return (cookie, hitPlayer)