snakesman -...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 //80*48 #include<fstream.h> #include<stdlib.h> #include<process.h> #include<stdio.h> #include<time.h> #include<dos.h> #include<string.h> #include<graphics.h> #include<bios.h> #include<conio.h> #include<iomanip.h> unsigned key int len=0,count=0,foodtype=0,d,m,food_flag=0,j=0,i=0,display_count=10, hscore_pos=0,x_index=0,y_index=0,mx,my,maze=1,speed=100 long score=0,ti_elap=0,ti_rem=15,tot_ti=15,ti_init char *main_menu[]={{"1. Play"},{"2. Options"},{"3. Instruction"}, {"4. Hi-Score"},{"5. Exit"}} char *game_menu[]={{"1. Mazes"},{"2. Level"},{"3. Back to Main menu"}} char *maze_menu[]={{"1. Open"},{"2. Box"},{"3. Twisted"}, {"4. Return to Main menu"}} char *level_menu[]={{"1. Beginner"},{"2. Intermediate"},{"3. Expert"}, {"4. Return to Main menu"}} char *m_m[]={"P","O","I","H","E"} char *g_m[]={"M","L","B"} char *mm[]={"O","B","T","R"} char *lm[]={"B","I","E","R"} int maze3_x[][14]={{2,3,4,5,6,7,8,9,10,11,12,13,14,15}, {25}, {30}, {37,38,39,40,41,42,43,44,45,46,47,48,49,50}} int maze3_y[][14]={{30}, {2,3,4,5,6,7,8,9,10,11,12,13,14,15}, {27,28,29,30,31,32,33,34,35,36,37,38,39,40}, {20}} void showfood() void end() void show_game_menu() void show_main_menu() enum{UP=1,RIGHT=2,DOWN=3,LEFT=4}DIRECTION,Pre_Dir struct { unsigned x:7 unsigned y:7 }coordinate[1000],tail,head,food
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 inline void initialise() { d=DETECT cleardevice() mx=getmaxx() my=getmaxy() } void RESET() { len=count=foodtype=food_flag=i=j=hscore_pos=x_index=y_index=0 display_count=10, speed=100 score=ti_elap=0 ti_rem=tot_ti=15 head.x=head.y=tail.x=tail.y=food.x=food.y=0 for(i=0 i<1000 i++) coordinate[i].x=coordinate[i].y=0 } void showoff_food() { gotoxy(food.x,food.y) cout<<" " food.x=food.y=0 showfood() } int showfoodtimer(int fo_fl) { if(fo_fl==1) { if(ti_rem<=0) { showoff_food() ti_rem=15 food_flag=0 } else { ti_elap=((biostime(0,0L)-ti_init)/(speed/16)) ti_rem=(tot_ti-(ti_elap)) gotoxy(7,46) if(ti_rem<10) cout<<"0"<<ti_rem else cout<<ti_rem } } else {
Background image of page 2
Sheet1 Page 3 gotoxy(7,46) cout<<" " } return 0 } void showfood() { int flag=0 re: food.x=random(49)+2 food.y=random(39)+2 for(i=0 i<len i++) { goto re } if(maze==3) { for(i=0 i<4 i++) { for(j=0 j<14 j++) { if(food.x==maze3_x[i][j]) flag=1 } for(j=0 j<14 j++) { goto re } } } gotoxy(food.x,food.y) textcolor(RED) cprintf("@") } void showbigfood() { re1: food.x=random(49)+2 food.y=random(39)+2 for(int j=0 j<len j++) { goto re1 } textcolor(YELLOW) gotoxy(food.x,food.y) cprintf("é") }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Page1 / 15

snakesman -...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online