俄罗斯方块和贪吃蛇的C语言源程序.doc.docVIP

  • 4
  • 0
  • 约1.97万字
  • 约 27页
  • 2018-04-02 发布于湖北
  • 举报

俄罗斯方块和贪吃蛇的C语言源程序.doc.doc

俄罗斯方块和贪吃蛇的C语言源程序.doc

俄罗斯方块和贪吃蛇的C语言源程序 刚刚在群里听某些人说发上来可以拿奖金,于是我就发了~~~ 脸皮比较厚,大家见笑了~~ 虽然写的没有网上现成的那些好,但是这些100%是自己写的, 因为是写着玩的,所以就没有优化,也没有用什么复杂的技术, 但是这样的程序反而更容易看懂~ 编译环境是古老的turboc2.0,喜欢dos编程的朋友可以拿来消遣一下。 嘿嘿嘿嘿~ 附件是源文件和编译好的文件~ 俄罗斯方块 ------------------------- #include graphics.h #include stdio.h #include stdlib.h #include string.h #include bios.h #include time.h #include stdlib.h #include dos.h #define VK_ESC 0x11b #define VK_UP 0x4800 #define VK_DOWN 0x5000 #define VK_LEFT 0x4b00 #define VK_RIGHT 0x4d00 #define TIMER 0x1c #define SEC(N) N*18.8 typedef box[4][4]; FILE *fp; int space[26][18]; box bar1[2],bar2[1],bar3[4],bar4[2],bar5[2],bar6[4],bar7[4]; float count; int nexttype,nextvalue; int overed; int score,higher; char scoretext[50],highscore[50]; struct { int i; int j; box *t; int v; } cur_bar; void SetScreen(); void SetValue(); void Draw(); void SetBox(); void DrawBack(); void DrawBox(); void CreateBar(int i,int j,box *type,int value); void SetTimer(void interrupt (*theProc)()); void KillTimer(); void interrupt Proc(); void interrupt (*oldtimer)(); void OneStep(); int IsFall(); void CheckState(); void ClearLine(int Line); void MoveLeft(); void MoveRight(); void ChangeBar(); void ShowScore(); void ShowNextWindow(); void ReadHigh(); void WriteHigh(); int main() { int key; count=0; overed=0; score=0; ReadHigh(); randomize(); oldtimer=getvect(TIMER); SetBox(); SetScreen(); DrawBack(); Draw(); CreateBar(0,5,bar3,2); nexttype=random(7)+1; nextvalue=0; ShowNextWindow(); SetTimer(Proc); setcolor(BLUE); outtextxy(520,60,YOUR SCORE); outtextxy(520,80,0); outtextxy(520,100,HIGH SCORE); outtextxy(520,120,highscore); while(1) { if(countSEC(0.5)) { count=0; OneStep(); } if(bioskey(1)) { key=bioskey(0); if(key==VK_ESC) { break; } if(!overed) switch(key) { case VK_LEFT: MoveLeft(); break; case VK_RIGHT: MoveRight(); break; case VK_UP: ChangeBar(); break; case VK_DOWN: OneStep(); CheckState(); break; }

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档