Beep codes for IBM, AMI and Phoenix BIOS

0

Category:

Standard Original IBM POST Error Codes
Code Description

1 short beep System is OK
2 short beeps POST Error - error code shown on screen No beep Power supply or system board problem Continuous beep Power supply, system board, or keyboard problem Repeating short beeps Power supply or system board problem
1 long, 1 short beep System board problem
1 long, 2 short beeps Display adapter problem (MDA, CGA)
1 long, 3 short beeps Display adapter problem (EGA)
3 long beeps 3270 keyboard card
IBM POST Diagnostic Code Descriptions
Code Description
100 - 199 System Board
200 - 299 Memory
300 - 399 Keyboard
400 - 499 Monochrome Display
500 - 599 Colour/Graphics Display
600 - 699 Floppy-disk drive and/or Adapter
700 - 799 Math Coprocessor
900 - 999 Parallel Printer Port
1000 - 1099 Alternate Printer Adapter
1100 - 1299 Asynchronous Communication Device, Adapter, or Port
1300 - 1399 Game Port
1400 - 1499 Colour/Graphics Printer
1500 - 1599 Synchronous Communication Device, Adapter, or Port
1700 - 1799 Hard Drive and/or Adapter
1800 - 1899 Expansion Unit (XT)
2000 - 2199 Bisynchronous Communication Adapter
2400 - 2599 EGA system-board Video (MCA)
3000 - 3199 LAN Adapter
4800 - 4999 Internal Modem
7000 - 7099 Phoenix BIOS Chips
7300 - 7399 3.5" Disk Drive
8900 - 8999 MIDI Adapter
11200 - 11299 SCSI Adapter
21000 - 21099 SCSI Fixed Disk and Controller
21500 - 21599 SCSI CD-ROM System

AMI BIOS Beep Codes
Code Description

1 Short Beep System OK
2 Short Beeps Parity error in the first 64 KB of memory
3 Short Beeps Memory failure in the first 64 KB
4 Short Beeps Memory failure in the first 64 KB Operational of memory
or Timer 1 on the motherboard is not functioning
5 Short Beeps The CPU on the motherboard generated an error
6 Short Beeps The keyboard controller may be bad. The BIOS cannot switch to protected mode
7 Short Beeps The CPU generated an exception interrupt
8 Short Beeps The system video adapter is either missing, or its memory is faulty
9 Short Beeps The ROM checksum value does not match the value encoded in the BIOS
10 Short Beeps The shutdown register for CMOS RAM failed
11 Short Beeps The external cache is faulty
1 Long, 3 Short Beeps Memory Problems
1 Long, 8 Short Beeps Video Card Problems

Phoenix BIOS Beep Codes
Note - Phoenix BIOS emits three sets of beeps, separated by a brief pause.

Code Description
1-1-3 CMOS read/write failure
1-1-4 ROM BIOS checksum error
1-2-1 Programmable interval timer failure
1-2-2 DMA initialisation failure
1-2-3 DMA page register read/write failure
1-3-1 RAM refresh verification failure
1-3-3 First 64k RAM chip or data line failure
1-3-4 First 64k RAM odd/even logic failure
1-4-1 Address line failure first 64k RAM
1-4-2 Parity failure first 64k RAM
2-_-_ Faulty Memory
3-1-_ Faulty Motherboard
3-2-4 Keyboard controller Test failure
3-3-4 Screen initialisation failure
3-4-1 Screen retrace test failure
3-4-2 Search for video ROM in progress
4-2-1 Timer tick interrupt in progress or failure
4-2-2 Shutdown test in progress or failure
4-2-3 Gate A20 failure
4-2-4 Unexpected interrupt in protected mode
4-3-1 RAM test in progress or failure>ffffh
4-3-2 Faulty Motherboard
4-3-3 Interval timer channel 2 test or failure
4-3-4 Time of Day clock test failure
4-4-1 Serial port test or failure
4-4-2 Parallel port test or failure
4-4-3 Math coprocessor test or failure
Low 1-1-2 System Board select failure
Low 1-1-3 Extended CMOS RAM failure

Beep Code Manual

0

Category:

BIOS Beep Codes

When a computer is first turned on, or rebooted, its BIOS performs a power-on self test (POST) to test the system's hardware, checking to make sure that all of the system's hardware components are working properly. Under normal circumstances, the POST will display an error message; however, if the BIOS detects an error before it can access the video card, or if there is a problem with the video card, it will produce a series of beeps, and the pattern of the beeps indicates what kind of problem the BIOS has detected.
Because there are many brands of BIOS, there are no standard beep codes for every BIOS.

The two most-used brands are AMI (American Megatrends International) and Phoenix.

Below are listed the beep codes for AMI systems, and here are the beep codes for Phoenix systems.


AMI Beep Codes

Beep Code Meaning
1 beep DRAM refresh failure. There is a problem in the system memory or the motherboard.
2 beeps Memory parity error. The parity circuit is not working properly.
3 beeps Base 64K RAM failure. There is a problem with the first 64K of system memory.
4 beeps System timer not operational. There is problem with the timer(s) that control functions on the motherboard.
5 beeps Processor failure. The system CPU has failed.
6 beeps Gate A20/keyboard controller failure. The keyboard IC controller has failed, preventing gate A20 from switching the processor to protect mode.
7 beeps Virtual mode exception error.
8 beeps Video memory error. The BIOS cannot write to the frame buffer memory on the video card.
9 beeps ROM checksum error. The BIOS ROM chip on the motherboard is likely faulty.
10 beeps CMOS checksum error. Something on the motherboard is causing an error when trying to interact with the CMOS.
11 beeps Bad cache memory. An error in the level 2 cache memory.
1 long beep, 2 short Failure in the video system.
1 long beep, 3 short A failure has been detected in memory above 64K.
1 long beep, 8 short Display test failure.
Continuous beeping A problem with the memory or video.
BIOS Beep Codes


Phoenix Beep Codes

Phoenix uses sequences of beeps to indicate problems. The "-" between each number below indicates a pause between each beep sequence. For example, 1-2-3 indicates one beep, followed by a pause and two beeps, followed by a pause and three beeps. Phoenix version before 4.x use 3-beep codes, while Phoenix versions starting with 4.x use 4-beep codes. Click here for AMI BIOS beep codes.
4-Beep Codes
Beep Code Meaning
1-1-1-3 Faulty CPU/motherboard. Verify real mode.
1-1-2-1 Faulty CPU/motherboard.
1-1-2-3 Faulty motherboard or one of its components.
1-1-3-1 Faulty motherboard or one of its components. Initialize chipset registers with initial POST values.
1-1-3-2 Faulty motherboard or one of its components.
1-1-3-3 Faulty motherboard or one of its components. Initialize CPU registers.
1-1-3-2
1-1-3-3
1-1-3-4 Failure in the first 64K of memory.
1-1-4-1 Level 2 cache error.
1-1-4-3 I/O port error.
1-2-1-1 Power management error.
1-2-1-2
1-2-1-3 Faulty motherboard or one of its components.
1-2-2-1 Keyboard controller failure.
1-2-2-3 BIOS ROM error.
1-2-3-1 System timer error.
1-2-3-3 DMA error.
1-2-4-1 IRQ controller error.
1-3-1-1 DRAM refresh error.
1-3-1-3 A20 gate failure.
1-3-2-1 Faulty motherboard or one of its components.
1-3-3-1 Extended memory error.
1-3-3-3
1-3-4-1
1-3-4-3 Error in first 1MB of system memory.
1-4-1-3
1-4-2-4 CPU error.
1-4-3-1
2-1-4-1 BIOS ROM shadow error.
1-4-3-2
1-4-3-3 Level 2 cache error.
1-4-4-1
1-4-4-2
2-1-1-1 Faulty motherboard or one of its components.
2-1-1-3
2-1-2-1 IRQ failure.
2-1-2-3 BIOS ROM error.
2-1-2-4
2-1-3-2 I/O port failure.
2-1-3-1
2-1-3-3 Video system failure.
2-1-1-3
2-1-2-1 IRQ failure.
2-1-2-3 BIOS ROM error.
2-1-2-4 I/O port failure.
2-1-4-3
2-2-1-1 Video card failure.
2-2-1-3
2-2-2-1
2-2-2-3 Keyboard controller failure.
2-2-3-1 IRQ error.
2-2-4-1 Error in first 1MB of system memory.
2-3-1-1
2-3-3-3 Extended memory failure.
2-3-2-1 Faulty motherboard or one of its components.
2-3-2-3
2-3-3-1 Level 2 cache error.
2-3-4-1
2-3-4-3 Motherboard or video card failure.
2-3-4-1
2-3-4-3
2-4-1-1 Motherboard or video card failure.
2-4-1-3 Faulty motherboard or one of its components.
2-4-2-1 RTC error.
2-4-2-3 Keyboard controller error.
2-4-4-1 IRQ error.
3-1-1-1
3-1-1-3
3-1-2-1
3-1-2-3 I/O port error.
3-1-3-1
3-1-3-3 Faulty motherboard or one of its components.
3-1-4-1
3-2-1-1
3-2-1-2 Floppy drive or hard drive failure.
3-2-1-3 Faulty motherboard or one of its components.
3-2-2-1 Keyboard controller error.
3-2-2-3
3-2-3-1
3-2-4-1 Faulty motherboard or one of its components.
3-2-4-3 IRQ error.
3-3-1-1 RTC error.
3-3-1-3 Key lock error.
3-3-3-3 Faulty motherboard or one of its components.
3-3-3-3
3-3-4-1
3-3-4-3
3-4-1-1
3-4-1-3
3-4-2-1
3-4-2-3
3-4-3-1
3-4-4-1
3-4-4-4 Faulty motherboard or one of its components.
4-1-1-1 Floppy drive or hard drive failure.
4-2-1-1
4-2-1-3
4-2-2-1 IRQ failure.
4-2-2-3
4-2-3-1
4-2-3-3
4-2-4-1 Faulty motherboard or one of its components.
4-2-4-3 Keyboard controller error.
4-3-1-3
4-3-1-4
4-3-2-1
4-3-2-2
4-3-3-1
4-3-4-1
4-3-4-3 Faulty motherboard or one of its components.
4-3-3-2
4-3-3-4 IRQ failure.
4-3-3-3
4-3-4-2 Floppy drive or hard drive failure.
3-Beep Codes
Beep Code Meaning
1-1-2 Faulty CPU/motherboard.
1-1-3 Faulty motherboard/CMOS read-write failure.
1-1-4 Faulty BIOS/BIOS ROM checksum error.
1-2-1 System timer not operational. There is a problem with the timer(s) that control functions on the motherboard.
1-2-2
1-2-3 Faulty motherboard/DMA failure.
1-3-1 Memory refresh failure.
1-3-2
1-3-3
1-3-4 Failure in the first 64K of memory.
1-4-1 Address line failure.
1-4-2 Parity RAM failure.
1-4-3 Timer failure.
1-4-4 NMI port failure.
2-_-_ Any combination of beeps after 2 indicates a failure in the first 64K of memory.
3-1-1 Master DMA failure.
3-1-2 Slave DMA failure.
3-1-3
3-1-4 Interrupt controller failure.
3-2-4 Keyboard controller failure.
3-3-1
3-3-2 CMOS error.
3-3-4 Video card failure.
3-4-1 Video card failure.
4-2-1 Timer failure.
4-2-2 CMOS shutdown failure.
4-2-3 Gate A20 failure.
4-2-4 Unexpected interrupt in protected mode.
4-3-1 RAM test failure.
4-3-3 Timer failure.
4-3-4 Time of day clock failure.
4-4-1 Serial port failure.
4-4-2 Parallel port failure.
4-4-3 Math coprocessor.

"Spyware", "Mal-ware", "hijackers", "Dialers"

0

Category:

There are a lot of PC users that know little about "Spyware", "Mal-ware", "hijackers", "Dialers" & many more. This will help you avoid pop-ups, spammers and all those baddies.

What is spy-ware?
Spy-ware is Internet jargon for Advertising Supported software (Ad-ware). It is a way for shareware authors to make money from a product, other than by selling it to the users. There are several large media companies that offer them to place banner ads in their products in exchange for a portion of the revenue from banner sales. This way, you don't have to pay for the software and the developers are still getting paid. If you find the banners annoying, there is usually an option to remove them, by paying the regular licensing fee.

Known spywares
There are thousands out there, new ones are added to the list everyday. But here are a few:
Alexa, Aureate/Radiate, BargainBuddy, ClickTillUWin, Conducent Timesink, Cydoor, Comet Cursor, eZula/KaZaa Toptext, Flashpoint/Flashtrack, Flyswat, Gator, GoHip, Hotbar, ISTbar, Lions Pride Enterprises/Blazing Logic/Trek Blue, Lop (C2Media), Mattel Brodcast, Morpheus, NewDotNet, Realplayer, Songspy, Xupiter, Web3000, WebHancer, Windows Messenger Service.

How to check if a program has spyware?
The is this Little site that keeps a database of programs that are known to install spyware.

Check Here: http://www.spywareguide.com/product_search.php

If you would like to block pop-ups (IE Pop-ups).
There tons of different types out there, but these are the 2 best, i think.

Try: Google Toolbar (http://toolbar.google.com/) This program is Free
Try: AdMuncher (http://www.admuncher.com) This program is Shareware

If you want to remove the "spyware" try these.
Try: Lavasoft Ad-Aware (http://www.lavasoftusa.com/) This program is Free
Info: Ad-aware is a multi spyware removal utility, that scans your memory, registry and hard drives for known spyware components and lets you remove them. The included backup-manager lets you reinstall a backup, offers and multi language support.

Try: Spybot-S&D (http://www.safer-networking.org/) This program is Free
Info: Detects and removes spyware of different kinds (dialers, loggers, trojans, user tracks) from your computer. Blocks ActiveX downloads, tracking cookies and other threats. Over 10,000 detection files and entries. Provides detailed information about found problems.

Try: BPS Spyware and Adware Remover (http://www.bulletproofsoft.com/spyware-remover.html) This program is Shareware
Info: Adware, spyware, trackware and big brotherware removal utility with multi-language support. It scans your memory, registry and drives for known spyware and lets you remove them. Displays a list and lets you select the items you'd like to remove.

Try: Spy Sweeper v2.2 (http://www.webroot.com/wb/products/spysweeper/index.php) This program is Shareware
Info: Detects and removes spyware of different kinds (dialers, loggers, trojans, user tracks) from your computer.
The best scanner out there, and updated all the time.

Try: HijackThis 1.97.7 (http://www.spywareinfo.com/~merijn/downloads.html) This program is Freeware
Info: HijackThis is a tool, that lists all installed browser add-on, buttons, startup items and allows you to inspect them, and optionally remove selected items.


If you would like to prevent "spyware" being install.
Try: SpywareBlaster 2.6.1 (http://www.wilderssecurity.net/spywareblaster.html) This program is Free
Info: SpywareBlaster doesn`t scan and clean for so-called spyware, but prevents it from being installed in the first place. It achieves this by disabling the CLSIDs of popular spyware ActiveX controls, and also prevents the installation of any of them via a webpage.

Try: SpywareGuard 2.2 (http://www.wilderssecurity.net/spywareguard.html) This program is Free
Info: SpywareGuard provides a real-time protection solution against so-called spyware. It works similar to an anti-virus program, by scanning EXE and CAB files on access and alerting you if known spyware is detected.

Try: XP-AntiSpy (http://www.xp-antispy.org/) This program is Free
Info: XP-AntiSpy is a small utility to quickly disable some built-in update and authentication features in WindowsXP that may rise security or privacy concerns in some people.

Try: SpySites (http://camtech2000.net/Pages/SpySites_Prog...ml#SpySitesFree) This program is Free
Info: SpySites allows you to manage the Internet Explorer Restricted Zone settings and easily add entries from a database of 1500+ sites that are known to use advertising tracking methods or attempt to install third party software.

If you would like more Information about "spyware".
Check these sites.
http://www.spychecker.com/
http://www.spywareguide.com/
http://www.cexx.org/adware.htm
http://www.theinfomaniac.net/infomaniac/co...rsSpyware.shtml
http://www.thiefware.com/links/
http://simplythebest.net/info/spyware.html

Usefull tools...
Try: Stop Windows Messenger Spam 1.10 (http://www.jester2k.pwp.blueyonder.co.uk/j...r2ksoftware.htm) This program is Free
Info: "Stop Windows Messenger Spam" stops this Service from running and halts the spammers ability to send you these messages.

----------------------------------------------------------------------------
All these softwares will help remove and prevent evil spammers and spywares attacking your PC. I myself recommend getting "spyblaster" "s&d spybot" "spy sweeper" & "admuncher" to protect your PC. A weekly scan is also recommended

Free Virus Scan
Scan for spyware, malware and keyloggers in addition to viruses, worms and trojans. New threats and annoyances are created faster than any individual can keep up with.
http://defender.veloz.com// - 15k


Finding . is a Click Away at 2020Search.com
Having trouble finding what you re looking for on: .? 2020Search will instantly provide you with the result you re looking for by drawing on some of the best search engines the Internet has to offer. Your result is a click away!
http://www.2020search.com// - 43k


Download the BrowserVillage Toolbar.
Customize your Browser! Eliminate Pop-up ads before they start, Quick and easy access to the Web, and much more. Click Here to Install Now!
http://www.browservillage.com/ - 36k

Next Wave of Growth

0

Category:

Generally, the obstacles thet MSMEs face in the finance department is that most organizations are started with the entrepreneur's own money and more often than not, that money is not sufficient for growth.Many financial institutions are wary of extending credit to MEMEs due to lack of faith in business model or lack of collateral.Fortunately, the government now has credit schemes directly benefiting MSMEs.

The small and medium enterprises in India are responsible for generating the highest rate of employment amongst all sectors and are also a very big part of the industrial production and exports of the country.
As on 2008 MSME contributed 8 percent to the countries GDP.According to MSME , 45 % of total exports of the country , employing about 59 million persons in over 26 million units through out the country.

3D game demo embedded for your website

0

Category:

source code to create pacman type game using C++

0

Category:

#include
#include
#include
#include
#include
#include
#include
#include

#define MAXCHANCE 15

#define FOREST     0
#define DESERT     1
#define AQUAMARINE 2

#define UP    1
#define LEFT  2
#define DOWN  3
#define RIGHT 4


int  Glutton_Game_Loop();
void Welcome();
void Draw_Game_Screen_of_Selected_Skin();
void Init_Glutton_Squares();
void Sound_Mode_Conversion();
void Sound_Glutton_Catches_Demon();
void Draw_Dots();
int  Check_For_Level_Completion();
int  Column_Detector(int);
int  Row_Detector(int);
void Scorer(unsigned long int,int);
void Speed_Skin_Menu();
void Start_Play();
void Memory_Provider();
void Draw_Main_Screen();
void Ask_For_Exit();
void Pause_The_Game();
void Switcher(int,int,int);
void Glutton_Gets_Caught();
int  Glutton_Director();
void Demon_Director(int,int,int);
void Glutton_Catches_Demon_in_Mode2(int);
void Blink_Dots(int,int,int,int,int);
void Glutton_Gets_Power();
void Glutton_Loses_Power();
void Demon_Director();
void Bonus_Awarder();

char *Glut_Face_1,*Glut_Face_2,*Glut_Face_3,*Blank_Replacer,*Dot_Replacer,*Glut_Power;
char *Demon[3];
int Memory_Allocator=1;
int Glutton_Squares[289],Dot_Squares[289],Demon_Squares[289];
int Curr_Pos_Glut=149;
int chance=MAXCHANCE;
int Demon_Cell_Color=1;
int Level=1,Dot_Color=LIGHTGREEN;
int Power_Dot_Status_1=1,Power_Dot_Status_2=1,Power_Dot_Status_3=1,Power_Dot_Status_4=1;
long Score=0,Speed;
int Skin=0,Bkgd_Color=0;
int x,y;
union REGS ii,oo;

int Column_Number,Row_Number;

int Dir_Demon[3];
int Curr_Pos_Demon[3];
int d_txt[3],d_tyt[3];
int Demon_Column_Number[3],Demon_Row_Number[3];
int tyt=0,txt=0;
int Direction=1;
int Direction_m=0;
int Power_Mode_Timer=0,loop=0;
int Glutton_Mode=1;
int Bonus_Counter=0;
int Bonus=0;

void Var_Initializer()
{
    Curr_Pos_Glut=149;
    Curr_Pos_Demon[0]=142;
    Curr_Pos_Demon[1]=144;
    Curr_Pos_Demon[2]=144;
    d_tyt[0]=2;
    d_txt[0]=0;
    d_tyt[1]=2;
    d_txt[1]=0;
    d_tyt[2]=2;
    d_txt[2]=0;
    tyt=0;
    txt=0;
    Direction=1;
    Direction_m=0;
    Power_Mode_Timer=0;
    loop=0;
    Glutton_Mode=1;
}

void main()
{
 int d=DETECT,m;
  initgraph(&d,&m,"");

  x=getmaxx()/2;
  y=getmaxy()/2;

 Welcome();

 Speed_Skin_Menu();
 cleardevice();
 Start_Play();
 closegraph();
}


int Glutton_Game_Loop()
{
  union REGS ii,oo;
  int x,y;
    x=getmaxx()/2+45;
    y=getmaxy()/2;

 int get;

 setcolor(WHITE);
 setfillstyle(SOLID_FILL,WHITE);

 Var_Initializer();

 if(Memory_Allocator==1)
 {
 Init_Glutton_Squares();
 Draw_Game_Screen_of_Selected_Skin();
 Memory_Provider();
 }

 if(chance==MAXCHANCE)
     Init_Glutton_Squares();

 Draw_Dots();
 Draw_Main_Screen();
 Demon_Director();


while(1)
{
    loop++;

    settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
    outtextxy(x-340,y-188-6,"Score");
    Scorer(Score,1);

    Blink_Dots(loop,Power_Dot_Status_1,Power_Dot_Status_2,Power_Dot_Status_3,Power_Dot_Status_4);

    if((Curr_Pos_Glut==Curr_Pos_Demon[0]||Curr_Pos_Glut==Curr_Pos_Demon[1]||Curr_Pos_Glut==Curr_Pos_Demon[2])&&Glutton_Mode==1)
    {
    Glutton_Gets_Caught();
    return 0;
    }

    Glutton_Catches_Demon_in_Mode2(Glutton_Mode);

    get=Glutton_Director();
    if(get==1)    return 1;

    Glutton_Gets_Power();

    if((Curr_Pos_Glut==Curr_Pos_Demon[0]||Curr_Pos_Glut==Curr_Pos_Demon[1]||Curr_Pos_Glut==Curr_Pos_Demon[2])&&Glutton_Mode==1)
    {
    Glutton_Gets_Caught();
    return 0;
    }

    Glutton_Catches_Demon_in_Mode2(Glutton_Mode);


    if(loop==10)
    {
    putimage(x-12-27,y-12,Blank_Replacer,0);
    putimage(x-12,y-12,Demon[1],0);
    }
    if(loop==11)
    {
    if(Glutton_Mode==2||loop==11)
        putimage(x-12,y-12,Blank_Replacer,0);
    putimage(x-12,y-12-27,Demon[1],0);
    }

    if(loop==22)
    {
    putimage(x-12+27,y-12,Blank_Replacer,0);
    putimage(x-12,y-12,Demon[2],0);
    }
    if(loop==23)
    {
    if(Glutton_Mode==2||loop==23)
        putimage(x-12,y-12,Blank_Replacer,0);
    putimage(x-12,y-12-27,Demon[2],0);
    }

    if(Glutton_Mode==1||loop%2==0)
    {
    if(loop==1||Curr_Pos_Demon[0]==144)
    {
        putimage(x-12,y-12,Blank_Replacer,0);
        Curr_Pos_Demon[0]=142;
    }

    Switcher(Dir_Demon[0],Glutton_Mode,0);
    Demon_Director(0,Column_Number,Row_Number);

    if(loop>=12)
    {
        if(loop==12||Curr_Pos_Demon[1]==144)
        {
        putimage(x-12,y-12-27,Blank_Replacer,0);
        Curr_Pos_Demon[1]=142;
        }

        Switcher(Dir_Demon[1],Glutton_Mode,1);
        Demon_Director(1,Column_Number,Row_Number);

        if(loop>=24)
        {
        if(loop==24||Curr_Pos_Demon[2]==144)
        {
            putimage(x-12,y-12-27,Blank_Replacer,0);
            Curr_Pos_Demon[2]=142;
        }

        Switcher(Dir_Demon[2],Glutton_Mode,2);
        Demon_Director(2,Column_Number,Row_Number);
        }
    }

    if((Curr_Pos_Glut==Curr_Pos_Demon[0]||Curr_Pos_Glut==Curr_Pos_Demon[1]||Curr_Pos_Glut==Curr_Pos_Demon[2])&&Glutton_Mode==1)
    {
        Glutton_Gets_Caught();
        return 0;
    }

    }

    Glutton_Catches_Demon_in_Mode2(Glutton_Mode);
    Glutton_Loses_Power();

    Bonus_Awarder();

    delay(Speed);

    Scorer(Score,0);


    if(kbhit())
    {
        ii.h.ah=0;
        int86(22,&ii,&oo);
        if(oo.h.ah==1)
        {
            Ask_For_Exit();
        }
        if(oo.h.ah==28)
        {
          Pause_The_Game();
        }
        if(oo.h.ah==77)
        {
            if(Glutton_Squares[Curr_Pos_Glut+17]==1)
             {
                 Direction=4;
                 Direction_m=0;
             }
            else if(Glutton_Squares[Curr_Pos_Glut+17]==0)
             {
                 Direction_m=4;
             }
        }
        if(oo.h.ah==75)
        {
            if(Glutton_Squares[Curr_Pos_Glut-17]==1)
             {
                 Direction=2;
                 Direction_m=0;
             }
            else if(Glutton_Squares[Curr_Pos_Glut-17]==0)
             {
                 Direction_m=2;
             }
        }
        if(oo.h.ah==72)
        {
            if(Glutton_Squares[Curr_Pos_Glut-1]==1)
             {
                 Direction=1;
                 Direction_m=0;
             }
            else if(Glutton_Squares[Curr_Pos_Glut-1]==0)
             {
                 Direction_m=1;
             }
        }
        if(oo.h.ah==80)
        {
            if(Glutton_Squares[Curr_Pos_Glut+1]==1)
             {
                 Direction=3;
                 Direction_m=0;
             }
            else if(Glutton_Squares[Curr_Pos_Glut+1]==0)
             {
                 Direction_m=3;
             }
        }
    }

    if(Direction_m==1&&Glutton_Squares[Curr_Pos_Glut-1]==1)
    Direction=1;
    if(Direction_m==2&&Glutton_Squares[Curr_Pos_Glut-17]==1)
    Direction=2;
    if(Direction_m==3&&Glutton_Squares[Curr_Pos_Glut+1]==1)
    Direction=3;
    if(Direction_m==4&&Glutton_Squares[Curr_Pos_Glut+17]==1)
    Direction=4;

}

}

void Draw_Game_Screen_of_Selected_Skin()
{
int x,y;
x=getmaxx()/2+45;
y=getmaxy()/2;

int g,h,M_col=14;

if(Skin==DESERT)
{
    setfillstyle(SOLID_FILL,1);
    bar(x-230,y-230,x+230,y+230);
    for(g=x-230;g
    for(h=y-230;h
        putpixel(g,h,M_col);
    for(g=x-230;g
    for(h=y-230;h
        putpixel(g+1,h+1,M_col);
}
else if(Skin==AQUAMARINE)
{
    M_col=CYAN;
    setfillstyle(SOLID_FILL,LIGHTBLUE);
    bar(x-230,y-230,x+230,y+230);
}
else
;

    setlinestyle(SOLID_LINE,1,3);
    line(x-216-14,y-216-14,x+216+14,y-216-14);
    line(x+216+14,y-216-14,x+216+14,y+216+14);
    line(x+216+14,y+216+14,x-216-14,y+216+14);
    line(x-216-14,y+216+14,x-216-14,y-216-14);
    setlinestyle(SOLID_LINE,1,1);

    if(Skin==AQUAMARINE)
    setfillstyle(SOLID_FILL,BLUE);
    else if(Skin==DESERT)
    setfillstyle(SOLID_FILL,8);
    else
    setfillstyle(3,7);

    for(int l=0;l<17;l++)
    {
    line(x-216-14,y-14-216+l*27,x+216+14,y-216-14+l*27);
    line(x+216+14-l*27,y-14-216,x+216+14-l*27,y+14+216);
    }
      for(l=0;l<288;l++)
      if(Glutton_Squares[l]==0&&l!=143&&l!=144&&l!=161&&l!=127)
      {
        floodfill(x-216+27*(l/17),y-216+27*(l%17),WHITE);
      }

  setfillstyle(1,Demon_Cell_Color);
  floodfill(x-25,y+25,15);
  floodfill(x-25-27,y+25,15);
  floodfill(x-25,y+25-27*2,15);
  floodfill(x-25-27,y+25-27,15);
  floodfill(x-25-27,y+25-27*2,15);
  floodfill(x-25+27,y+25,15);
  floodfill(x-25+27*2,y+25,15);
  floodfill(x-25+27*2,y+25-27*2,15);
  floodfill(x-25+27*3,y+25,15);
  floodfill(x-25+27*3,y+25-27,15);
  floodfill(x-25+27*3,y+25-27*2,15);


  if(Skin==AQUAMARINE)        setcolor(LIGHTBLUE);
  else if(Skin==DESERT)        setcolor(7);
  else                setcolor(0);

  for(l=0;l<17;l++)
  {
      line(x-216-14,y-14-216+l*27,x+216+14,y-216-14+l*27);
      line(x+216+14-l*27,y-14-216,x+216+14-l*27,y+14+216);
  }
  setcolor(8);
  setlinestyle(SOLID_LINE,1,3);
  line(x-148,y-16,x-121,y-16);
  line(x-148,y+15,x-121,y+15);
  line(x-121,y-16,x-121,y+15);
  line(x+148,y-16,x+121,y-16);
  line(x+148,y+15,x+121,y+15);
  line(x+121,y-16,x+121,y+15);
  setcolor(7);
  line(x-216-14,y-216-14,x+216+14,y-216-14);
  line(x+216+14,y-216-14,x+216+14,y+216+14);
  line(x+216+14,y+216+14,x-216-14,y+216+14);
  line(x-216-14,y+216+14,x-216-14,y-216-14);
  setlinestyle(SOLID_LINE,1,1);
}

void Init_Glutton_Squares()
{
for(int n=0;n<289;n++)
Glutton_Squares[n]=0;

for(n=0;n<17;n++)       Glutton_Squares[n]=1;

Glutton_Squares[17]=1;Glutton_Squares[20]=1;Glutton_Squares[25]=1;
Glutton_Squares[30]=1;Glutton_Squares[33]=1;Glutton_Squares[34]=1;Glutton_Squares[36]=1;
Glutton_Squares[37]=1;Glutton_Squares[38]=1;Glutton_Squares[40]=1;Glutton_Squares[41]=1;
Glutton_Squares[42]=1;Glutton_Squares[43]=1;Glutton_Squares[44]=1;Glutton_Squares[46]=1;
Glutton_Squares[47]=1;Glutton_Squares[48]=1;Glutton_Squares[50]=1;Glutton_Squares[51]=1;
Glutton_Squares[52]=1;Glutton_Squares[53]=1;Glutton_Squares[55]=1;Glutton_Squares[56]=1;
Glutton_Squares[57]=1;Glutton_Squares[59]=1;Glutton_Squares[61]=1;Glutton_Squares[62]=1;
Glutton_Squares[63]=1;Glutton_Squares[65]=1;Glutton_Squares[66]=1;Glutton_Squares[67]=1;
Glutton_Squares[69]=1;Glutton_Squares[72]=1;Glutton_Squares[74]=1;Glutton_Squares[78]=1;
Glutton_Squares[80]=1;Glutton_Squares[83]=1;Glutton_Squares[86]=1;Glutton_Squares[87]=1;

for(n=89;n<=97;n++)     Glutton_Squares[n]=1;

Glutton_Squares[99]=1;Glutton_Squares[100]=1;

for(n=104;n<=106;n++)   Glutton_Squares[n]=1;

Glutton_Squares[108]=1;Glutton_Squares[112]=1;

for(n=114;n<=116;n++)   Glutton_Squares[n]=1;

for(n=119;n<=121;n++)    Glutton_Squares[n]=1;

Glutton_Squares[123]=1;Glutton_Squares[125]=1;Glutton_Squares[129]=1;

for(n=133;n<=136;n++)    Glutton_Squares[n]=1;
for(n=140;n<=142;n++)   Glutton_Squares[n]=1;
for(n=146;n<=150;n++)   Glutton_Squares[n]=1;
for(n=152;n<=155;n++)   Glutton_Squares[n]=1;

Glutton_Squares[157]=1;Glutton_Squares[159]=1;Glutton_Squares[163]=1;

for(n=167;n<=169;n++)   Glutton_Squares[n]=1;
for(n=172;n<=174;n++)   Glutton_Squares[n]=1;

Glutton_Squares[176]=1;Glutton_Squares[180]=1;

for(n=182;n<=184;n++)   Glutton_Squares[n]=1;

Glutton_Squares[188]=1;Glutton_Squares[189]=1;

for(n=191;n<=199;n++)   Glutton_Squares[n]=1;

Glutton_Squares[201]=1;Glutton_Squares[202]=1;Glutton_Squares[205]=1;Glutton_Squares[208]=1;
Glutton_Squares[210]=1;Glutton_Squares[214]=1;Glutton_Squares[216]=1;Glutton_Squares[219]=1;

for(n=221;n<=223;n++)   Glutton_Squares[n]=1;
for(n=225;n<=227;n++)   Glutton_Squares[n]=1;

Glutton_Squares[229]=1;

for(n=231;n<=233;n++)  Glutton_Squares[n]=1;
for(n=235;n<=238;n++)  Glutton_Squares[n]=1;
for(n=240;n<=242;n++)  Glutton_Squares[n]=1;
for(n=244;n<=248;n++)  Glutton_Squares[n]=1;
for(n=250;n<=252;n++)  Glutton_Squares[n]=1;

Glutton_Squares[254]=1;Glutton_Squares[255]=1;Glutton_Squares[258]=1;
Glutton_Squares[263]=1;Glutton_Squares[268]=1;Glutton_Squares[271]=1;

for(n=272;n<=288;n++)  Glutton_Squares[n]=1;


for(n=0;n<=288;n++)
{
  Dot_Squares[n]=Glutton_Squares[n];
  Demon_Squares[n]=Glutton_Squares[n];
}
Demon_Squares[59]=0;
Demon_Squares[229]=0;
Dot_Squares[59]=0;
Dot_Squares[229]=0;
Dot_Squares[149]=0;

}

int Check_For_Level_Completion()
{
 int n,m=1;
 for(n=0;n<289;n++)
  {
   if(Dot_Squares[n]==1)
   m=0;
  }
 if(m==1)
  {
  return 1;
  }
  return 0;
}

int Row_Detector(int x)
{
if(x%17==0)        return 1;
else if((x-1)%17==0)    return 2;
else if((x-2)%17==0)    return 3;
else if((x-3)%17==0)    return 4;
else if((x-4)%17==0)    return 5;
else if((x-5)%17==0)    return 6;
else if((x-6)%17==0)    return 7;
else if((x-7)%17==0)    return 8;
else if((x-8)%17==0)    return 9;
else if((x-9)%17==0)    return 10;
else if((x-10)%17==0)   return 11;
else if((x-11)%17==0)   return 12;
else if((x-12)%17==0)   return 13;
else if((x-13)%17==0)   return 14;
else if((x-14)%17==0)   return 15;
else if((x-15)%17==0)   return 16;
else if((x-16)%17==0)   return 17;
return 0;
}

int Column_Detector(int x)
{
if(x>=0&&x<=16)         return 1;
else if(x>=17&&x<=33)   return 2;
else if(x>=34&&x<=50)   return 3;
else if(x>=51&&x<=67)   return 4;
else if(x>=68&&x<=84)   return 5;
else if(x>=85&&x<=101)  return 6;
else if(x>=102&&x<=118) return 7;
else if(x>=119&&x<=135) return 8;
else if(x>=136&&x<=152) return 9;
else if(x>=153&&x<=169) return 10;
else if(x>=170&&x<=186) return 11;
else if(x>=187&&x<=203) return 12;
else if(x>=204&&x<=220) return 13;
else if(x>=221&&x<=237) return 14;
else if(x>=238&&x<=254) return 15;
else if(x>=255&&x<=271) return 16;
else                    return 17;
}

void snd(int loop)
{
    if(loop%3==0)
        sound(200);

    else if(loop%3==1)
        sound(220);

    else if(loop%3==2)
        sound(240);

    delay(50);
    nosound();
}

void Draw_Dots()
{
int x,y;
x=getmaxx()/2+45;
y=getmaxy()/2;

setcolor(Dot_Color);
int what;

 for(int z=0;z<289;z++)
 {
    if(z<17)
    what=0;
    if(z>=17&&z<34)
    what=1;
    if(z>=34&&z<51)
    what=2;
    if(z>=51&&z<68)
    what=3;
    if(z>=68&&z<85)
    what=4;
    if(z>=85&&z<102)
    what=5;
    if(z>=102&&z<119)
    what=6;
    if(z>=119&&z<136)
    what=7;
    if(z>=136&&z<153)
    what=8;
    if(z>=153&&z<170)
    what=9;
    if(z>=170&&z<187)
    what=10;
    if(z>=187&&z<204)
    what=11;
    if(z>=204&&z<221)
    what=12;
    if(z>=221&&z<238)
    what=13;
    if(z>=238&&z<255)
    what=14;
    if(z>=255&&z<272)
    what=15;
    if(z>=272&&z<289)
    what=16;
        if(Dot_Squares[z]==1&&z!=229&&z!=59)
        {
               circle(x-216+27*what,y-216+27*(z%17),2);
               circle(x-216+27*what,y-216+27*(z%17),1);
               circle(x-216+27*what,y-216+27*(z%17),1.5);
        }
 }
}

void Sound_Mode_Conversion()//MODE CONVERSION SOUND
{
    for(int o=0;o<15;o++)
    {
    sound(250+10*o);
    delay(3);
    }
    nosound();
}

void Sound_Glutton_Catches_Demon()
{
    sound(750);
    delay(12);
    nosound();
}

void Scorer(unsigned long int sco,int what)
{
 int x,y;
 x=getmaxx()/2;
 y=getmaxy()/2;
 int ss[6]={0,0,0,0,0,0};
    ss[5]=sco/100000;
    ss[4]=(sco%100000)/10000;
    ss[3]=(sco%10000)/1000;
    ss[2]=(sco%1000)/100;
    ss[1]=(sco%100)/10;
    ss[0]=(sco%10);
    if(what==0)
    {
    setfillstyle(SOLID_FILL,7);
    bar(x-250,y-184,x-205,y-174);
    }
    else
    setcolor(6);

    settextstyle(DEFAULT_FONT,0,1);

    for(int o=5;o>=0;o--)
    switch(ss[o])
    {
      case 0:   outtextxy(x-204-o*7,y-183+2,"0");break;
      case 1:   outtextxy(x-204-o*7,y-183+2,"1");break;
      case 2:   outtextxy(x-204-o*7,y-183+2,"2");break;
      case 3:   outtextxy(x-204-o*7,y-183+2,"3");break;
      case 4:   outtextxy(x-204-o*7,y-183+2,"4");break;
      case 5:   outtextxy(x-204-o*7,y-183+2,"5");break;
      case 6:   outtextxy(x-204-o*7,y-183+2,"6");break;
      case 7:   outtextxy(x-204-o*7,y-183+2,"7");break;
      case 8:   outtextxy(x-204-o*7,y-183+2,"8");break;
      case 9:   outtextxy(x-204-o*7,y-183+2,"9");break;
      default: break;
    }
}

void Welcome()
{
    int g,h,M_col=14;

    setfillstyle(SOLID_FILL,1);
    bar(0,0,2*x,2*y);
    for(g=0;g<640;g+=2)
    for(h=0;h<505;h+=2)
        putpixel(g,h,M_col);
    for(g=0;g<640;g+=2)
    for(h=0;h<505;h+=2)
        putpixel(g+1,h+1,M_col);

    setfillstyle(SOLID_FILL,7);
    bar(x-200,y-150,x+200,y+150);
    setcolor(0);
    rectangle(x-150,y-110,x+150,y-55);
    rectangle(x-150+1,y-110+1,x+150-1,y-55-1);
    rectangle(x-200,y-150,x+200,y+150);
    rectangle(x-200+1,y-150+1,x+200-1,y+150-1);
    rectangle(x-200+2,y-150+2,x+200-2,y+150-2);
    rectangle(x-150,y-30,x+150,y+130);
    rectangle(x-150+1,y-30+1,x+150-1,y+130-1);

    setcolor(15);
    line(x-200,y-150,x+200,y-150);
    line(x-200,y-150+1,x+200-1,y-150+1);
    line(x-200,y-150+2,x+200-2,y-150+2);
    line(x-200,y-150,x-200,y+150);
    line(x-200+1,y-150,x-200+1,y+150-1);
    line(x-200+2,y-150,x-200+2,y+150-2);
    line(x+150,y-110,x+150,y-55);
    line(x+150-1,y-110+1,x+150-1,y-55);
    line(x-150,y-55,x+150,y-55);
    line(x-150+1,y-55-1,x+150-1,y-55-1);
    line(x-150,y+130,x+150,y+130);
    line(x-150+1,y+130-1,x+150-1,y+130-1);
    line(x+150,y-30,x+150,y+130);
    line(x+150-1,y-30+1,x+150-1,y+130);

    settextstyle(DEFAULT_FONT,0,5);
    setcolor(2);
    outtextxy(x-135,y-100,"Glutt n");

    setcolor(YELLOW);
    setfillstyle(SOLID_FILL,YELLOW);
    circle(x+82,y+134-212,11);
    circle(x-5+82,y+131-212,2);
    circle(x+5+82,y+131-212,2);
    floodfill(x+82,y+134-212,YELLOW);
    setcolor(0);
    setfillstyle(SOLID_FILL,0);
    circle(x+82,y+139-212,2);
    floodfill(x+82,y+139-212,0);
    setcolor(14);
    settextstyle(DEFAULT_FONT,0,1);
    setcolor(12);
    outtextxy(x-125,y+150-30,"e Mail - singhsuneet@yahoo.com");
    setcolor(RED);
    outtextxy(x-47,y+110-30,"SUNEET SINGH");
    outtextxy(x-40,y+120-30,"99/CSE/123");
    outtextxy(x-70,y+130-30,"C.R.S.C.E. MURTHAL");
    outtextxy(x-73,y+140-30,"Haryana - ( INDIA )");
    outtextxy(x-125,y+150-30,"e Mail   singhsuneet yahoo.com");
    setcolor(1);
    outtextxy(x-40,y+130-40,"  /   /");
    setcolor(14);
    outtextxy(x-30,y+100-40,"CREATOR");

    sleep(1);

    for(g=0;g<2;g++)
    {
    sound(500);     delay(300);
    sound(400);     delay(180);
    sound(450);     delay(450);
    sound(350);     delay(180);
    sound(400);      delay(180);
    sound(350);      delay(180);
    sound(400);      delay(180);
    }
    for(g=0;g<2;g++)
    {
    sound(350);      delay(300);
    sound(400);      delay(200);
    sound(450);      delay(400);
    sound(500);      delay(200);
    sound(350);      delay(180);
    sound(400);      delay(180);
    sound(350);      delay(180);
    sound(400);      delay(180);
    }
    sound(500); delay(100);
    nosound();

    setfillstyle(SOLID_FILL,7);
    bar(x-150+2,y-30+2,x+150-2,y+130-2);
    setcolor(LIGHTGREEN);
    settextstyle(DEFAULT_FONT,0,1);
    outtextxy(x-150,y-20+60,"   Desert Sand");
    outtextxy(x-147,y-0+70,"   Aquamarine");
    outtextxy(x-150,y+20+80,"   Dark Forest");
    outtextxy(x+39,y-50+67,"r u nuts??");
    outtextxy(x+48,y-50+163,"zZzz..z.");
    setcolor(8);
    outtextxy(x-30,y-50+30,"SELECT");
    outtextxy(x+60,y-50+50,"SPEED");
    setcolor(15);
    outtextxy(x-110,y-50+50,"SKIN");
    setcolor(2);
    rectangle(x-134,y+95,x-33,y+111);
    rectangle(x+120,y+15,x+140,y+121);
}

void Speed_Skin_Menu()
{

int h,g;
int sk=1,sp=0;


setcolor(14);

for(sk=0;sk<25;sk++)
line(x+122,y+119-sk*2,x+138,y+119-sk*2);

h=25;

sk=1;sp=0;
            Skin=3; Speed=100;

while(1)
{
 if(kbhit())
 {
        ii.h.ah=0;
        int86(22,&ii,&oo);
        if(oo.h.ah==28)
         {
           break;
         }
        if(oo.h.ah==77)
         {
            if(sk==1)
            {
             setcolor(14);
            if(Skin==3)
             rectangle(x-134,y+95,x-33,y+111);
            else if(Skin==2)
             rectangle(x-134,y+95-30,x-33,y+111-30);
            else if(Skin==1)
             rectangle(x-134,y+95-60,x-33,y+111-60);
             sk=0;sp=1;
             setcolor(15); outtextxy(x+60,y-50+50,"SPEED");
             setcolor(8);  outtextxy(x-110,y-50+50,"SKIN");
            }
            else
            {
             setcolor(2);
            if(Skin==3)
             rectangle(x-134,y+95,x-33,y+111);
            else if(Skin==2)
             rectangle(x-134,y+95-30,x-33,y+111-30);
            else if(Skin==1)
             rectangle(x-134,y+95-60,x-33,y+111-60);
             sk=1;sp=0;
             setcolor(8);outtextxy(x+60,y-50+50,"SPEED");
             setcolor(15);outtextxy(x-110,y-50+50,"SKIN");
            }
             }
        if(oo.h.ah==75)
         {
            if(sk==1)
            {
            setcolor(14);
            if(Skin==3)
            rectangle(x-134,y+95,x-33,y+111);
            else if(Skin==2)
            rectangle(x-134,y+95-30,x-33,y+111-30);
            else if(Skin==1)
            rectangle(x-134,y+95-60,x-33,y+111-60);
            sk=0;sp=1;
            setcolor(15);outtextxy(x+60,y-50+50,"SPEED");
            setcolor(8);outtextxy(x-110,y-50+50,"SKIN");
            }
            else
            {
            setcolor(2);
            if(Skin==3)
            rectangle(x-134,y+95,x-33,y+111);
            else if(Skin==2)
            rectangle(x-134,y+95-30,x-33,y+111-30);
            else if(Skin==1)
            rectangle(x-134,y+95-60,x-33,y+111-60);
            sk=1;sp=0;
            setcolor(8);outtextxy(x+60,y-50+50,"SPEED");
            setcolor(15);outtextxy(x-110,y-50+50,"SKIN");
            }
         }
        if(oo.h.ah==72)
         {
           if(sk==1)
           {
            if(Skin==3)
            {  Skin=2;
            setcolor(7);
            rectangle(x-134,y+95,x-33,y+111);
            setcolor(2);
            rectangle(x-134,y+95-30,x-33,y+111-30);
            }
            else if(Skin==2)
            {  Skin=1;
            setcolor(7);
            rectangle(x-134,y+95-30,x-33,y+111-30);
            setcolor(2);
            rectangle(x-134,y+95-60,x-33,y+111-60);
            }
            else if(Skin==1)
            {  Skin=3;
            setcolor(7);
            rectangle(x-134,y+95-60,x-33,y+111-60);
            setcolor(2);
            rectangle(x-134,y+95,x-33,y+111);
            }
           }
           else if(sp==1&&h!=52)
           {
           if(h<10)
           Speed-=5;
           else if(h>45)
           Speed-=4;
           else
           Speed-=2;
           h++;
           setcolor(14);
           for(g=0;g
           line(x+122,y+119-g*2,x+138,y+119-g*2);
           }
         }
        if(oo.h.ah==80)
         {
           if(sk==1)
           {
            if(Skin==3)
            {  Skin=1;
            setcolor(7);
            rectangle(x-134,y+95,x-33,y+111);
            setcolor(2);
            rectangle(x-134,y+95-60,x-33,y+111-60);
            }
            else if(Skin==2)
            {  Skin=3;
            setcolor(7);
            rectangle(x-134,y+95-30,x-33,y+111-30);
            setcolor(2);
            rectangle(x-134,y+95,x-33,y+111);
            }
            else if(Skin==1)
            {  Skin=2;
            setcolor(7);
            rectangle(x-134,y+95-60,x-33,y+111-60);
            setcolor(2);
            rectangle(x-134,y+95-30,x-33,y+111-30);
            }
           }
           else if(sp==1&&h!=1)
           {
           if(h<10)
           Speed+=5;
           else if(h>45)
           Speed+=4;
           else
           Speed+=2;
           h--;
           setcolor(7);
           line(x+122,y+119-h*2,x+138,y+119-h*2);
           }
         }
 }
}

x+=45;
    if(Skin==1)
    {
    Bkgd_Color=7;
    Dot_Color=RED;
    }
    else if(Skin==2)
    {
    Dot_Color=LIGHTGREEN;
    Bkgd_Color=LIGHTBLUE;
    }
    else
    {
    Bkgd_Color=0;
    Dot_Color=GREEN;
    }
}

void Start_Play()
{

 int game;
 int g,h;

 while(1)
  {
      game=Glutton_Game_Loop();
      if(game==1)
        {
        Init_Glutton_Squares();game=2;
        Demon_Cell_Color++;
        Level++;
        Power_Dot_Status_1=1;
        Power_Dot_Status_2=1;
        Power_Dot_Status_3=1;
        Power_Dot_Status_4=1;
        Bonus_Counter=0;
        Bonus=0;
        }
     else
        {
        chance--;
        }
    if(chance==0)
        {
        int xx,yy;
        settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
        setcolor(0);
            outtextxy(x-315,y+195,"Pause");
            outtextxy(x-315,y+205,"ENTER");
        setcolor(4);
        settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
            outtextxy(x-322,y-15,"GAME");
            outtextxy(x-320,y+15,"OVER");
        setcolor(2);
        settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
            outtextxy(x-312,y+165,"Play");
            outtextxy(x-322,y+180,"Again??");
        setcolor(10);
        circle(x-313,y+205,10);
        circle(x-280,y+205,10);
        circle(x-313,y+205,9);
        circle(x-280,y+205,9);
        setfillstyle(SOLID_FILL,7);
        floodfill(x-313,y+205,10);
        floodfill(x-280,y+205,10);
        setcolor(14);
            outtextxy(x-313-3,y+202,"y");
            outtextxy(x-280-3,y+202,"n");
        while(1)
        {
            ii.h.ah=0;
            int86(22,&ii,&oo);
            if(oo.h.ah==21)
            {
             setcolor(2);
             circle(x-313,y+205,10);
             circle(x-313,y+205,9);
             setcolor(8);
                 outtextxy(x-313-3,y+202,"y");
             delay(500);
             setcolor(10);
             circle(x-313,y+205,10);
             circle(x-313,y+205,9);
             setcolor(14);
                 outtextxy(x-313-3,y+202,"y");
             delay(500);
             Level=1;Score=0;chance=MAXCHANCE;Demon_Cell_Color=1;
             Power_Dot_Status_1=1;Power_Dot_Status_2=1;Power_Dot_Status_3=1;Power_Dot_Status_4=1;
             Start_Play();
            }
            if(oo.h.ah==49)
            {
             setcolor(2);
             circle(x-280,y+205,10);
             circle(x-280,y+205,9);
             setcolor(8);
                 outtextxy(x-280-3,y+202,"n");
             delay(500);
             setcolor(10);
             circle(x-280,y+205,10);
             circle(x-280,y+205,9);
             setcolor(14);
                 outtextxy(x-280-3,y+202,"n");
             delay(500);

            free(Glut_Face_1);free(Glut_Face_2);free(Glut_Face_3);
            free(Blank_Replacer);free(Dot_Replacer);free(Glut_Power);
            free(Demon[0]);free(Demon[1]);free(Demon[2]);
            closegraph();
            exit(0);
            }
          }
        }
  }
}

void Memory_Provider()
{
int area_occupied;

if(Memory_Allocator==1)
{

  area_occupied=imagesize(x+15,y-12,x+37,y+12);
   Blank_Replacer=((char*)malloc(area_occupied));
    getimage(x+15,y-12,x+37,y+12,Blank_Replacer);

  setcolor(Dot_Color);
               circle(x+27,y,2);
               circle(x+27,y,1);
               circle(x+27,y,1.5);

  area_occupied=imagesize(x+15,y-12,x+39,y+12);
   Dot_Replacer=((char*)malloc(area_occupied));
    getimage(x+15,y-12,x+39,y+12,Dot_Replacer);

 setcolor(WHITE);
 setfillstyle(SOLID_FILL,MAGENTA);
 circle(x,y,10);
 floodfill(x,y,WHITE);
 setcolor(0);
 circle(x+3,y-3,1);
 circle(x-3,y-3,1);
 line(x+4,y+6,x+3,y+5);
 line(x+3,y+5,x+2,y+6);
 line(x+2,y+6,x+1,y+5);
 line(x+1,y+5,x,y+6);
 line(x+0,y+6,x-1,y+5);
 line(x-1,y+5,x-2,y+6);
 line(x-2,y+6,x-3,y+5);
 line(x-3,y+5,x-4,y+6);

  area_occupied=imagesize(x-12,y-12,x+12,y+12);
  Demon[0]=((char*)malloc(area_occupied));
  getimage(x-11,y-12,x+11,y+12,Demon[0]);

 setcolor(WHITE);
 circle(x-27,y,10);
  setfillstyle(SOLID_FILL,7);
 floodfill(x-27,y,WHITE);

setcolor(0);
 circle(x-30,y-3,1);
 circle(x-24,y-3,1);
 line(x+4-27,y+6,x+3-27,y+5);
 line(x+3-27,y+5,x+2-27,y+6);
 line(x+2-27,y+6,x+1-27,y+5);
 line(x+1-27,y+5,x-27,y+6);
 line(x+0-27,y+6,x-1-27,y+5);
 line(x-1-27,y+5,x-2-27,y+6);
 line(x-2-27,y+6,x-3-27,y+5);
 line(x-3-27,y+5,x-4-27,y+6);

   area_occupied=imagesize(x-39,y-12,x-15,y+12);
  Demon[1]=((char*)malloc(area_occupied));
  getimage(x-39,y-12,x-15,y+12,Demon[1]);

 setcolor(WHITE);
  setfillstyle(SOLID_FILL,CYAN);
 circle(x+27,y,10);
 floodfill(x+27,y,WHITE);
 setcolor(0);
 circle(x+30,y-3,1);
 circle(x+24,y-3,1);
 line(x+4+27,y+6,x+3+27,y+5);
 line(x+3+27,y+5,x+2+27,y+6);
 line(x+2+27,y+6,x+1+27,y+5);
 line(x+1+27,y+5,x+27,y+6);
 line(x+0+27,y+6,x-1+27,y+5);
 line(x-1+27,y+5,x-2+27,y+6);
 line(x-2+27,y+6,x-3+27,y+5);
 line(x-3+27,y+5,x-4+27,y+6);

   area_occupied=imagesize(x+15,y-12,x+39,y+12);
  Demon[2]=((char*)malloc(area_occupied));
  getimage(x+15,y-12,x+39,y+12,Demon[2]);

  setcolor(8);
  setfillstyle(SOLID_FILL,RED);
  circle(x,y+134,11);
  circle(x-5,y+131,2);
  circle(x+5,y+131,2);
  floodfill(x,y+134,8);

  area_occupied=imagesize(x-11,y+123,x+11,y+145);
  Glut_Power=((char*)malloc(area_occupied));
  getimage(x-11,y+123,x+11,y+145,Glut_Power);

  setcolor(YELLOW);
  setfillstyle(SOLID_FILL,YELLOW);
  circle(x,y+134,11);
  circle(x-5,y+131,2);
  circle(x+5,y+131,2);
  floodfill(x,y+134,YELLOW);

  area_occupied=imagesize(x-11,y+123,x+11,y+145);
  Glut_Face_1=((char*)malloc(area_occupied));
  getimage(x-11,y+123,x+11,y+145,Glut_Face_1);

  setcolor(0);
  setfillstyle(SOLID_FILL,0);
  circle(x,y+139,2);
  floodfill(x,y+139,0);
  area_occupied=imagesize(x-11,y+123,x+11,y+145);
  Glut_Face_2=((char*)malloc(area_occupied));
  getimage(x-11,y+123,x+11,y+145,Glut_Face_2);

  setcolor(YELLOW);
  setfillstyle(SOLID_FILL,YELLOW);
  circle(x,y+139,2);
  floodfill(x,y+139,YELLOW);
  setcolor(0);
  setfillstyle(SOLID_FILL,0);
  circle(x,y+139,3);
  floodfill(x,y+139,0);
  area_occupied=imagesize(x-11,y+123,x+11,y+145);
  Glut_Face_3=((char*)malloc(area_occupied));
  getimage(x-11,y+123,x+11,y+145,Glut_Face_3);
}
}

void Draw_Main_Screen()
{

if(Memory_Allocator==1)
{

setfillstyle(SOLID_FILL,7);
bar(x-360,y-240,x-232,y+240);
bar(x-360,y-240,x+265,y-232);
bar(x-360,y+232,x+265,y+240);
bar(x+232,y-240,x+265,y+240);
setfillstyle(SOLID_FILL,0);
bar(x-340,y-230+70,x-252,y+230);
setcolor(15);
rectangle(x-230,y-230,x+230,y+230);
rectangle(x-230+1,y-230+1,x+230-1,y+230-1);
rectangle(x-230-1,y-230-1,x+230+1,y+230+1);
rectangle(x-230-2,y-230-2,x+230+2,y+230+2);
setcolor(8);

rectangle(x-340,y-230+70,x-252,y+230);
rectangle(x-340-1,y-230+70-1,x-252+1,y+230+1);
rectangle(x-340+1,y-230+70+1,x-252-1,y+230-1);
rectangle(x-340+2,y-230+70+2,x-252-2,y+230-2);

line(x-230,y-230,x+230,y-230);
line(x-230-2,y-230-2,x+230+2,y-230-2);
line(x-230-1,y-230-1,x+230+1,y-230-1);
line(x-230+1,y-230+1,x+230-1,y-230+1);


line(x-230,y-230,x-230,y+230);
line(x-230+1,y-230,x-230+1,y+230-1);
line(x-230-1,y-230,x-230-1,y+230+1);
line(x-230-2,y-231,x-230-2,y+230+2);
setcolor(15);
rectangle(x-230,y-230,x+230,y+230);
rectangle(x-230+1,y-230+1,x+230-1,y+230-1);
rectangle(x-230-1,y-230-1,x+230+1,y+230+1);
rectangle(x-230-2,y-230-2,x+230+2,y+230+2);

line(x-252+1,y+228+4,x-340-1,y+228+4);
line(x-252,y+228+3,x-340,y+228+3);
line(x-252-1,y+228+2,x-340+1,y+228+2);
line(x-252-2,y+228+1,x-340+2,y+228+1);

line(x-252,y-229+70,x-252,y+228+2);
line(x-252-2,y-229+2+70,x-252-2,y+228-2+2);
line(x-252-1,y-229+1+70,x-252-1,y+228-1+2);
line(x-252+1,y-229-1+70,x-252+1,y+228+1+2);
setcolor(8);


line(x-230,y-230,x+230,y-230);
line(x-230-2,y-230-2,x+230+2,y-230-2);
line(x-230-1,y-230-1,x+230+1,y-230-1);
line(x-230+1,y-230+1,x+230-1,y-230+1);

line(x-230,y-230,x-230,y+230);
line(x-230+1,y-230,x-230+1,y+230-1);
line(x-230-1,y-230,x-230-1,y+230+1);
line(x-230-2,y-231,x-230-2,y+230+2);
Memory_Allocator=0;
}

setfillstyle(1,Demon_Cell_Color);

bar(x-13-27*2,y+25-11,x-13+27*3,y+40);
bar(x-13-27*2,y+25-11-27*2,x-13-27,y+25-10);
bar(x-13+27*2,y+25-11-27*2,x-13+27*3,y+25-10);
bar(x-13-27,y+25-11-27*2,x-13,y+25-10-30);
bar(x-13+27,y+25-11-27*2,x-13+27*2,y+25-10-30);

if(Skin==1)
setcolor(7);
else if(Skin==2)
setcolor(LIGHTBLUE);
else
setcolor(0);

for(int dod=0;dod<4;dod++)
line(x-15-25+dod*27,y+25-11,x-40+dod*27,y+39);
line(x-15-25-27,y+40-2*27,x-40,y+40-2*27);
line(x-15-25+27*3,y+40-2*27,x-40+27*4,y+40-2*27);
line(x-15-25-27,y+40-27,x-40,y+40-27);

line(x-15-25+27*3,y+40-27,x-40+27*4,y+40-27);
line(x-15-25+3*27,y-2*27+25-11,x-40+3*27,y-27+39);
line(x-15-25,y+25-11-2*27,x-40,y+39-27);

setfillstyle(SOLID_FILL,7);
bar(x+235,y-240,x+265,y+240);
bar(x-273,y-225,x-260,y-204);
setfillstyle(SOLID_FILL,0);
bar(x-335,y-230+75,x-258,y+225);
for(int chan=0;chan
{
  setcolor(YELLOW);
  setfillstyle(SOLID_FILL,YELLOW);
  circle(x+250-1,y+214-34*chan+7,11);
  circle(x-5+250-1,y+211-34*chan+7,2);
  circle(x+5+250-1,y+211-34*chan+7,2);
  floodfill(x+250-1,y+214-34*chan+7,YELLOW);
  setcolor(0);
  setfillstyle(SOLID_FILL,0);
  circle(x+250-1,y+219-34*chan+7,2);
  floodfill(x+250-1,y+219-34*chan+7,0);
}
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
 setcolor(4);
 switch(Level)
 {
  case 1:   outtextxy(x-272,y-228-1,"1");break;
  case 2:   outtextxy(x-272,y-228-1,"2");break;
  case 3:   outtextxy(x-272,y-228-1,"3");break;
  case 4:   outtextxy(x-272,y-228-1,"4");break;
  case 5:   outtextxy(x-272,y-228-1,"5");break;
  case 6:   outtextxy(x-272,y-228-1,"6");break;
  case 7:   outtextxy(x-272,y-228-1,"7");break;
  case 8:   outtextxy(x-272,y-228-1,"8");break;
  case 9:   outtextxy(x-272,y-228-1,"9");break;
  case 10:   outtextxy(x-272,y-228-1,"10");break;
  case 11:   outtextxy(x-272,y-228-1,"11");break;
  case 12:   outtextxy(x-272,y-228-1,"12");break;
  case 13:   outtextxy(x-272,y-228-1,"13");break;
  case 14:   outtextxy(x-272,y-228-1,"14");break;
  case 15:   outtextxy(x-272,y-228-1,"15");break;
  case 16:   outtextxy(x-272,y-228-1,"16");break;
  case 17:   outtextxy(x-272,y-228-1,"17");break;
  case 18:   outtextxy(x-272,y-228-1,"18");break;
  case 19:   outtextxy(x-272,y-228-1,"19");break;
  case 20:   outtextxy(x-272,y-228-1,"20");break;
  default:   outtextxy(x-272,y-228-1,"20+");break;
  }
 setcolor(RED);
 outtextxy(x-340,y-230+1,"Level");

         settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
         setcolor(RED);
         outtextxy(x-315,y+195,"Pause");
         outtextxy(x-315,y+205,"ENTER");

 putimage(x-12,y-12,Demon[0],0);
 putimage(x-12-27,y-12,Demon[1],0);
 putimage(x-12+27,y-12,Demon[2],0);


}
void Glutton_Gets_Caught()
{
 int diminisher=0;
 putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
 putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
 putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
 putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);

 for(int oo=400;oo>=150;oo-=25)
 {
  diminisher++;
  setcolor(YELLOW);
  circle(x-27*txt,y+11+123-27*tyt,11-diminisher);
  sound(oo);
  delay(100);
  setcolor(Bkgd_Color);
  circle(x-27*txt,y+11+123-27*tyt,11-diminisher);
 }
 nosound();
 setcolor(YELLOW);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+5,y+11+123-27*tyt);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+4,y+11+123-27*tyt+4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+4,y+11+123-27*tyt-4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt,y+11+123-27*tyt+5);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt,y+11+123-27*tyt-5);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-4,y+11+123-27*tyt+4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-4,y+11+123-27*tyt-4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-5,y+11+123-27*tyt);
 setcolor(Bkgd_Color);
 circle(x-27*txt,y+11+123-27*tyt,1);
 circle(x-27*txt,y+11+123-27*tyt,2);
 delay(500);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+5,y+11+123-27*tyt);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+4,y+11+123-27*tyt+4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt+4,y+11+123-27*tyt-4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt,y+11+123-27*tyt+5);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt,y+11+123-27*tyt-5);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-4,y+11+123-27*tyt+4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-4,y+11+123-27*tyt-4);
 line(x-27*txt,y+11+123-27*tyt,x-27*txt-5,y+11+123-27*tyt);
 putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
}

void Switcher(int Directionection,int Glutton_Mode,int Demon_Number)
{

    switch(Directionection)
    {
    case UP:           if(Demon_Squares[Curr_Pos_Demon[Demon_Number]-1]==1&&( (Curr_Pos_Demon[Demon_Number]-1)!=-1&&(Curr_Pos_Demon[Demon_Number]-1)!=271&&(Curr_Pos_Demon[Demon_Number]-1)!=254&&(Curr_Pos_Demon[Demon_Number]-1)!=237&&(Curr_Pos_Demon[Demon_Number]-1)!=220&&(Curr_Pos_Demon[Demon_Number]-1)!=203&&(Curr_Pos_Demon[Demon_Number]-1)!=186&&(Curr_Pos_Demon[Demon_Number]-1)!=169&&(Curr_Pos_Demon[Demon_Number]-1)!=152&&(Curr_Pos_Demon[Demon_Number]-1)!=135&&(Curr_Pos_Demon[Demon_Number]-1)!=118&&(Curr_Pos_Demon[Demon_Number]-1)!=101&&(Curr_Pos_Demon[Demon_Number]-1)!=84&&(Curr_Pos_Demon[Demon_Number]-1)!=67&&(Curr_Pos_Demon[Demon_Number]-1)!=50&&(Curr_Pos_Demon[Demon_Number]-1)!=33&&(Curr_Pos_Demon[Demon_Number]-1)!=16) )
               {
            if(Dot_Squares[Curr_Pos_Demon[Demon_Number]]==1)
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Dot_Replacer,0);
            else
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Blank_Replacer,0);
            d_tyt[Demon_Number]++;
            Curr_Pos_Demon[Demon_Number]--;
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Demon[Demon_Number],0);
            if(Glutton_Mode==2)
            {setcolor(RED);
            circle(x-27*d_txt[Demon_Number],y-27*d_tyt[Demon_Number],10);}
            Demon_Column_Number[Demon_Number]=Column_Detector(Curr_Pos_Demon[Demon_Number]);
            Demon_Row_Number[Demon_Number]=Row_Detector(Curr_Pos_Demon[Demon_Number]);
               } break;
    case LEFT:           if(Demon_Squares[Curr_Pos_Demon[Demon_Number]-17]==1&&!((Curr_Pos_Demon[Demon_Number])>=0&&(Curr_Pos_Demon[Demon_Number])<=16))
               {
            if(Dot_Squares[Curr_Pos_Demon[Demon_Number]]==1)
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Dot_Replacer,0);
            else
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Blank_Replacer,0);
            d_txt[Demon_Number]++;
            Curr_Pos_Demon[Demon_Number]-=17;
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Demon[Demon_Number],0);
            if(Glutton_Mode==2)
            {setcolor(RED);
            circle(x-27*d_txt[Demon_Number],y-27*d_tyt[Demon_Number],10);}
            Demon_Column_Number[Demon_Number]=Column_Detector(Curr_Pos_Demon[Demon_Number]);
            Demon_Row_Number[Demon_Number]=Row_Detector(Curr_Pos_Demon[Demon_Number]);
               }
               break;

    case DOWN:           if(Demon_Squares[Curr_Pos_Demon[Demon_Number]+1]==1&&( (Curr_Pos_Demon[Demon_Number]+1)!=289&&(Curr_Pos_Demon[Demon_Number]+1)!=272&&(Curr_Pos_Demon[Demon_Number]+1)!=255&&(Curr_Pos_Demon[Demon_Number]+1)!=238&&(Curr_Pos_Demon[Demon_Number]+1)!=221&&(Curr_Pos_Demon[Demon_Number]+1)!=204&&(Curr_Pos_Demon[Demon_Number]+1)!=187&&(Curr_Pos_Demon[Demon_Number]+1)!=170&&(Curr_Pos_Demon[Demon_Number]+1)!=153&&(Curr_Pos_Demon[Demon_Number]+1)!=136&&(Curr_Pos_Demon[Demon_Number]+1)!=119&&(Curr_Pos_Demon[Demon_Number]+1)!=102&&(Curr_Pos_Demon[Demon_Number]+1)!=85&&(Curr_Pos_Demon[Demon_Number]+1)!=68&&(Curr_Pos_Demon[Demon_Number]+1)!=51&&(Curr_Pos_Demon[Demon_Number]+1)!=34&&(Curr_Pos_Demon[Demon_Number]+1)!=17) )
               {
            if(Dot_Squares[Curr_Pos_Demon[Demon_Number]]==1)
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Dot_Replacer,0);
            else
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Blank_Replacer,0);
            d_tyt[Demon_Number]--;
            Curr_Pos_Demon[Demon_Number]++;
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Demon[Demon_Number],0);
            if(Glutton_Mode==2)
            {setcolor(RED);
            circle(x-27*d_txt[Demon_Number],y-27*d_tyt[Demon_Number],10);}
            Demon_Column_Number[Demon_Number]=Column_Detector(Curr_Pos_Demon[Demon_Number]);
            Demon_Row_Number[Demon_Number]=Row_Detector(Curr_Pos_Demon[Demon_Number]);
               } break;

    case RIGHT:           if(Demon_Squares[Curr_Pos_Demon[Demon_Number]+17]==1&&!((Curr_Pos_Demon[Demon_Number])>=272&&(Curr_Pos_Demon[Demon_Number])<=288))
               {
            if(Dot_Squares[Curr_Pos_Demon[Demon_Number]]==1)
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Dot_Replacer,0);
            else
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Blank_Replacer,0);
            d_txt[Demon_Number]--;
            Curr_Pos_Demon[Demon_Number]+=17;
            putimage(x-12-27*d_txt[Demon_Number],y-12-27*d_tyt[Demon_Number],Demon[Demon_Number],0);
            if(Glutton_Mode==2)
            {setcolor(RED);
            circle(x-27*d_txt[Demon_Number],y-27*d_tyt[Demon_Number],10);}
            Demon_Column_Number[Demon_Number]=Column_Detector(Curr_Pos_Demon[Demon_Number]);
            Demon_Row_Number[Demon_Number]=Row_Detector(Curr_Pos_Demon[Demon_Number]);
               }
               break;

    default:           break;
    }
}


void Demon_Director(int demon_Power_Dot_Status_ber,int Column_Number,int Row_Number)
{
int dec_Row_Detector,dec_col;
           dec_col=(Column_Number-Demon_Column_Number[demon_Power_Dot_Status_ber]);
           dec_Row_Detector=(Row_Number-Demon_Row_Number[demon_Power_Dot_Status_ber]);


    if(Dir_Demon[demon_Power_Dot_Status_ber]==LEFT)
    {
     if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)>=0)//path unblocked
     {
          if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
           if(dec_Row_Detector<=0)
           Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
          case 1:
           if(dec_Row_Detector<0)
           Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
          case 2:
           if(dec_Row_Detector<=0)
           Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==0&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
          case 1:
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
          case 2:
         if(dec_Row_Detector>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
             if(dec_Row_Detector<0)
             Dir_Demon[demon_Power_Dot_Status_ber]=1;
             if(dec_Row_Detector>=0)
             Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
          case 1:
             if(dec_Row_Detector<=0)
             Dir_Demon[demon_Power_Dot_Status_ber]=1;
             if(dec_Row_Detector>=0)
             Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
          case 2:
             if(dec_Row_Detector<=0)
             Dir_Demon[demon_Power_Dot_Status_ber]=1;
             if(dec_Row_Detector>0)
             Dir_Demon[demon_Power_Dot_Status_ber]=3; break;
         }
          }
     }

     else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)<0)//path blocked
     {
          if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]%17==0))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;
          else if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==0||((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17==0))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=1;
          if( Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17!=0 && Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber])%17!=0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
          if(dec_Row_Detector>0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;
          else if(dec_Row_Detector<=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1; break;
          case 1:
          if(dec_Row_Detector>=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;
          else if(dec_Row_Detector<0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1; break;
          case 2:
          if(dec_Row_Detector>0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;
          else if(dec_Row_Detector<=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1; break;
         }
          }
     }
    }


    else if(Dir_Demon[demon_Power_Dot_Status_ber]==RIGHT)
    {
     if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)<=288)//path unblocked
     {
          if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
          if(dec_Row_Detector<=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1;    break;
          case 1:
          if(dec_Row_Detector<=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1;    break;
          case 2:
          if(dec_Row_Detector<0)
          Dir_Demon[demon_Power_Dot_Status_ber]=1;    break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==0&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
          if(dec_Row_Detector>=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;  break;
          case 1:
          if(dec_Row_Detector>=0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;  break;
          case 2:
          if(dec_Row_Detector>0)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;  break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_Row_Detector<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;    break;
          case 1:
         if(dec_Row_Detector<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;
         if(dec_Row_Detector>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;    break;
          case 2:
         if(dec_Row_Detector<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;    break;
         }
          }
     }

     else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)>288)//path blocked
     {
          if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]%17==0))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=3;
          else if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==0||((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17==0))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=1;
          if( Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17!=0 && Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber])%17!=0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_Row_Detector>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;
         else if(dec_Row_Detector<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
          case 1:
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;
         else if(dec_Row_Detector<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
          case 2:
         if(dec_Row_Detector>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=3;
         else if(dec_Row_Detector<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=1;  break;
         }
          }
     }
    }



    else if(Dir_Demon[demon_Power_Dot_Status_ber]==UP)
    {
     if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==1&&Curr_Pos_Demon[demon_Power_Dot_Status_ber]%17!=0)//path unblocked
     {
          if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
          case 1:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
          case 2:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
        }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==0&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
          case 1:
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
          case 2:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;   break;
          case 1:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;   break;
          case 2:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;   break;
         }
          }
     }

     else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-1]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber])%17==0)//path blocked
     {
          if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)<0)&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=4;
          else if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==0||((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)>288))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=2;
          if( Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1&&((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)<=288) && Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)>=0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
          case 1:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
          case 2:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;  break;
         }
          }
     }
    }

    else if(Dir_Demon[demon_Power_Dot_Status_ber]==DOWN)
    {
     if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17!=0)//path unblocked
     {
          if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;break;
          case 1:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;break;
          case 2:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==0&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;break;
          case 1:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;break;
          case 2:
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;break;
         }
          }
          else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4; break;
          case 1:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4; break;
          case 2:
         if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2;
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4; break;
         }
          }
     }

     else if(Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]+1)%17==0)//path blocked
     {
          if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==0||(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)<0)&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=4;
          else if((Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==0||((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)>288))&&Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1)
          Dir_Demon[demon_Power_Dot_Status_ber]=2;
          if( Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17]==1&&((Curr_Pos_Demon[demon_Power_Dot_Status_ber]+17)<=288) && Demon_Squares[Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17]==1&&(Curr_Pos_Demon[demon_Power_Dot_Status_ber]-17)>=0)
          {
         switch(demon_Power_Dot_Status_ber)
         {
          case 0:
         if(dec_col>0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2; break;
          case 1:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2; break;
          case 2:
         if(dec_col>=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=4;
         else if(dec_col<=0)
         Dir_Demon[demon_Power_Dot_Status_ber]=2; break;
        }
          }
     }
    }
}


void Glutton_Catches_Demon_in_Mode2(int Glutton_Mode)
{

    if(Curr_Pos_Glut==Curr_Pos_Demon[0]&&Glutton_Mode==2)
    {
         putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
         Curr_Pos_Demon[0]=144;
         d_txt[0]=0;
         d_tyt[0]=2;
         Score+=(100*Level);
         Sound_Glutton_Catches_Demon();
    }
    if(Curr_Pos_Glut==Curr_Pos_Demon[1]&&Glutton_Mode==2)
    {
         putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
         Curr_Pos_Demon[1]=144;
         d_txt[1]=0;
         d_tyt[1]=2;
         Score+=(100*Level);
         Sound_Glutton_Catches_Demon();
    }
    if(Curr_Pos_Glut==Curr_Pos_Demon[2]&&Glutton_Mode==2)
    {
         putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);
         Curr_Pos_Demon[2]=144;
         d_txt[2]=0;
         d_tyt[2]=2;
         Score+=(100*Level);
         Sound_Glutton_Catches_Demon();
    }
}
void Blink_Dots(int loop,int Power_Dot_Status_1,int Power_Dot_Status_2,int Power_Dot_Status_3,int Power_Dot_Status_4)
{
    setcolor(8);
    if(loop%3!=0)
    setfillstyle(SOLID_FILL,LIGHTGREEN);
    else
    setfillstyle(SOLID_FILL,0);

 if(Dot_Squares[36]==1||Power_Dot_Status_1==1)
 {
 circle(x-216+27*2,y-216+27*(36%17),6);
 floodfill(x-216+27*2,y-216+27*(36%17),8);
 }
 if(Dot_Squares[48]==1||Power_Dot_Status_2==1)
 {
 circle(x-216+27*2,y-216+27*(48%17),6);
 floodfill(x-216+27*2,y-216+27*(48%17),8);
 }
 if(Dot_Squares[252]==1||Power_Dot_Status_4==1)
 {
 circle(x-216+27*14,y-216+27*(252%17),6);
 floodfill(x-216+27*14,y-216+27*(252%17),8);
 }
 if(Dot_Squares[240]==1||Power_Dot_Status_3==1)
 {
 circle(x-216+27*14,y-216+27*(240%17),6);
 floodfill(x-216+27*14,y-216+27*(240%17),8);
 }
}

void Ask_For_Exit()
{
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
    setcolor(0);
    outtextxy(x-315,y+195,"Pause");
    outtextxy(x-315,y+205,"ENTER");
    setcolor(2);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
    outtextxy(x-312,y+175,"Quit");
    setcolor(10);
    circle(x-313,y+205,10);
    circle(x-280,y+205,10);
    circle(x-313,y+205,9);
    circle(x-280,y+205,9);
    setfillstyle(SOLID_FILL,7);
    floodfill(x-313,y+205,10);
    floodfill(x-280,y+205,10);
    setcolor(14);
    outtextxy(x-313-3,y+202,"y");
    outtextxy(x-280-3,y+202,"n");

    while(1)
    {
        ii.h.ah=0;
        int86(22,&ii,&oo);
        if(oo.h.ah==21)
        {
         setcolor(2);
         circle(x-313,y+205,10);
         circle(x-313,y+205,9);
         setcolor(8);
             outtextxy(x-313-3,y+202,"y");
         delay(500);
         setcolor(10);
         circle(x-313,y+205,10);
         circle(x-313,y+205,9);
         setcolor(14);
             outtextxy(x-313-3,y+202,"y");
         delay(500);
        free(Glut_Face_1);free(Glut_Face_2);free(Glut_Face_3);free(Blank_Replacer);free(Dot_Replacer);free(Glut_Power);
        free(Demon[0]);free(Demon[1]);free(Demon[2]);
        closegraph();exit(0);
        }
        if(oo.h.ah==49)
        {
         setcolor(2);
         circle(x-280,y+205,10);
         circle(x-280,y+205,9);
         setcolor(8);
             outtextxy(x-280-3,y+202,"n");
         delay(500);
         setcolor(10);
         circle(x-280,y+205,10);
         circle(x-280,y+205,9);
         setcolor(14);
             outtextxy(x-280-3,y+202,"n");
         delay(500);
         setfillstyle(SOLID_FILL,0);
         bar(x-336,y+160,x-255,y+225);
         settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
         setcolor(4);
             outtextxy(x-315,y+195,"Pause");
             outtextxy(x-315,y+205,"ENTER");
         break;
        }
    }
}

void Pause_The_Game()
{
    int blinker=0;
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
    setcolor(0);
    outtextxy(x-315,y+195,"Pause");
    outtextxy(x-315,y+205,"ENTER");
    setcolor(6);
    outtextxy(x-320,y-3,"Paused");

    while(1)
    {
        blinker++;
        if(kbhit())
        {
        ii.h.ah=0;
        int86(22,&ii,&oo);
        if(oo.h.ah==28)
        break;
        }
        setcolor(14);
        outtextxy(x-315,y+185,"Press");
        if(blinker%10<5)
         setcolor(0);
        else
         setcolor(4);
        settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
         outtextxy(x-335,y+205,"ENTER");
        settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
        if(blinker>1000)
           blinker=0;
    }
    setcolor(0);
    outtextxy(x-315,y+185,"Press");
    outtextxy(x-320,y-3,"Paused");
    settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
    outtextxy(x-335,y+205,"ENTER");
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
    setcolor(RED);
    outtextxy(x-315,y+195,"Pause");
    outtextxy(x-315,y+205,"ENTER");
}
int Glutton_Director()
{
int get=0;
   switch(Direction)
   {
    case UP:           if(Glutton_Squares[Curr_Pos_Glut-1]==1&&( (Curr_Pos_Glut-1)!=-1&&(Curr_Pos_Glut-1)!=271&&(Curr_Pos_Glut-1)!=254&&(Curr_Pos_Glut-1)!=237&&(Curr_Pos_Glut-1)!=220&&(Curr_Pos_Glut-1)!=203&&(Curr_Pos_Glut-1)!=186&&(Curr_Pos_Glut-1)!=169&&(Curr_Pos_Glut-1)!=152&&(Curr_Pos_Glut-1)!=135&&(Curr_Pos_Glut-1)!=118&&(Curr_Pos_Glut-1)!=101&&(Curr_Pos_Glut-1)!=84&&(Curr_Pos_Glut-1)!=67&&(Curr_Pos_Glut-1)!=50&&(Curr_Pos_Glut-1)!=33&&(Curr_Pos_Glut-1)!=16) )
               {
            if(Dot_Squares[Curr_Pos_Glut-1]==1)
            {snd(loop);Score+=10;}
            else
            delay(40);
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            tyt++;
            Curr_Pos_Glut--;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Dot_Squares[Curr_Pos_Glut]=0;
            get=Check_For_Level_Completion();
            if(get==1){
            sleep(1);
            putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
            putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
            putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            return 1;
            }
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               } break;
    case LEFT:           if(Glutton_Squares[Curr_Pos_Glut-17]==1&&!((Curr_Pos_Glut)>=0&&(Curr_Pos_Glut)<=16))
               {
            if(Dot_Squares[Curr_Pos_Glut-17]==1)
            {snd(loop);Score+=10;}
            else
            delay(40);
            Dot_Squares[Curr_Pos_Glut]=0;
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            txt++;
            Curr_Pos_Glut-=17;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==1)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Dot_Squares[Curr_Pos_Glut]=0;
            get=Check_For_Level_Completion();
            if(get==1){
            sleep(1);
            putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
            putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
            putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            return 1;
            }
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               }
               if(Curr_Pos_Glut==229)
               {
            sound(500);
            delay(40);
            nosound();
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            txt=5;
            tyt=5;
            Curr_Pos_Glut=59;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==1)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               }

               break;

    case DOWN:           if(Glutton_Squares[Curr_Pos_Glut+1]==1&&( (Curr_Pos_Glut+1)!=289&&(Curr_Pos_Glut+1)!=272&&(Curr_Pos_Glut+1)!=255&&(Curr_Pos_Glut+1)!=238&&(Curr_Pos_Glut+1)!=221&&(Curr_Pos_Glut+1)!=204&&(Curr_Pos_Glut+1)!=187&&(Curr_Pos_Glut+1)!=170&&(Curr_Pos_Glut+1)!=153&&(Curr_Pos_Glut+1)!=136&&(Curr_Pos_Glut+1)!=119&&(Curr_Pos_Glut+1)!=102&&(Curr_Pos_Glut+1)!=85&&(Curr_Pos_Glut+1)!=68&&(Curr_Pos_Glut+1)!=51&&(Curr_Pos_Glut+1)!=34&&(Curr_Pos_Glut+1)!=17) )
               {
            if(Dot_Squares[Curr_Pos_Glut+1]==1)
            {snd(loop);Score+=10;}
            else
            delay(40);
            Dot_Squares[Curr_Pos_Glut]=0;
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            tyt--;
            Curr_Pos_Glut++;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==1)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Dot_Squares[Curr_Pos_Glut]=0;
            get=Check_For_Level_Completion();
            if(get==1){
            sleep(1);
            putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
            putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
            putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            return 1;
            }
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               } break;

    case RIGHT:           if(Glutton_Squares[Curr_Pos_Glut+17]==1&&!((Curr_Pos_Glut)>=272&&(Curr_Pos_Glut)<=288))
               {
            if(Dot_Squares[Curr_Pos_Glut+17]==1)
            {snd(loop);Score+=10;}
            else
            delay(40);
            Dot_Squares[Curr_Pos_Glut]=0;
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            txt--;
            Curr_Pos_Glut+=17;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==1)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Dot_Squares[Curr_Pos_Glut]=0;
            get=Check_For_Level_Completion();
            if(get==1){
            sleep(1);
            putimage(x-12-27*d_txt[0],y-12-27*d_tyt[0],Blank_Replacer,0);
            putimage(x-12-27*d_txt[1],y-12-27*d_tyt[1],Blank_Replacer,0);
            putimage(x-12-27*d_txt[2],y-12-27*d_tyt[2],Blank_Replacer,0);
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            return 1;
            }
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               }
               if(Curr_Pos_Glut==59)
               {
            sound(500);
            delay(40);
            nosound();
            putimage(x-11-27*txt,y+123-27*tyt,Blank_Replacer,0);
            txt=-5;
            tyt=5;
            Curr_Pos_Glut=229;
            if(Glutton_Mode==1)
            {
                if(Curr_Pos_Glut%3==0)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
                else if(Curr_Pos_Glut%3==1)
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
                else
                putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);
            }
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
            Column_Number=Column_Detector(Curr_Pos_Glut);
            Row_Number=Row_Detector(Curr_Pos_Glut);
               }
               break;

    default:           break;
    }
    return 0;
}
void Glutton_Gets_Power()
{

int Demon_Runs_Back=0;

if(Curr_Pos_Glut==36&&Power_Dot_Status_1==1)
{
 Power_Dot_Status_1=0;
 Power_Dot_Status_1=0;
 Demon_Runs_Back=1;
 Power_Mode_Timer=loop;
 Glutton_Mode=2;
 Sound_Mode_Conversion();
 putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
}
if(Curr_Pos_Glut==48&&Power_Dot_Status_2==1)
{
 Power_Dot_Status_2=0;
 Power_Dot_Status_2=0;
 Demon_Runs_Back=1;
 Power_Mode_Timer=loop;
 Glutton_Mode=2;
 Sound_Mode_Conversion();
 putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);

}
if(Curr_Pos_Glut==240&&Power_Dot_Status_3==1)
{
 Power_Dot_Status_3=0;
 Power_Dot_Status_3=0;
 Demon_Runs_Back=1;
 Power_Mode_Timer=loop;
 Glutton_Mode=2;
 Sound_Mode_Conversion();
 putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
}
if(Curr_Pos_Glut==252&&Power_Dot_Status_4==1)
{
 Power_Dot_Status_4=0;
 Power_Dot_Status_4=0;
 Demon_Runs_Back=1;
 Power_Mode_Timer=loop;
 Glutton_Mode=2;
 Sound_Mode_Conversion();
 putimage(x-11-27*txt,y+123-27*tyt,Glut_Power,0);
}
if(Glutton_Mode==2&&Demon_Runs_Back==1)
{
Demon_Runs_Back=0;
    if(Dir_Demon[0]==1)
    Dir_Demon[0]=3;
    else if(Dir_Demon[0]==2)
    Dir_Demon[0]=4;
    else if(Dir_Demon[0]==3)
    Dir_Demon[0]=1;
    else
    Dir_Demon[0]=2;

    if(Dir_Demon[1]==1)
    Dir_Demon[1]=3;
    else if(Dir_Demon[1]==2)
    Dir_Demon[1]=4;
    else if(Dir_Demon[1]==3)
    Dir_Demon[1]=1;
    else
    Dir_Demon[1]=2;

    if(Dir_Demon[2]==1)
    Dir_Demon[2]=3;
    else if(Dir_Demon[2]==2)
    Dir_Demon[2]=4;
    else if(Dir_Demon[2]==3)
    Dir_Demon[2]=1;
    else
    Dir_Demon[2]=2;
}

}
void Glutton_Loses_Power()
{
if(Level<=10)
{if(loop==Power_Mode_Timer+33-Level*3)
    {
     Glutton_Mode=1;
     Power_Mode_Timer=0;
        if(Curr_Pos_Glut%3==0)
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
            else if(Curr_Pos_Glut%3==0)
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);

    }}
else
if(loop==Power_Mode_Timer+2)
    {
     Glutton_Mode=1;
     Power_Mode_Timer=0;
            if(Curr_Pos_Glut%3==0)
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_1,0);
            else if(Curr_Pos_Glut%3==0)
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_2,0);
            else
            putimage(x-11-27*txt,y+123-27*tyt,Glut_Face_3,0);

    }
}
void Demon_Director()
{
int ran;
randomize();
ran=random(10);
if(ran%10==0)
    {Dir_Demon[0]=1;Dir_Demon[1]=4;Dir_Demon[2]=1;}
else if(ran%10==1)
    {Dir_Demon[0]=2;Dir_Demon[1]=2;Dir_Demon[2]=1;}
else if(ran%10==2)
    {Dir_Demon[0]=2;Dir_Demon[1]=1;Dir_Demon[2]=4;}
else if(ran%10==3)
    {Dir_Demon[0]=1;Dir_Demon[1]=4;Dir_Demon[2]=1;}
else if(ran%10==4)
    {Dir_Demon[0]=4;Dir_Demon[1]=1;Dir_Demon[2]=2;}
else if(ran%10==5)
    {Dir_Demon[0]=4;Dir_Demon[1]=2;Dir_Demon[2]=2;}
else if(ran%10==6)
    {Dir_Demon[0]=1;Dir_Demon[1]=4;Dir_Demon[2]=4;}
else if(ran%10==7)
    {Dir_Demon[0]=1;Dir_Demon[1]=2;Dir_Demon[2]=1;}
else if(ran%10==8)
    {Dir_Demon[0]=1;Dir_Demon[1]=1;Dir_Demon[2]=4;}
else
    {Dir_Demon[0]=4;Dir_Demon[1]=1;Dir_Demon[2]=2;}
}
void Bonus_Awarder()
{

 if(Bonus_Counter>loop)
 Bonus_Counter++;
 else if(Bonus_Counter
 Bonus_Counter=loop;

if(Bonus_Counter==120||Bonus==1)
{
    setcolor(Level);
    setfillstyle(SOLID_FILL,Level);
    circle(x,y+108,5);
    circle(x-3,y+108,3);
    circle(x+3,y+108,3);
    circle(x,y+108-3,3);
    circle(x,y+108+3,3);
    Bonus=1;
}

if(Bonus_Counter==155&&Bonus==1)
{
    putimage(x-12,y+96,Blank_Replacer,0);
    Bonus=0;
}

if(Bonus==1&&Curr_Pos_Glut==148)
{
 Score+=(Level*500);
 for(int o=0;o<15;o++)
 {
 sound(450+20*o);
 delay(4);
 }
 nosound();
 Bonus=0;
}
}

Copyright © 2009 virtualinfocom All rights reserved. Theme by Games. | animation Ani2Pix.