def show_moves(sb, piece, square): # shade green all the positions for this piece from this square squares = [] for m in board.legal_moves: if m.from_square == square: squares.append(m.to_square) print('squares={}'.format(squares)) for s in squares: sr = int((s - 1) / 8) sx = (s - 1) - int(s / 8) * 8 + 1 sy = 7 - sr print('s={} sy={} sx={}'.format(s, sy, sx)) print('sb at sy,sx={}'.format(sb[sy, sx])) sb[sy, sx] = Color.from_rgb(sb[sy, sx][0], 0.3, sb[sy, sx][2])
def test_color_from_rgb(): verify_color(Color.from_rgb(0, 0, 0), (0.0, 0.0, 0.0)) verify_color(Color.from_rgb(1, 1, 1), (1.0, 1.0, 1.0)) verify_color(Color.from_rgb(2, 1, 1), (1.0, 1.0, 1.0)) verify_color(Color.from_rgb(1, -1, 1), (1.0, 0.0, 1.0)) verify_color(Color.from_rgb(r=1, g=0, b=0), (1.0, 0.0, 0.0))