.
This commit is contained in:
parent
91f987df09
commit
fb491d8f96
25
chess_com.py
25
chess_com.py
@ -1,8 +1,20 @@
|
|||||||
#task make a chess game
|
#task make a chess game
|
||||||
|
|
||||||
|
'''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 '''
|
||||||
|
|
||||||
|
piece = [(1,2,3,5,9,10)]
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
piece = {'Pawn' : 1,'Knigt' : 2,'Bishop' : 3,'Rook' : 5, 'Quenn' : 9,'King' : 10} #assign a value at every piece
|
|
||||||
|
|
||||||
|
|
||||||
def chess_board_empty(): #affiche le plateau d'echec sous forme de matrice 8*8 vide
|
def chess_board_empty(): #affiche le plateau d'echec sous forme de matrice 8*8 vide
|
||||||
board_empty = np.zeros((8,8))
|
board_empty = np.zeros((8,8))
|
||||||
@ -16,4 +28,13 @@ def chess_board():
|
|||||||
m = range(len(board_empty[0]))
|
m = range(len(board_empty[0]))
|
||||||
for i in n:
|
for i in n:
|
||||||
for j in m:
|
for j in m:
|
||||||
pass
|
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())
|
||||||
|
Loading…
Reference in New Issue
Block a user