map = [["*","*","*"],["*","*","*"],["*","*","*"]]
def ShowMap(list):
print(" 1 2 3")
row = 1
for wiersz in list:
print(row, end=" ")
for element in wiersz:
print(element, end=" ")
print()
row += 1
def Winner(list):
for x in range(0,3):
if map[x][0] == map[x][1] and map[x][1] == map[x][2] and (map[x][2] == "X" or map[x][2] == "O"):
return True
for y in range(0,3):
if map[0][x] == map[1][x] and map[1][x] == map[2][x] and (map[2][x] == "X" or map[2][x] == "O"):
return True
if map[0][0] == map[1][1] and map[1][1] == map[2][2] and (map[2][2] == "X" or map[2][2] == "O"):
return True
if map[0][2] == map[1][1] and map[1][1] == map[2][0] and (map[2][0] == "X" or map[2][0] == "O"):
return True
return False
def Draw(list):
if not Winner(list):
for wiersz in list:
for element in wiersz:
if element == "*":
return False
return True
else:
return False
cross_play = False
begin = input("Jezeli ma zaczac krzyzyk wpisz X, jeżeli kółko wpisz O: ")
if begin == "X" or begin == "X":
cross_play = True
while(not Draw(map) and not Winner(map)):
ShowMap(map)
x, y = [int(x) for x in input("Podaj wspolrzedne, gdzie chcesz postawic znak:").split()]
if map[x-1][y-1] == "*":
if cross_play:
map[x-1][y-1] = "X"
cross_play = False
else:
map[x-1][y-1] = "O"
cross_play = True
if Winner(map):
if cross_play:
ShowMap(map)
print("Kolko wygralo!")
else:
ShowMap(map)
print("Krzyzyk wygral!")
else:
ShowMap(map)
print("Mamy remis!")
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}