Skip to content

Commit 9e3f647

Browse files
committed
algebraic notation
1 parent dcf84d9 commit 9e3f647

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

blind_chess.py

+28
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,44 @@
33
from game import Game
44
from minimax import Minimax
55

6+
from gtts import gTTS
7+
import os
8+
69
WHITE = 0
710
BLACK = 1
811

912
if __name__ == '__main__':
1013

1114
print("Creating the speech recognition...")
15+
16+
tts = gTTS(text='Creating the speech recognition...', lang='en')
17+
tts.save("blind.mp3")
18+
os.system("mpg321 blind.mp3")
19+
1220
rec = SpeechRecognition()
1321
print("Speech Recognition created...\n")
1422

23+
tts = gTTS(text='Speech Recognition created...', lang='en')
24+
tts.save("blind.mp3")
25+
os.system("mpg321 blind.mp3")
26+
1527
print("Creating the board game...")
28+
1629
board = Chess()
1730
game = Game()
1831
game.draw(board)
1932
print("Board Game created...\n")
2033

34+
tts = gTTS(text='Board Game created...', lang='en')
35+
tts.save("blind.mp3")
36+
os.system("mpg321 blind.mp3")
37+
2138
rival = Minimax(BLACK)
2239

40+
tts = gTTS(text='El juego ha comenzado', lang='es')
41+
tts.save("blind.mp3")
42+
os.system("mpg321 blind.mp3")
43+
2344
while True:
2445
# Get all the valid moves for the white player
2546
valid_moves = board.get_all_valid_moves(WHITE)
@@ -33,6 +54,13 @@
3354
rival_move = rival.get_best_move(board)
3455
# Do the rival movement
3556
board.do(rival_move)
57+
58+
movement = rec.say(rival_move)
59+
60+
tts = gTTS(text=movement, lang='es')
61+
tts.save("blind.mp3")
62+
os.system("mpg321 blind.mp3")
63+
3664
# Print the game
3765
game.draw(board)
3866

game.py

+14
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,18 @@ def draw(self, board):
4848
if board.board[i] != -1:
4949
self.screen.blit(self.pieces[board.board[i]], self.coord(i))
5050

51+
x_a = 265
52+
y_n = 455
53+
font = pygame.font.SysFont("arial", 30)
54+
pos_abc = ["a", "b", "c", "d", "e", "f", "g", "h"]
55+
pos_num = ["1", "2", "3", "4", "5", "6", "7", "8"]
56+
57+
for i in range(8):
58+
leter = font.render(pos_abc[i], True, (0, 0, 0))
59+
num = font.render(pos_num[i], True, (0, 0, 0))
60+
self.screen.blit(leter, (x_a, 505))
61+
self.screen.blit(num, (220, y_n))
62+
x_a = x_a + 50
63+
y_n = y_n - 50
64+
5165
pygame.display.flip()

0 commit comments

Comments
 (0)