|
|
@ -73,18 +73,6 @@ def convertPixels(dimension, pixels, invert=False): |
|
|
|
p.append(row) |
|
|
|
p.append(row) |
|
|
|
return p |
|
|
|
return p |
|
|
|
|
|
|
|
|
|
|
|
def get_balance_from_sock(sock, player_id): |
|
|
|
|
|
|
|
print('will balance haben...') |
|
|
|
|
|
|
|
sock.send(b'a') |
|
|
|
|
|
|
|
data = sock.recv(4) |
|
|
|
|
|
|
|
p1x, p1y, p2x, p2y = struct.unpack('bbbb', data) |
|
|
|
|
|
|
|
if player_id == 0: |
|
|
|
|
|
|
|
bal = p1y |
|
|
|
|
|
|
|
elif player_id == 1: |
|
|
|
|
|
|
|
bal = p2y |
|
|
|
|
|
|
|
print('balance id=%s balance=%d' % (player_id, bal)) |
|
|
|
|
|
|
|
return bal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BalanceBoardPlayer(object): |
|
|
|
class BalanceBoardPlayer(object): |
|
|
|
def __init__(self, playground, ownPaddle, wiimote_sock, player_id): |
|
|
|
def __init__(self, playground, ownPaddle, wiimote_sock, player_id): |
|
|
|
self.__playground = playground |
|
|
|
self.__playground = playground |
|
|
|