Skip to content

Commit 16df324

Browse files
committed
fixed y / o confusion
1 parent 0ce0d1c commit 16df324

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ def read_board(self):
6262
print(' ----------------')
6363
print('2 %s | %s | %s', response[7], response[8], response[9])
6464

65-
#expects 4 bytes repr. winner
65+
#expects 4 bytes repr. winner, 0 = no one, 1 = X, 2 = O
6666
def get_winner(self):
6767
response = self.read_response(self)
68+
return int.from_bytes(response) == 0
6869

6970

7071

tictactoe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool handle_read_board(int client_fd, char* client_str) {
5050
int i = 0;
5151
for (int x = 0; x < __BOARD_SIZE__; x++) {
5252
for (int y = 0; y < __BOARD_SIZE__; y++) {
53-
char player = 'X' ? board[x][y] == X : 'Y' ? board_pkt[x][y] == Y : 'E';
53+
char player = 'X' ? board[x][y] == X : 'O' ? board[x][y] == O : 'E';
5454
board_pkt[i] = player;
5555
i++;
5656
}

0 commit comments

Comments
 (0)