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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| def tableau():
P =[['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','','']]
head = '│{0:^7}│{1:^7}│{2:^7}│{3:^7}│{4:^7}│{5:^7}│{6:^7}│'
ncol = '│{0:^7}│{1:^7}│{2:^7}│{3:^7}│{4:^7}│{5:^7}│{6:^7}│'
hsep = '├'+6*'―――――――''┼' + '―――――――''┤'
vspace = '│ '+0*' '+' │ '+5*' '+' │ '+5*' '+' │ '+5*' '+' │ '+5*' '+' │ '+5*' '+' │ '+5*' '+' │ '
fin = '┴'+6*'―――――――''┴' + '―――――――''┴'
debut = "┬"
print(head.format('1', '2', '3','4','5','6','7','8'))
for ligne in range(len(P)):
print(hsep)
print(vspace)
print(ncol.format( P[ligne][0], P[ligne][1], P[ligne][2], P[ligne][3], P[ligne][4], P[ligne][5], P[ligne][6]))
print(vspace)
print(fin)
tableau()
P =[['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','',''],
['','','','','','','','']]
symbole = "0"
ligne = 0
ncol = int(input("numéro colonne\n"))
libre = True
while ligne<6 and libre : # test pour la ligne jusqu'en bas ou jusqu'a un jeton
if P[ligne][ncol]=='': # test si case est vide ou pas
ligne= ligne+1
else: # sinon
libre = False
if ligne>0: # test si colonne remplie
ligne = ligne-1
P[ligne][ncol] = symbole # remplir la case
else: # sinon
print("colonne remplis, placement impossible") # dire que la colonne est remplie
print("rejouer") # dire de rejouer
tableau() |
Partager