//Otro juego muy conocido por nosotros que es ni mas ni menos que el mentado PINBALL

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<bios.h>
void main()
{
clrscr();
_setcursortype(_NOCURSOR);
int x=1,y=1,sx=0,sy=0,cont=0,z,bx=15,a=3000,b=0,d=1,c=0,e=0;
textcolor(WHITE);
while(1)
{

cont++;
if(cont==a)
{
nosound();
gotoxy(x,y);printf(" ");
if(x==80){sx=1;sound(200);}
if(x==1){sx=0;sound(200);}
if(sx)x--;
else x++;
if(y==19)c++;
if(y==19){if(x==bx+1||x==bx+2||x==bx+3||x==bx+4||x==bx+5||x==bx+6||x==bx+7){sy=1;sound(1000);b+=10;if(c==4){a-=100;d++;c=0;}}}
if(y==1){sy=0;sound(1000);}
if(sy)y--;
else y++;
textcolor(e);e++;
if(e==30)e=0;
gotoxy(x,y);cprintf("*");
textcolor(YELLOW);
textbackground(4);
gotoxy(65,25);cprintf("score: %d",b);
cont=0;
if(y==24){clrscr();if(b<500){textcolor(BLACK+BLINK);gotoxy(35,10);cprintf("YOU SUCK!");}
if(b>=500){textcolor(WHITE+BLINK);gotoxy(35,10);cprintf("YOU ROCK!");}
textcolor(YELLOW);
gotoxy(35,15);cprintf("GAME OVER");
gotoxy(32,16);cprintf("Final Score: %d",b);sound(1000);delay(200);
sound(900);delay(200);sound(800);delay(200);sound(700);delay(200);
sound(600);delay(200);sound(500);delay(200);sound(1000);delay(200);
sound(100);delay(500);nosound();
z=13;getch();clrscr();gotoxy(35,10);}
gotoxy(3,25);cprintf("level: %d",d);
textbackground(0);



}
if(kbhit())z=getch();
{
/* if(z==7181)break;
if(z==19200&&bx>2){bx--;z=0;}
if(z==19712&&bx<72){bx++;z=0;}*/
if(z==13)break;
if(z==65||z==97&&bx>2){bx--;z=0;}
if(z==68||z==100&&bx<72){bx++;z=0;}

gotoxy(bx,20);cprintf(" ");
}


}
nosound();
textcolor(7);
textbackground(0);
clrscr();
}