写了一个命令行版的 2048 - V2EX
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
200

写了一个命令行版的 2048

  •  
  •   200 Mar 15, 2014 5580 views
    This topic created in 4428 days ago, the information mentioned may be changed or developed.
    原版: http://gabrielecirulli.github.io/2048/

    可以考虑跑些搜索 看看有没有好的策略啥的 (_)

    7 replies    2014-05-01 09:02:07 +08:00
    ericls
        1
    ericls  
       Mar 15, 2014
    这游戏一不小心玩儿了3个小时 我LGQ
    yangff
        2
    yangff  
       Mar 15, 2014 via Android
    早就有ai了。。
    jprovim
        3
    jprovim  
       Mar 16, 2014
    挑毛病,使用AWSD操作,而且需要入Enter。
    是很好的。
    patricksong1993
        4
    patricksong1993  
       Mar 16, 2014
    2048升级版4096
    自带超快机器人
    http://patricksong1993.github.io/4096/
    rex
        5
    rex  
       Mar 18, 2014
    @jprovim @200
    可以使用

    ```
    def getkey():
    "get key press without Enter"

    import termios, sys, os

    fd = sys.stdin.fileno()
    old = termios.tcgetattr(fd)
    new = termios.tcgetattr(fd)
    new[3] = new[3] & ~TERMIOS.ICANON & ~TERMIOS.ECHO
    new[6][TERMIOS.VMIN] = 1
    new[6][TERMIOS.VTIME] = 0
    termios.tcsetattr(fd, TERMIOS.TCSANOW, new)
    c = None
    try:
    c = os.read(fd, 1)
    finally:
    termios.tcsetattr(fd, TERMIOS.TCSAFLUSH, old)
    return c
    ```

    代替sys.stdin.readline().strip().lower(),这样就不必 enter 了。
    rex
        6
    rex  
       Mar 18, 2014
    排版乱了。
    贴个链接试试

    https://gist.github.com/zhasm/9614482
    jprovim
        7
    jprovim  
       May 1, 2014