Anonymous
Verdächtiges Python-Programm [geschlossen]
Post
by Anonymous » 17 Jan 2026, 01:05
Code: Select all
import random
cells = [
[0,0,0],
[0,0,0],
[0,0,0],
]
cell = 0
print("welcom to kresteke noli")
raund = True
while raund:
print("game board")
print("krestiky - 1, noli - 2")
print(cells[0][0],cells[0][1],cells[0][2])
print(cells[1][0], cells[1][1], cells[1][2])
print(cells[2][0], cells[2][1], cells[2][2])
print("cells numbers")
print("1,2,3")
print("4,5,6")
print("7,8,9")
cell = int(input("enter your cell:"))
if cell == 1:
if cells[0][0] != 2:
cells[0][0] = 1
elif cell == 2:
if cells[0][1] != 2:
cells[0][1] = 1
elif cell == 3:
if cells[0][2] != 2:
cells[0][2] = 1
elif cell == 4:
if cells[1][0] != 2:
cells[1][0] = 1
elif cell == 5:
if cells[1][1] != 2:
cells[1][1] = 1
elif cell == 6:
if cells[1][2] != 2:
cells[1][2] = 1
elif cell == 7:
if cells[2][0] != 2:
cells[2][0] = 1
elif cell == 8:
if cells[2][1] != 2:
cells[2][1] = 1
elif cell == 9:
if cells[2][2] != 2:
cells[2][2] = 1
print("AI is think...")
rrr = False
while rrr == False:
rr = random.randint(1, 9)
if rr == 1:
if cells[0][0] != 1:
cells[0][0] = 2
rrr = True
if rr == 2:
if cells[0][1] != 1:
cells[0][1] = 2
rrr = True
if rr == 3:
if cells[0][2] != 1:
cells[0][2] = 2
rrr = True
if rr == 4:
if cells[1][0] != 1:
cells[1][0] = 2
rrr = True
if rr == 5:
if cells[1][1] != 1:
cells[1][1] = 2
rrr = True
if rr == 6:
if cells[1][2] != 1:
cells[1][2] = 2
rrr = True
if rr == 7:
if cells[2][0] != 1:
cells[2][0] = 2
rrr = True
if rr == 8:
if cells[2][1] != 1:
cells[2][1] = 2
rrr = True
if rr == 9:
if cells[2][2] != 1:
cells[2][2] = 2
rrr = True
if (cells[0][0] and cells[0][1] and cells[0][2]) == 1 or (cells[1][0] and cells[1][1] and cells[1][2]) == 1 or (cells[2][0] and cells[2][1] and cells[2][2]) == 1 or (cells[0][0] and cells[1][0] and cells[2][0]) == 1 or (cells[0][1] and cells[1][1] and cells[2][1]) == 1 or (cells[0][2] and cells[1][2] and cells[2][2]) == 1 or (cells[0][0] and cells[1][1] and cells[2][2]) == 1 or (cells[0][2] and cells[1][1] and cells[2][0]) == 1:
print("krestiky is won!!!")
raund = False
if (cells[0][0] and cells[0][1] and cells[0][2]) == 2 or (cells[1][0] and cells[1][1] and cells[1][2]) == 2 or (cells[2][0] and cells[2][1] and cells[2][2]) == 2 or (cells[0][0] and cells[1][0] and cells[2][0]) == 2 or (cells[0][1] and cells[1][1] and cells[2][1]) == 2 or (cells[0][2] and cells[1][2] and cells[2][2]) == 2 or (cells[0][0] and cells[1][1] and cells[2][2]) == 2 or (cells[0][2] and cells[1][1] and cells[2][0]) == 2:
print("noli (AI) is won!!!")
raund = False
Code: Select all
welcom to kresteke noli
game board
krestiky - 1, noli - 2
0 0 0
0 0 0
0 0 0
cells numbers
1,2,3
4,5,6
7,8,9
enter your cell:7
AI is think...
game board
krestiky - 1, noli - 2
0 0 0
2 0 0
1 0 0
cells numbers
1,2,3
4,5,6
7,8,9
enter your cell:3
AI is think...
game board
krestiky - 1, noli - 2
0 0 1
2 0 2
1 0 0
cells numbers
1,2,3
4,5,6
7,8,9
enter your cell:5
AI is think...
krestiky is won!!!
noli (AI) is won!!!
Warum funktioniert es nicht? Bitte helfen Sie. Ich weiß nicht, was passiert.
1768608310
Anonymous
[code]import random cells = [ [0,0,0], [0,0,0], [0,0,0], ] cell = 0 print("welcom to kresteke noli") raund = True while raund: print("game board") print("krestiky - 1, noli - 2") print(cells[0][0],cells[0][1],cells[0][2]) print(cells[1][0], cells[1][1], cells[1][2]) print(cells[2][0], cells[2][1], cells[2][2]) print("cells numbers") print("1,2,3") print("4,5,6") print("7,8,9") cell = int(input("enter your cell:")) if cell == 1: if cells[0][0] != 2: cells[0][0] = 1 elif cell == 2: if cells[0][1] != 2: cells[0][1] = 1 elif cell == 3: if cells[0][2] != 2: cells[0][2] = 1 elif cell == 4: if cells[1][0] != 2: cells[1][0] = 1 elif cell == 5: if cells[1][1] != 2: cells[1][1] = 1 elif cell == 6: if cells[1][2] != 2: cells[1][2] = 1 elif cell == 7: if cells[2][0] != 2: cells[2][0] = 1 elif cell == 8: if cells[2][1] != 2: cells[2][1] = 1 elif cell == 9: if cells[2][2] != 2: cells[2][2] = 1 print("AI is think...") rrr = False while rrr == False: rr = random.randint(1, 9) if rr == 1: if cells[0][0] != 1: cells[0][0] = 2 rrr = True if rr == 2: if cells[0][1] != 1: cells[0][1] = 2 rrr = True if rr == 3: if cells[0][2] != 1: cells[0][2] = 2 rrr = True if rr == 4: if cells[1][0] != 1: cells[1][0] = 2 rrr = True if rr == 5: if cells[1][1] != 1: cells[1][1] = 2 rrr = True if rr == 6: if cells[1][2] != 1: cells[1][2] = 2 rrr = True if rr == 7: if cells[2][0] != 1: cells[2][0] = 2 rrr = True if rr == 8: if cells[2][1] != 1: cells[2][1] = 2 rrr = True if rr == 9: if cells[2][2] != 1: cells[2][2] = 2 rrr = True if (cells[0][0] and cells[0][1] and cells[0][2]) == 1 or (cells[1][0] and cells[1][1] and cells[1][2]) == 1 or (cells[2][0] and cells[2][1] and cells[2][2]) == 1 or (cells[0][0] and cells[1][0] and cells[2][0]) == 1 or (cells[0][1] and cells[1][1] and cells[2][1]) == 1 or (cells[0][2] and cells[1][2] and cells[2][2]) == 1 or (cells[0][0] and cells[1][1] and cells[2][2]) == 1 or (cells[0][2] and cells[1][1] and cells[2][0]) == 1: print("krestiky is won!!!") raund = False if (cells[0][0] and cells[0][1] and cells[0][2]) == 2 or (cells[1][0] and cells[1][1] and cells[1][2]) == 2 or (cells[2][0] and cells[2][1] and cells[2][2]) == 2 or (cells[0][0] and cells[1][0] and cells[2][0]) == 2 or (cells[0][1] and cells[1][1] and cells[2][1]) == 2 or (cells[0][2] and cells[1][2] and cells[2][2]) == 2 or (cells[0][0] and cells[1][1] and cells[2][2]) == 2 or (cells[0][2] and cells[1][1] and cells[2][0]) == 2: print("noli (AI) is won!!!") raund = False [/code] [code]welcom to kresteke noli game board krestiky - 1, noli - 2 0 0 0 0 0 0 0 0 0 cells numbers 1,2,3 4,5,6 7,8,9 enter your cell:7 AI is think... game board krestiky - 1, noli - 2 0 0 0 2 0 0 1 0 0 cells numbers 1,2,3 4,5,6 7,8,9 enter your cell:3 AI is think... game board krestiky - 1, noli - 2 0 0 1 2 0 2 1 0 0 cells numbers 1,2,3 4,5,6 7,8,9 enter your cell:5 AI is think... krestiky is won!!! noli (AI) is won!!! [/code] Warum funktioniert es nicht? Bitte helfen Sie. Ich weiß nicht, was passiert.