salut
je reviens sur le programme du jeu d'échec
voilà ce dont j'ai compris
Python 3.0

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from random import randrange
 
x=int(input("x pos = "))
y=int(input("y pos = "))
b = randrange (1,2)
if b==1:
    while 1:
            a = randrange(-7,7)
            x = x+a
            y = y+a
            if x>0 and x<9 and y>0 and y<9:
                print("x= ",x,"y= ",y)
                break
if b==2:
    while 1:
            a = randrange(-7,7)
            x = x+a
            y = y-a
            if x>0 and x<9 and y>0 and y<9:
                print("x= ",x,"y= ",y)
                break

j'aimerais comprendre :
x est ce horizontal et y est ce vertical ou l'inverse
pourquoi 9 dans x<9 et y<9
un échiquier c'est 8x8
type :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
coord=[
    'a8','b8','c8','d8','e8','f8','g8','h8',
    'a7','b7','c7','d7','e7','f7','g7','h7',
    'a6','b6','c6','d6','e6','f6','g6','h6',
    'a5','b5','c5','d5','e5','f5','g5','h5',
    'a4','b4','c4','d4','e4','f4','g4','h4',
    'a3','b3','c3','d3','e3','f3','g3','h3',
    'a2','b2','c2','d2','e2','f2','g2','h2',
    'a1','b1','c1','d1','e1','f1','g1','h1',
    ]
ou

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
tab120 = (
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1,  0,  1,  2,  3,  4,  5,  6,  7, -1,
    -1,  8,  9, 10, 11, 12, 13, 14, 15, -1,
    -1, 16, 17, 18, 19, 20, 21, 22, 23, -1,
    -1, 24, 25, 26, 27, 28, 29, 30, 31, -1,
    -1, 32, 33, 34, 35, 36, 37, 38, 39, -1,
    -1, 40, 41, 42, 43, 44, 45, 46, 47, -1,
    -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
    -1, 56, 57, 58, 59, 60, 61, 62, 63, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
je dois faire cela pour chaque pièce d'un jeu
faire le déplacement pour chaque pièce, déplacement autorisé

j'ai un peu besoin d'Aide
merci d'avance