def showScreen(win, side, board, flags, pos, load, player=None, online=False): multi = False if player is None: multi = True player = side flip = load["flip"] and player drawBoard(win) win.blit(BACK, (460, 0)) if not multi: win.blit(CHESS.TURN[int(side == player)], (10, 460)) if not online: if load["allow_undo"]: win.blit(CHESS.UNDO, (10, 12)) win.blit(CHESS.SAVE, (350, 462)) if isEnd(side, board, flags): if isChecked(side, board): win.blit(CHESS.CHECKMATE, (100, 12)) win.blit(CHESS.LOST, (320, 12)) win.blit(CHESS.PIECES[side]["k"], (270, 0)) else: win.blit(CHESS.STALEMATE, (160, 12)) else: if online: win.blit(CHESS.DRAW, (10, 12)) win.blit(CHESS.RESIGN, (400, 462)) if isChecked(side, board): win.blit(CHESS.CHECK, (200, 12)) if isOccupied(side, board, pos) and side == player: x = (9 - pos[0]) * 50 if flip else pos[0] * 50 y = (9 - pos[1]) * 50 if flip else pos[1] * 50 pygame.draw.rect(win, (255, 255, 0), (x, y, 50, 50)) drawPieces(win, board, flip) if load["show_moves"] and side == player: showAvailMoves(win, side, board, pos, flags, flip) if not multi: pygame.display.update()
def showScreen(win, side, board, flags, pos, LOAD, player=None, online=False): multi = False if player is None: multi = True player = side flip = LOAD[1] and player drawBoard(win) if not multi: win.blit(CHESS.TURN[int(side == player)], (10, 460)) if not online: if LOAD[4]: win.blit(CHESS.UNDO, (10, 10)) win.blit(CHESS.SAVE, (350, 460)) if isEnd(side, board, flags): if isChecked(side, board): win.blit(CHESS.CHECKMATE, (140, 12)) win.blit(CHESS.LOST, (370, 12)) win.blit(CHESS.PIECES[side]["k"], (320, 0)) else: win.blit(CHESS.STALEMATE, (150, 12)) else: if isChecked(side, board): win.blit(CHESS.CHECK, (180, 12)) if isOccupied(side, board, pos) and side == player: x = (9 - pos[0]) * 50 if flip else pos[0] * 50 y = (9 - pos[1]) * 50 if flip else pos[1] * 50 pygame.draw.rect(win, (255, 255, 0), (x, y, 50, 50)) drawPieces(win, board, flip) if LOAD[3] and side == player: showAvailMoves(win, side, board, pos, flags, flip) pygame.display.update()