From bb3d4158ca78ac53c68f1c5bca26fcef9e4010e5 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Wed, 9 Oct 2019 12:43:22 +0700 Subject: Remove useless enemy weights and clean up --- client-examples/hit-and-run.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'client-examples') diff --git a/client-examples/hit-and-run.py b/client-examples/hit-and-run.py index 7bbf5a1..ef90276 100755 --- a/client-examples/hit-and-run.py +++ b/client-examples/hit-and-run.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from math import inf, atan2, degrees -from random import randrange, shuffle +from random import randrange from socket import socket AROUND = [5, 2, 1, 0, 3, 6, 7, 8] @@ -25,8 +25,7 @@ around, move = [0, 1, 2, 3, 5, 6, 7, 8], 4 while True: length = clientsocket.recv(7).decode() if length in ('', '0000000'): break # connection closed or game over - l = clientsocket.recv(int(length)).decode().split() - data = iter(l) + data = iter(clientsocket.recv(int(length)).decode().split()) nh, ne, nb, score = (int(next(data)) for _ in range(4)) maze = [list(next(data)) for _ in range(nh)] hp = (lambda c: 0 if c == 48 else 123 - c)(ord(next(data))) -- cgit 1.4.1