Skip to content

Commit

Permalink
added sound and pygame icon
Browse files Browse the repository at this point in the history
  • Loading branch information
theinit01 committed Apr 28, 2024
1 parent 17df0d8 commit c3986b4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
Binary file modified __pycache__/smartMoveFinder.cpython-311.pyc
Binary file not shown.
Binary file added assets/move.mp3
Binary file not shown.
6 changes: 5 additions & 1 deletion chessMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ def main():
moveMade = False
animate = False # flag variable for when we need to animate a move
loadImages() # only do this once, before the while loop
moveSound = p.mixer.Sound('assets/move.mp3')
p.display.set_icon(IMAGES['bK'])
running = True
sqSelected = () # no square is selected, keep track of last click tuple(row, col)
playerClicks = [] # keep track of player clicks, 2 tuples: [(6, 4), (4, 4)]
gameOver = False
playerOne = False # if a human is playing white, then this will be true
playerOne = True # if a human is playing white, then this will be true
playerTwo = False # if a human is playing black, then this will be true
AIThinking = False
moveFinderProcess = None
Expand Down Expand Up @@ -160,6 +162,7 @@ def main():
for i in range(len(validMoves)):
if move == validMoves[i]:
gs.makeMove(validMoves[i])
moveSound.play()
moveMade = True
animate = True
sqSelected = () # reset user clicks
Expand Down Expand Up @@ -206,6 +209,7 @@ def main():
if AIMove is None:
AIMove = findRandomMove(validMoves)
gs.makeMove(AIMove)
moveSound.play()
moveMade = True
animate = True
AIThinking = False
Expand Down
1 change: 1 addition & 0 deletions smartMoveFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import random


pieceScore = {"K": 0, "Q": 9, "R": 5, "B": 3, "N": 3, "p": 1}

knightScores = [[0.0, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.0],
Expand Down

0 comments on commit c3986b4

Please sign in to comment.