<jupyter_start><jupyter_text>制希尔伯特曲线<jupyter_code>import turtle

def hilbert(level, angle, t, size = 10):
    """
    绘制希尔伯特曲线
    :param level: 层数
    :param angle: 角度
    :param t: turtle实例
    :param size: 步长
    :return: 
    """
    if level == 0:
        return

    t.color("Blue")
    t.speed(30)

    t.right(angle)
    hilbert(level - 1, -angle, t)
    t.forward(size)
    t.left(angle)
    hilbert(level - 1, angle, t)
    t.forward(size)
    hilbert(level - 1, angle, t)
    t.left(angle)
    t.forward(size)
    hilbert(level - 1, -angle, t)
    t.right(angle)


if __name__ == '__main__':
    TURTLE_SIZE =10
    t = turtle.Turtle()
    screen = turtle.Screen()
    t.penup()
    t.goto(TURTLE_SIZE/2 - screen.window_width()/2, screen.window_height()/2 - TURTLE_SIZE/2)
    t.pendown()

    hilbert(5,90,t)
    
    t.hideturtle()
    screen.exitonclick()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14794215795328142, 'fraction_numerical': 0.020022246941045607, 'mean_word_length': 2.515625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '472278', 'license': 'MIT', 'n_tokens_mistral': 413, 'n_tokens_neox': 399, 'n_words': 69, 'path': 'DataStructure/recursion_part8.ipynb', 'repo_name': 'lb971216008/Use-Python-to-Achieve', 'size': '899'}