Hong-Phuc Bui
2025-05-06 63e664b8795f0dc7f64fb9ca4209d27cac1155b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
EMPTY = 0
PL1 = 1
PL2 = 2
 
tafel = [
   [EMPTY, EMPTY, EMPTY],
   [EMPTY, EMPTY, EMPTY],
   [EMPTY, EMPTY, EMPTY],
]
 
def print_tafel(tafel):
    symbols = ("*", "X", "O")
    for zeile in tafel:
        for c in zeile:
            print(f"{symbols[c]} ",end="")
        print()
 
def input_ok(tafel, r, c):
    return True
   
   
def user_input(user,tafel):
    print(f"Spieler {user} ist dran")
    print("Geben Sie die Zeile und Spalten ein")
    r = int(input("Zeile:  ")) - 1
    c = int(input("Spalte: ")) - 1
    if input_ok(tafel, r, c):
        tafel[r][c] = user
    else:
        print("Eingabe nicht in Ordnung")
    
print_tafel(tafel)
user_input(1, tafel)
print_tafel(tafel)
user_input(2, tafel)
print_tafel(tafel)