Exemplo n.º 1
0
    screen.fill((255, 255, 255))

    #Variables needed to create black Sudoku Grid
    width = 75
    height = 75
    margin = 7
    black = (0, 0, 0)
    orange = (255, 165, 0)
    green = (0, 255, 0)
    red = (200, 0, 0)
    light_green = (0, 200, 0)
    x = 0
    y = 0
    font = pygame.font.SysFont('Arial', 35)

    sudoku_Class = Sudoku.Sodoku()
    partially_Filled_Board = sudoku_Class.get_Board()

    #Creating Sudoku Grid
    for i in range(0, 9):
        for j in range(0, 9):
            pygame.draw.rect(screen, black, [x, y, width, height], 12)

            if (partially_Filled_Board[i][j] != 0):
                message = font.render(str(partially_Filled_Board[i][j]), True,
                                      black)
                place = message.get_rect(center=(math.floor(x + width / 2),
                                                 math.floor(y + height / 2)))
                screen.blit(message, place)

            x += 75