琢磨了一下“坦克大战”

早期红白机上的坦克大战显然是单线程的,有一个致命的BUG:
一坦克发射炮弹,子弹飞行时,下一发子弹无法发出,除非子弹碰壁或击中目标。目标很远时,下一发要等很久,很近时,发射时间间隔很短。
显然此处子弹飞行程序是个循环,
TANK调用shoot(),shoot()循环,直至Hit==TRUE才返回
如果是多线程的,子弹发射间隔时间应该是相等的。
Advertisements

一条评论 (+add yours?)

  1. bin
    4月 20, 2008 @ 21:17:49

    怪不得子弹总是慢的不得了
     

    回复

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: