2022-11-15 14:34:14 +01:00
|
|
|
#task make a chess game
|
|
|
|
|
2022-11-15 14:34:42 +01:00
|
|
|
'''to know :
|
|
|
|
value of a pwan : 1
|
|
|
|
value of a knight : 2
|
|
|
|
value of a bishop : 3
|
|
|
|
value of a rook : 5
|
|
|
|
value of the Quenn : 9
|
|
|
|
value of the King : 10 '''
|
|
|
|
|
2022-11-15 14:48:42 +01:00
|
|
|
piece = [(1,2,3,5,9,10)]
|
2022-11-15 14:34:42 +01:00
|
|
|
|
|
|
|
|
2022-11-15 14:34:14 +01:00
|
|
|
import numpy as np
|
|
|
|
|
2022-11-15 14:34:42 +01:00
|
|
|
|
|
|
|
|
2022-11-15 14:34:14 +01:00
|
|
|
|
|
|
|
def chess_board_empty(): #affiche le plateau d'echec sous forme de matrice 8*8 vide
|
|
|
|
board_empty = np.zeros((8,8))
|
|
|
|
return board_empty
|
|
|
|
|
|
|
|
print(chess_board_empty())
|
|
|
|
|
|
|
|
def chess_board():
|
|
|
|
board_empty = chess_board_empty()
|
|
|
|
n = range(len(board_empty))
|
|
|
|
m = range(len(board_empty[0]))
|
|
|
|
for i in n:
|
|
|
|
for j in m:
|
2022-11-15 14:34:42 +01:00
|
|
|
if i == 0:
|
|
|
|
board_empty[j] = piece[j]
|
|
|
|
if i == 1:
|
|
|
|
while j<m:
|
|
|
|
board_empty[i][j] = piece[1]
|
|
|
|
|
|
|
|
return board_empty
|
|
|
|
|
|
|
|
|
|
|
|
print(chess_board())
|