• 元胞自动机( Cellular Automata)研究 (Python代码实现)


     👨‍🎓个人主页:研学社的博客 

    💥💥💞💞欢迎来到本博客❤️❤️💥💥

    🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

    ⛳️座右铭:行百里者,半于九十。

    📋📋📋本文目录如下:🎁🎁🎁

    目录

    💥1 概述

    📚2 运行结果

    🌈3 Python代码实现

    🎉4 参考文献


    💥1 概述

    元胞自动机(Cellular Automata)是20世纪50年代初由计算机之父冯·诺依曼(J.von Neumann)为了模拟生的系统所具有的自复制功能而提出来的。此后,史蒂芬沃尔夫勒姆(Stephen Woifram) 对无皑日4们北应1 IAH9以究,例如,他对一维初等元胞机全部256种规则所产生的模型进行了深入研究,并将元胞自动机分为平稳型、周期型、混沌型和复杂型4种类型。元胞自动机采用离散的空间布局和离散的时间间隔,将元胞分成有限种状态,元胞个体状态的演变仅与其当前状态以及其某个局部邻域的状态有关。

    📚2 运行结果

     部分代码:

    def get_random_color():
        return random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
    
    
    while True:
        clock.tick(1)
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            if event.type == KEYDOWN and event.key == K_SPACE:
                change_start = not change_start
    
        if change_start:
            for x in range(0, box_num):
                for y in range(0, box_num):
                    if boxs[x][y]['value'] == 0:
                        color = (255, 255, 255)
                    else:
                        color = (0, 0, 0)
                        # color = get_random_color()
                    flush_box(color,
                              pygame.Rect(
                                  boxs[x][y]['x'],
                                  boxs[x][y]['y'],
                                  boxs[x][y]['width'],
    def get_random_color():
        return random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
    
    
    while True:
        clock.tick(1)
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            if event.type == KEYDOWN and event.key == K_SPACE:
                change_start = not change_start
    
        if change_start:
            for x in range(0, box_num):
                for y in range(0, box_num):
                    if boxs[x][y]['value'] == 0:
                        color = (255, 255, 255)
                    else:
                        color = (0, 0, 0)
                        # color = get_random_color()
                    flush_box(color,
                              pygame.Rect(
                                  boxs[x][y]['x'],
                                  boxs[x][y]['y'],
                                  boxs[x][y]['width'],
    def get_random_color():
        return random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
    
    
    while True:
        clock.tick(1)
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            if event.type == KEYDOWN and event.key == K_SPACE:
                change_start = not change_start
    
        if change_start:
            for x in range(0, box_num):
                for y in range(0, box_num):
                    if boxs[x][y]['value'] == 0:
                        color = (255, 255, 255)
                    else:
                        color = (0, 0, 0)
                        # color = get_random_color()
                    flush_box(color,
                              pygame.Rect(
                                  boxs[x][y]['x'],
                                  boxs[x][y]['y'],
                                  boxs[x][y]['width'],

    🌈3 Python代码实现

    🎉4 参考文献

    部分理论来源于网络,如有侵权请联系删除。

    [1]党珊,蒋太刚,巫承军.基于元胞自动机方法的消防疏散仿真研究[J].现代电子技术,2022,45(21):131-134.DOI:10.16652/j.issn.1004-373x.2022.21.023. 

  • 相关阅读:
    易点易动采购管理模块:实现全生命周期管理,助力企业采购管理的高效运作
    Multiprocessing package - torch.multiprocessing
    A-Level经济真题每期一练(18)
    01. 汇编LED驱动实验
    反向输出一个三位数
    JVM启动参数大全
    《动手学深度学习 Pytorch版》 5.1 层和块
    五、分类算法 总结
    太空射击第13课: 爆炸效果
    Python对象序列化
  • 原文地址:https://blog.csdn.net/weixin_46039719/article/details/128193137