MCPcopy Index your code
hub / github.com/ndleah/python-mini-project / highlightSquares

Function highlightSquares

Chess_Game/ChessGame.py:95–106  ·  view source on GitHub ↗
(screen, gs, validMoves, sqSelected)

Source from the content-addressed store, hash-verified

93 p.display.flip()
94
95def highlightSquares(screen, gs, validMoves, sqSelected):
96 if sqSelected != ():
97 r, c = sqSelected
98 if gs.board[r][c][0] == ('w' if gs.whiteToMove else 'b'):
99 s = p.Surface((SQ_SIZE, SQ_SIZE))
100 s.set_alpha(100)
101 s.fill(p.Color('blue'))
102 screen.blit(s, (c*SQ_SIZE, r*SQ_SIZE))
103 s.fill(p.Color("yellow"))
104 for moves in validMoves:
105 if moves.startRow == r and moves.startCol == c:
106 screen.blit(s, (SQ_SIZE*moves.endCol, SQ_SIZE*moves.endRow))
107
108def drawGameState(screen, gs, validMoves, sqSelected):
109 drawBoard(screen)

Callers 1

drawGameStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected