From 3bdf1ca9795390d6a72fbb15e8a43d20f861d0b7 Mon Sep 17 00:00:00 2001 From: Docksein Date: Tue, 19 Jan 2021 14:20:01 +0100 Subject: [PATCH] board, player input --- piskvorky.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 piskvorky.py diff --git a/piskvorky.py b/piskvorky.py new file mode 100644 index 0000000..dacd410 --- /dev/null +++ b/piskvorky.py @@ -0,0 +1,23 @@ +board = [[" ", " ", " "],[" ", " ", " "],[" ", " ", " "]] + +def print_board(board): + print(f""" 1 2 3 +1 |{board[0][0]}|{board[0][1]}|{board[0][2]}| +2 |{board[1][0]}|{board[1][1]}|{board[1][2]}| +3 |{board[2][0]}|{board[2][1]}|{board[2][2]}| +""") + +def player(board): + player_move = input("Zvol si radu a sloupec ") + try: + if board[int(player_move[0])][int(player_move[0])] == " ": + pass + else: + print("Moznost nelze vybrat") + player_move = input("Zvol si radu a sloupec ") + except: + print("Moznost nelze vybrat") + player_move = input("Zvol si radu a sloupec ") + + +player()