正文

不明玩意儿2007-09-17 18:17:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/19880128/29472.html

分享到:

/* Note:Your choice is C IDE */#include "stdio.h"#include "math.h"#include "graphics.h"#include "dos.h"#include "bios.h"#include "stdlib.h"void main(){   int shot(int *a,int *b);    int speed(int x,int y,int x1,int y1);         char a[2]="\14",b[2]="\13",k2,k3; int c[11][7],d[11][7],vx[11][7],vy[11][7],con[11][7],k,k1,n=310,m=450; int tim=0,t=0,t1=6,z,n1,m1,ju=0;    int gd=DETECT,gm;    initgraph(&gd,&gm,"");    cleardevice();    settextstyle(0,0,2);    for(k=1;k<=10;k++)    for(k1=1;k1<=6;k1++)    {c[k][k1]=120+k*30;     d[k][k1]=20*k1;     vx[k][k1]=0;     vy[k][k1]=0;     con[k][k1]=0;     outtextxy(c[k][k1],d[k][k1],a);}    outtextxy(n,m,b);                          /*print the feild*/    getch();    for(;;)    {   ju=0;     n1=0;     tim++;     if(tim%80==0&&t1>=1)                    /*get the new bee*/     {t++;      if(con[t][t1]==0)      con[t][t1]=1;     }     if(t==10)     {t=0;t1--;}     am:for(k=1;k<=10;k++)     for(k1=1;k1<=6;k1++)     {      if(con[k][k1]==1)      {setcolor(0);        ju++;                         outtextxy(c[k][k1],d[k][k1],a);       if(d[k][k1]>=440)       {con[k][k1]=3;        ju--;        goto am;}       z=speed(c[k][k1],d[k][k1],n,m);       if(z<=15)            {setcolor(2);                      /*judge */                                         outtextxy(300,200,"shit");                         exit(1);}       vx[k][k1]=3*(c[k][k1]-n)/(z+1);    /*bee move*/      vy[k][k1]=3*(d[k][k1]-m)/(z+1);      c[k][k1]-=vx[k][k1];      d[k][k1]=d[k][k1]-vy[k][k1]+1;      setcolor(4);      outtextxy(c[k][k1],d[k][k1],a);      delay(5000);}}     if(tim%80==0)     if(ju==0)     exit(1);     k2=bioskey(1);                          /*keyboard contrul*/     if(k2!=0)     {k3=bioskey(0);      if(k3=='s'&&n>-20)      n1=-30;      if(k3=='l'&&n<600)      n1=30;}     setcolor(0);                             /*plane move*/      outtextxy(n,m,b);     n+=n1;     setcolor(2);     outtextxy(n,m,b);    }    }    /**/    int speed(int x,int y,int x1,int y1)    {     int z;     z=sqrt(abs((x-x1)*(x-x1)+(y-y1)*(y-y1)));     return z;     }

阅读(1394) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册