Beruflich Dokumente
Kultur Dokumente
CSE-101
TOPIC-PUZZLE GAME
SUBMITTED BY: PUNEET GOYAL Roll no. RD1902A26 Regd no. -10900599 Course B.TECH CSE
ACKNOWLEGDEMENT
I AM VERY GRATEFUL TO MY TEACHER WHO GUIDED ME FOR THIS PROJECT. I AM ALSO THANKFUL TO MY FRIENDS WHO HELPED IN COLLECTING THE MATERIALS FOR THE PROJECT.
MOREOVER, I AM ALSO THANKFUL TO THE UNIVERSITY MANAGEMENT WHICH ENABLED US THE FACILITY OF LIBRARY AND INTERNET FOR COLLECTING MORE INFORMATION ON THE TOPIC.
Preface
Programs written in C are efficient and fast. This is due to its variety of data types and powerful operators. It is many times faster than BASIC.C is highly portable. This means that c programs written for one computer can be run on another with little or no modification. Another importance feature of c is its ability to extend itself. A c program is basically a collection of functions that are supported by the c library. We can continuously add our own functions to library. With the availability of a large number of functions, the program tasks become simple. PUZZLE GAME helps to sharpen the mind. In this section we Study about how we develop software and what is their programming to make mind fresh by playing game. This project contain what is the system require to develop this software, their analysis, source code, their output and their future aspects.
Contents
1. Introduction
2.
System requirements
INTRODUCTION
PUZZLE GAME is a program which helps to sharpen the students mind. In this given project I have used many functions of c language. It is a type of time pass game but it uses so much of your brain. It need full concentration to complete. It can also be used to check the mental level. It is a type of game which can be played by the person who have just numbers knowledge, no other computer knowledge or any other subject knowledge is required. Having appeared in army navy military forces job exam we often find these types of games to solve in a limited given time. It helps to rise and improve the creativeness and quickness. It is a task of sharp minded person who may be tiny tot or illiterate. It can not be told that each one can do. It has great mathematical value. This project is a project for fun and to sharp onesmind.
With the help of this integrated software, the works are done by simply pressing the arrow keys. So it is very helpful for us. Hope you enjoy it.
System requirements
Processor Platform RAM Hard disk Mouse Keyboard CD Drive CORE 2DUOL window xp professional 256MB 80GB optical multimedia 52.32.52x16x
Requirement Analysis
In this program core 2DUOL processor has been used. Window xp professional is used. 256MB. RAM has been used which is the minimum requirement of memory for running a c software. Hard disk is 80 GB. An optical mouse has been used. The keyboard is of multimedia type.
SOURCE CODE
# define UP_ARROW 72 # define DOWN_ARROW 80 # define LEFT_ARROW 75 # define RIGHT_ARROW 77 # define ESC 1
*/
/* Scan code of down arrow */ /* Scan code of left arrow */ /* Scan code of right arrow */ /* Scan code of escape key */
int r=3;
*/
/* Prototype Declaration */
void Display(void); void Boxes(void); void Game(void); void Esc(void); int Getkey(void); void Install(void); void Rules(void); void Win(void);
/* Prototype of display function */ /* Prototype of boxes function */ /* Prototype of game function /* Prototype of escape function */ /* Prototype of getkey function */ /* Prototype of install function */ /* Prototype of rules function */ /* Prototype of win function */ */
void Game(void) { int ch; int temp; Boxes(); Display(); while(1) { ch=Getkey(); switch(ch)
{ case DOWN_ARROW :
case UP_ARROW :
case LEFT_ARROW :
if(c==3) { printf("a"); break; } temp=a[r][c]; a[r][c]=a[r][c+1]; a[r][c+1]=temp; c++; moves++; Display(); break;
case RIGHT_ARROW :
if(c==0)
10
case ESC :
Esc(); break;
default : break; } } }
/* Escape Function */
void Esc(void)
11
/* Display Function */
void Display(void) { int r1=9,c1=30; int i,j; textcolor(MAGENTA); for(i=0;i<4;i++) { for(j=0;j<4;j++) { if(a[i][j]==0) { gotoxy(c1,r1); printf(" "); } else
12
void Boxes(void) { int i,j; gotoxy(26,3); textcolor(MAGENTA); printf("GAME OF THE CENTURY"); textcolor(YELLOW); for(i=8;i<=16;i=i+2) { for(j=29;j<=41;j++) { gotoxy(j,i); printf("%c",196);
13
} } for(i=29;i<=42;i=i+3) { for(j=8;j<=16;j++) { gotoxy(i,j); printf("%c",179); } } gotoxy(29,8); printf("%c",218); gotoxy(29,16); printf("%c",192); gotoxy(41,8); printf("%c",191); gotoxy(41,16); printf("%c",217); for(i=32;i<=38;i=i+3) { gotoxy(i,8); printf("%c",194); } for(i=32;i<=38;i=i+3) { gotoxy(i,16);
14
printf("%c",193); } for(i=10;i<=14;i=i+2) { for(j=32;j<=38;j=j+3) { gotoxy(j,i); printf("%c",197); } } for(i=10;i<=14;i=i+2) { gotoxy(29,i); printf("%c",195); } for(i=10;i<=14;i=i+2) { gotoxy(41,i); printf("%c",180); } }
int Getkey(void) {
15
void Install(void) { int i,j; int c=11,r=19; int time=0; gotoxy(32,13); textcolor(BROWN); printf("INSTALLING MENU"); textcolor(YELLOW); gotoxy(1,19); printf("Installing"); for(i=20;i<=22;i=i+2) { for(j=1;j<=80;j++) { gotoxy(j,i); printf("%c",196);
16
} } for(i=20;i<=22;i++) { gotoxy(1,i); printf("%c",179); } for(i=20;i<=22;i++) { gotoxy(80,i); printf("%c",179); } gotoxy(1,20); printf("%c",218); gotoxy(1,22); printf("%c",192); gotoxy(80,20); printf("%c",191); gotoxy(80,22); printf("%c",217); for(i=2;i<=79;i++) { gotoxy(i,21); printf("%c",176); } for(i=2;i<=79;i++)
17
{ gotoxy(i,21); delay(500); textcolor(BLUE); printf("%c",219); gotoxy(67,19); printf(" "); if(c==15) { for(j=11;j<=15;j++) { gotoxy(j,19); printf(" "); } c=11; } gotoxy(c,r); textcolor(YELLOW); printf("."); c++; gotoxy(67,19); textcolor(YELLOW); printf("%d% Completed",time); if(time<=60) { time++;
18
void Rules(void) { int i; textcolor(LIGHTCYAN); gotoxy(39,5); printf("RULES"); textcolor(GREEN); gotoxy(18,7); printf("1. Your aim is to arrange numbers in ascending order"); gotoxy(18,9); printf("2. The player with minimum no. of moves wins the game"); textcolor(LIGHTGRAY); for(i=17;i<=71;i++)
19
{ gotoxy(i,6); printf("%c",196); } for(i=17;i<=71;i++) { gotoxy(i,10); printf("%c",196); } for(i=6;i<=10;i++) { gotoxy(17,i); printf("%c",179); } for(i=6;i<=10;i++) { gotoxy(71,i); printf("%c",179); } gotoxy(17,6); printf("%c",218); gotoxy(17,10); printf("%c",192); gotoxy(71,6); printf("%c",191); gotoxy(71,10);
20
printf("%c",217); }
void Win(void) { int i,j,pos; int flag=1; int arr[20]; for(i=0;i<4;i++) { for(j=0;j<4;j++) { pos=i*4+j; arr[pos]=a[i][j]; } } for(i=0;i<pos;i++) { if(arr[i]>arr[i+1]) { flag=0; break; } }
21
void main(void) { clrscr(); Install(); sleep(1); clrscr(); Rules(); getch(); clrscr(); Game(); getch(); }
OUTPUT
GAME OF THE CENTURY 4 6 1 2 1
22
2 8 3 7 5 1 1
1 0 1 3 1 5
1 4 9
MERITS:1. It will be in great demand in the nearest future. 2. It helps in the competitive exams. 3. It helps to sharpen the mind. 4. It develops the creative power. 5. It is another example of technological advancement. 6.It helps to arouse interest of students in mathemematics.
23
DEMERITS:1. It is time consuming. 2. Some times it frustrates the person when he can not complete it in a long time. 3. It is not a cup of tea for all.
4. Its scope is very limited.
Bibliography
1. Programming with ANSI and Turbo C by Kamthane
2. SAD (system analysis and designing)
24