from random import choice


# 1



def affiche(G):
    print()
    for y in range(5, -1, -1):
        ligne = ''
        for x in range(7):
            if G[x][y] == 0:
                ligne += '. '
            elif G[x][y] == 1:
                ligne += 'o '
            else:  # G[x][y] == 2
                ligne += 'x '
        print(ligne)


G = init()
G[0][0] = 1
G[3][0] = 2
G[3][1] = 1
affiche(G)


## 2



affiche(G)
print(coups(G))


##

def tous_alignements():
    res = []
    # horizontaux
    for x in range(4):
        for y in range(6):
            ligne = []
            for k in range(4):
                ligne.append((x + k, y))
            res.append(ligne)
    # verticaux
    for x in range(7):
        for y in range(3):
            ligne = []
            for k in range(4):
                ligne.append((x, y + k))
            res.append(ligne)
    # diag nord-est
    for x in range(4):
        for y in range(3):
            ligne = []
            for k in range(4):
                ligne.append((x + k, y + k))
            res.append(ligne)
    # diag nord-ouest
    for x in range(3, 7):
        for y in range(3):
            ligne = []
            for k in range(4):
                ligne.append((x - k, y + k))
            res.append(ligne)
    return res


tous = tous_alignements()


## 3



print(fini(G))
for x in range(4, 7):
    G[x][0] = 2
for x in range(4, 6):
    G[x][1] = 1
affiche(G)
print(fini(G))


## 4






## 5



## 6


## 7


pinf = float('inf')
w = [0, 1, 10, 30, pinf]
humain_vs_machine(w, 2)


## 8



## 9
W = [[0, 1, 10, 100, pinf],
     [0, 1, 10, 1000, pinf],
     [0, 1, 10, 30, pinf],
     [0, 1, 2, 4, pinf]]




