V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Hawstein
V2EX  ›  Python

如何用Python写一个贪吃蛇AI

  •  
  •   Hawstein ·
    Hawstein · Apr 16, 2013 · 6118 views
    This topic created in 4771 days ago, the information mentioned may be changed or developed.
    不久前在网上看到一张贪吃蛇的动态图片,蛇最后把所有的食物吃完并占满整个运动空间。
    觉得挺好玩的,于是用Python写了一个。

    Blog:

    http://hawstein.com/posts/snake-ai.html

    Code:

    https://github.com/Hawstein/snake-ai

    PS.
    创建新主题里貌似没有发现可以上传图片的地方?有人知道的话告知一下,谢谢。
    8 replies    1970-01-01 08:00:00 +08:00
    laoyu
        1
    laoyu  
       Apr 16, 2013
    很有意思。
    sivacohan
        2
    sivacohan  
    PRO
       Apr 16, 2013
    发图片。在v2ex搜索围脖是个好图床。
    binux
        3
    binux  
       Apr 16, 2013
    你这问题想复杂了,保证有解的方法就是,保证一条经过食物到尾巴的路径(如果当前无法经过食物,先向尾巴移动)
    swulling
        4
    swulling  
       Apr 16, 2013
    @binux 这个解有意思,而且比较好实现
    zhangxiao
        5
    zhangxiao  
       Apr 16, 2013
    大赞
    mengyang
        6
    mengyang  
       Apr 17, 2013
    @binux 这个方法有意思啊!
    fkccp
        7
    fkccp  
       Apr 17, 2013
    "由于是静态博客, 所以如果下面的动态图片浏览效果不佳的话,可以右键保存下来查看"

    楼主这句话吓到我了
    holmesabc
        8
    holmesabc  
       Apr 17, 2013
    一说到贪吃蛇 我就是想到微博上那张NB的图。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3067 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 79ms · UTC 12:57 · PVG 20:57 · LAX 05:57 · JFK 08:57
    ♥ Do have faith in what you're doing.