Add to Favorites    Make Home Page 2397 Online  
 Language Categories  
 Our Services  

Home » Pascal Home » Pascal Projects Home » Maze Game Project In Pascal

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Maze Game Project In Pascal
Author Mahmood
Author Email m_matloobi_2010 [at] yahoo.com
Description
Category Pascal » Pascal Projects
Hits 392990
Code Select and Copy the Code
Program Mazefinal; uses crt; type str= string[1]; mazear= array[1..20, 1..60] of char; var x, y, col, row, count: integer; maze: mazear; pick, again, choice, movement: char; Procedure opening; {opening screen and title} begin textcolor(10); writeln; writeln(' ????????????????????????????????????????????????????????? '); writeln(' ? ? '); writeln(' ? ?? ?? ?????????? ?????????? ?????????? ? '); writeln(' ? ??? ??? ?? ?? ?? ?? ? '); writeln(' ? ???? ???? ?? ?? ?? ?? ? '); writeln(' ? ?? ?? ?? ?? ?? ?? ?? ?? ? '); writeln(' ? ?? ???? ?? ?????????? ?? ????????? ? '); writeln(' ? ?? ?? ?? ?? ?? ?? ?? ? '); writeln(' ? ?? ?? ?? ?? ??? ?? ? '); writeln(' ? ?? ?? ?? ?? ?????????? ?????????? ? '); writeln(' ? ? '); writeln(' ? ?? ?? ?????????? ?? ?? ? '); writeln(' ? ??? ??? ?? ?? ??? ?? ? '); writeln(' ? ???? ???? ?? ?? ???? ?? ? '); writeln(' ? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? '); writeln(' ? ?? ???? ?? ?????????? ?? ?? ?? ? '); writeln(' ? ?? ?? ?? ?? ?? ?? ???? ? '); writeln(' ? ?? ?? ?? ?? ?? ??? ? '); writeln(' ? ?? ?? ?? ?? ?? ?? ? '); writeln(' ? ? '); writeln(' ????????????????????????????????????????????????????????? '); writeln; textbackground(black); gotoxy(10,23); textcolor(15); writeln(' Program FREE for Distribution'); gotoxy(10,24); writeln(' For Educational Purposes '); gotoxy(40,24); textcolor(10+blink); write(' Press enter to begin. '); readln; textcolor(white); end; Procedure Opening2(var choice: char); Procedure Right(var choice:char); Function Valid(var choice: char): boolean; begin valid:=false; case choice of '1': valid:=true; '2': valid:=true; '3': valid:=true; '4': valid:=true; '5': valid:=true; '6': valid:=true; end;{case} end; begin while not valid(choice) do begin gotoxy(8,19); write(' '); gotoxy(8,19); write('Please enter a valid menu option: '); readln(choice); end; end; begin clrscr; gotoxy(8,2); writeln('Directions: Move the man in the maze using the keypad.'); gotoxy(8,3); writeln(' 2:down, 8:up, 4:left, 6:right'); gotoxy(8,8); textcolor(lightmagenta); writeln('Mazes,(1-5): '); writeln; gotoxy(8,10); textcolor(lightgreen); writeln('1) Easiest '); gotoxy(8,11); writeln('2) Easy '); gotoxy(8,12); writeln('3) Medium '); gotoxy(8,13); writeln('4) Hard '); gotoxy(8,14); writeln('5) Hardest '); gotoxy(8,15); writeln('6) Impossible '); gotoxy(8,18); textcolor(white); write('Enter the number of the maze you would like to play: '); readln(choice); Right(choice); end; Procedure sixlaby(var maze: mazear; var col, row: integer); var dfile: text; begin row := 0; assign(dfile, 'f:projectsmazemaze6.txt'); reset(dfile); while not eof(dfile) do begin row := row + 1; col := 0; while not eoln(dfile) do begin col := col + 1; read(dfile, maze[row, col]); end;{x} readln(dfile); end; close(dfile); end;{procedure} Procedure fivelaby(var maze: mazear; var col, row: integer); var dfile: text; begin row := 0; assign(dfile, 'f:projectsmazemaze5.txt'); reset(dfile); while not eof(dfile) do begin row := row + 1; col := 0; while not eoln(dfile) do begin col := col + 1; read(dfile, maze[row, col]); end;{x} readln(dfile); end; close(dfile); end;{procedure} Procedure fourlaby(var maze: mazear; var col, row: integer); var dfile: text; begin row:=0; assign(dfile, 'f:projectsmazemaze4.txt'); reset(dfile); while not eof(dfile) do begin row:=row+1; col:=0; while not eoln(dfile) do begin col:=col+1; read(dfile, maze[row, col]); end;{y} readln(dfile); end;{x} close(dfile); end;{procedure} Procedure threelaby(var maze: mazear; var col, row: integer); var dfile: text; begin row:=0; assign(dfile, 'f:projectsmazemaze3.txt'); reset(dfile); while not eof(dfile) do begin row:=row+1; col:=0; while not eoln(dfile) do begin col:=col+1; read(dfile, maze[row, col]); end;{y} readln(dfile); write(row,col); end;{x} close(dfile); end;{procedure} Procedure twolaby(var maze: mazear; var col, row: integer); var dfile: text; begin row:=0; assign(dfile, 'f:projectsmazemaze2.txt'); reset(dfile); while not eof(dfile) do begin row:=row+1; col:=0; while not eoln(dfile) do begin col:=col+1; read(dfile, maze[row, col]); end;{y} readln(dfile); end;{x} close(dfile); end;{procedure} Procedure onelaby(var maze: mazear; var col, row: integer); var dfile: text; begin row := 0; assign(dfile, 'f:projectsmazemaze1.txt'); reset(dfile); while not eof(dfile) do begin row := row + 1; col := 0; while not eoln(dfile) do begin col := col + 1; read(dfile, maze[row, col]); end;{x} readln(dfile); end; close(dfile); end;{procedure} Procedure display(var maze:mazear; col, row: integer); var x,y: integer; begin writeln; textcolor(yellow); for x:=1 to row do begin write(' '); for y:=1 to col do begin write(maze[x,y]); end;{y} writeln; end;{x} end;{procedure} Procedure start(var maze: mazear; col, row: integer); begin gotoxy(col+5,row); textcolor(11); write(''); textcolor(white); end;{procedure} Procedure Moveman2(var maze: mazear; var row, col, x, y: integer; var movement: char); Function checkmove(var movement: char): boolean; begin checkmove:=false; case movement of '2': checkmove:= true; '4': checkmove:= true; '6': checkmove:= true; '8': checkmove:= true; 's': checkmove:= true; end;{case} end; Procedure GetMove(var movement: char); begin gotoxy(1,22); write(' '); gotoxy(1,22); write('Use the key pad to move! (Press "s" to stop at anytime.)'); movement:=readkey; while not checkmove(movement) do begin gotoxy(1,22); write(' '); gotoxy(1,22); write('Invalid Move! Please try again.'); movement:=readkey; end; end; begin getmove(movement); end; Function hit(var maze: mazear; var x,y: integer; var movement: char): boolean; var x1, y1: integer; begin x1:=x; y1:=y; case movement of '2': y1:=y1+1; '4': x1:=x1-1; '6': x1:=x1+1; '8': y1:=y1-1; end;{case} hit:= false; {case maze[y1-1, x1-7] of '*': hit:= true; '|': hit:= true; '_': hit:= true; '-': hit:= true; '?': hit:= true; '?': hit:= true; '?': hit:= true; '?': hit:= true; '?': hit:= true; '?': hit:= true; end; {case} if maze[y1-1, x1-7] <> ' ' then if maze[y1-1, x1-7]<> 'F' then if maze[y1-1, x1-7]<> 'S' then hit:=true; end; Procedure Move(var movement:char; var x, y: integer); begin gotoxy(x,y); write(' '); case movement of '2': y:=y+1; '4': x:=x-1; '6': x:=x+1; '8': y:=y-1; end;{case} gotoxy(x,y); textcolor(11); write(''); textcolor(white); end; Function KickOut(var maze: mazear; var x,y: integer; var movement: char): boolean; begin kickout:=false; if maze[y-1,x-7]= 'F' then kickout:= true; if movement= 's' then kickout:= true; end; Procedure credit(var again: char); Function valid_ans(var again: char): boolean; begin valid_ans:=false; case again of 'y': valid_ans:=true; 'n': valid_ans:=true; end;{case} end; begin clrscr; writeln; textcolor(10); writeln('This program was written and designed by: '); textcolor(15); writeln(' Faraz Younus Bandukda'); writeln(' Farazoftine SOftware Products'); writeln; textcolor(11); writeln('A Quality Game By Farazoftine Software Products'); writeln; textcolor(15); writeln('Year: 2001 '); writeln; writeln('Designed using Turbo Pascal 7.0'); writeln; textcolor(12); writeln('Solve the mazes............. if you can !'); writeln; writeln; writeln; writeln; writeln; writeln; writeln('Peace to all and for all.'); textcolor(13); writeln; writeln(' THANX FOR PLAYING MAZE MAN! '); writeln(' Press "y" followed by ENTER to go back to '); write (' the starting screen, "n" to exit. '); textcolor(15); gotoxy(60,23); write('Choice: '); readln(again); while not valid_ans(again) do begin repeat gotoxy(10,24); write(' '); gotoxy(10,24); write('Please type a valid choice. '); readln(again); until valid_ans(again); end; end; Procedure Win(var count: integer); begin clrscr; textcolor(12+blink); gotoxy(1,5); writeln(' ?? ?? ?????? ?? ?? ?? ?? ???????? ????????'); writeln(' ?? ?? ?? ??? ?? ??? ?? ?? ?? ??'); writeln(' ?? ?? ?? ???? ?? ???? ?? ?? ?? ??'); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??'); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??'); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ????????'); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ??????? ????? '); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? '); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? '); writeln(' ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??'); writeln(' ?? ? ? ?? ?? ?? ???? ?? ???? ?? ?? ??'); writeln(' ?? ? ? ?? ?? ?? ??? ?? ??? ?? ?? ??'); writeln(' ??? ??? ?????? ?? ?? ?? ?? ???????? ?? ??'); gotoxy(2,22); textcolor(white); writeln(' You succesfully completed the maze in ', count, ' moves!'); gotoxy(2,23); write (' Please press enter to view the credits.'); readln; end; begin {main} clrscr; opening; again:='y'; while again='y' do begin clrscr; opening2(choice); {pick choice screen} case choice of {case statement} '1': onelaby(maze, col, row); {read 1st maze from text} '2': twolaby(maze, col, row); {read 2nd maze from text} '3': threelaby(maze, col, row); {read 3rd maze from text} '4': fourlaby(maze, col, row); {read 4th maze from text} '5': fivelaby(maze, col, row); {read 5th maze from text} '6': sixlaby(maze,col,row); end; clrscr; display(maze, col, row); {displays characters from text} start(maze,col,row); {where we start the man} y:=row; x:=col+5; count:=0; repeat {repeat loop when moving} moveman2(maze,row,col, x, y, movement); {how to move man} while hit(maze,x,y, movement) do {what happens when you hit a wall} begin moveman2(maze,row,col, x, y, movement); end; move(movement, x, y); count:=count+1; until kickout(maze, x, y, movement); {end maze when ever you want} if maze[y-1,x-7]= 'F' then begin win(count); {when "f" then end and win} end; credit(again); {credits page} end; end. -------------------------------------------------------------------------- Sample Maze Pattern - 1 -------------------------------------------------------------------------- ????�???�???????????????????????????????????????????????? ? F ? ? ??????????????????????????????????????? ? ? ? ? ? ? ? ? ? ? ? ????????????? ???????????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ????????????????????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??* VYOMW *?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ????????????? ? ? ? ? ? ? ? ? ? ? ? ? ??????? ? ? ? ? ? ? ? ? ????????????? ? ? ? ? ????? ? ? ? ??????� ? ? ? ? ? ??????????????? ? ? ????????????????? ? ? ? ? ? ? ? S ? ????????????????????????�???????�???????????????????????? -------------------------------------------------------------------------- Sample Maze Pattern - 2 -------------------------------------------------------------------------- ?????????????�?????????????�????????????????????????????? ? F ? ? ? �???????? ????????? ?????? ????????? ??? ???� ? ? ? ? ? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? ??? ? ?????????????? ?? ??? ????????� �?? ?????? ? ? ? ????? ? ? ? ? ? ? ? �?????? ????????????????? * FSP* ?????????????? ? ? ? ? ??????? ? ? ? ? ???? ? ? ? ? ? ? ? ? ? ?? ???? ?? ???? ??? ????????? ??� ? ??? ? ? ? ? ? ? ? ?????? ??? ? ? ? ???? ? ? ??? ??? ? ? ? ? ? ??????????? ? ? ? ??? ???? ??? ???? ? ? ? ?????????? ? ????????? ? ? ? ? S ? ????????????�?????????????�????????????�????????????????? -------------------------------------------------------------------------- Sample Maze Pattern - 3 -------------------------------------------------------------------------- ????????�???????????????�?????????????�?????????�???????? ? F ? ? ? ? �????? ? ?????? ??? ??? ????? ?????? ????? ? ? ? ? ????? ? ? ? ? ? ? ? ??????????? ?????? ? ???????? ???? ? ? ? ? ? ? ? ??????? ? ? ??? ? ? ???????????? ? ? ???? ? ? �? ? ? ?????? ? ????? ?� ? ??? ????? ? ??????????? ? ? ?? ? ? ? ? ? ? ????? ? ? ?????? ? ? ? ? ? ? ? ? ? ? VYOMWORLD ? ? ? ?????? ? ? ? ????? ?? ????????? ????? ? ?? ? ??� ? ? ? ????? ? ???? ??? ???? ? ? �???? ???????? ??? ? ? ? ? ? ? ? ? ? ? ????????????????? ???? ? ? ? ? ??? ???????????? ?? ? ? ?? ? ? ? ? ? ? ?????????????? ????? ??? ???? ? ? ? ? ? ? ? S ? ????????????????�????�???????????????�??????�????????????

Related Source Codes

Script Name Author
Calendar date to day number and back Nicky McLean
Matrix Multiple Cirruse Salehnasab
Function Power Recursive Cirruse Salehnasab
swim brian colston
tetris (Mini Project) mehdi farrokhzad
Macsi - space fighting game. Macsi P�ter
Recursive Monkey Puzzle Solution - Project Maxim C.L. Wrne
Excellent Rat in a Maze Program. VyomWorld
A car game. You have to drive the car in such a way that you dont strike a barrier on the road. VyomWorld
Student Database Information System. VyomWorld
Tic Tac Toe Game implemented in Pascal. VyomWorld
Game to Gain more blocks by drawing appropriate lines from correct places(dots). VyomWorld
To Find The Coinage Of The Amount Entered. VyomWorld
Randomizes two 3x3 arrays and indicates the numbers whih are common in both the arrays otherwise an cross 'x' is shown instead. VyomWorld
Program that checks the space on drive a: and also gives a graphical representation of memory. VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptId=743


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review