如何让他可以运行阿。O_O_BOT 写了:看了那个俄罗斯方块弄得
bash 做了个贪吃蛇
- dengroj
- 帖子: 39
- 注册时间: 2009-06-06 8:57
- dieyushi
- 帖子: 87
- 注册时间: 2008-11-06 10:41
Re: bash 做了个贪吃蛇
dash的错tune 写了:执行不了??
当你眼泪忍不住要流出来的时候,睁大眼睛,千万别眨眼,你会看到世界由清晰变模糊的全过程,心会在你泪水落下的那一刻变得清澈明晰……
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: bash 做了个贪吃蛇
保持成文件 xyz
chmod +x xyz
./xyz
就可以了
chmod +x xyz
./xyz
就可以了
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
- guiwen1158
- 帖子: 1078
- 注册时间: 2008-05-11 11:10
- 来自: 深圳
- 联系:
Re: bash 做了个贪吃蛇
很佩服LZ,顶一个。
-
- 帖子: 3681
- 注册时间: 2008-05-03 23:42
Re: bash 做了个贪吃蛇
机器人怎么发帖的呢。
-
- 帖子: 3681
- 注册时间: 2008-05-03 23:42
Re: bash 做了个贪吃蛇
那个俄罗斯方块可以在 Mac OS X 的 bash 底下运行,这个蛇却出错 

- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: bash 做了个贪吃蛇
什么错呢?
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系:
-
- 帖子: 198
- 注册时间: 2007-11-10 8:57
- blueskyevdy
- 帖子: 34
- 注册时间: 2009-08-09 19:45
- blueskyevdy
- 帖子: 34
- 注册时间: 2009-08-09 19:45
-
- 帖子: 3681
- 注册时间: 2008-05-03 23:42
Re: bash 做了个贪吃蛇
警告信息后倒是可以开始玩,蛇撞墙好像不会死:)O_O_BOT 写了:什么错呢?
按 q 退出后,蛇继续在终端里欢快游走

我录制了一段截屏,在这里 http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... screen.mov
bash -x ./snake.sh 输出:
代码: 全选
billbear-MacBook:~ billbear$ bash -x ./snake.sh
+ game_with=15
+ game_height=25
+ game_top=2
+ game_left=10
+ game_no_wall=1
+ game_id=0
+ game_sig=0
+ game_start=0
+ sig_up=25
+ sig_left=26
+ sig_right=27
+ sig_down=28
+ sig_exit=32
+ dirt_up=0
+ dirt_down=1
+ dirt_left=2
+ dirt_right=3
+ '[' '' == game ']'
+ key_rountine 86093
+ game_pid=86093
+ bash ./snake.sh game
++ stty -g
+ tty=gfmt1:cflag=4b00:iflag=6b02:lflag=200005cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
+ echo -ne '\033[?25l'
+ trap 'key_exit;' INT TERM
+ trap 'key_exit;' 32
./snake.sh: line 292: trap: 32: invalid signal specification
+ local key keys sig
+ local ESC
++ echo -ne '\033'
+ ESC=$'\E'
+ keys=(0 0 0)
+ :
+ sig=0
+ read -s -n 1 key
==================================
|| ||
|| ||
||[]./snake.sh: line 245: trap: 32: invalid signal specification
++ key_exit ||
++ stty gfmt1:cflag=4b00:iflag=6b02:lflag=200005cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
++ echo -ne '\033[?25h' ||
++ kill -32 86093 || Score
./snake.sh: line 282: kill: 32: invalid signal specification
++ clear || ||
|| || Level
|| [] || 0
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
==================================
++ exit
billbear-MacBook:~ billbear$
- mickeywaley
- 帖子: 1427
- 注册时间: 2009-03-19 9:19
- 系统: ubuntu
- 来自: 江苏
- 联系:
Re: bash 做了个贪吃蛇

- blog:http://lizhenglin.com备份的,原站加www.
- OS:ubuntu:9.04
- Google Talk:mickeywaley#gmail.com
- Twitter:@mickeywaley
- Google Voice:1-520-226-8130
- Ubuntu 9.10 (Karmic Koala) 安装配置相关教程 http://docs.google.com/View?id=ddqsjgzx_747f25h8pcb
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: bash 做了个贪吃蛇
因为有一个sign 是关联到窗口改变的 所以会这样blueskyevdy 写了:有个BUG, 执行后, 如果改变窗口大小会出现异常情况。
运行期间不要改变窗口大小
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: bash 做了个贪吃蛇
苹果界面不错billbear 写了:警告信息后倒是可以开始玩,蛇撞墙好像不会死:)O_O_BOT 写了:什么错呢?
按 q 退出后,蛇继续在终端里欢快游走
我录制了一段截屏,在这里 http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... screen.mov
bash -x ./snake.sh 输出:
可以尝试
更改这里
game_no_wall=0
#Signal
sig_up=25
sig_left=26
sig_right=27
sig_down=28
sig_exit=30
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]