• Viernes 29 de Marzo de 2024, 00:14

Autor Tema:  un juego en pascal  (Leído 1922 veces)

keko

  • Nuevo Miembro
  • *
  • Mensajes: 9
    • Ver Perfil
un juego en pascal
« en: Lunes 13 de Enero de 2003, 12:45 »
0
un juego en pascal criticas constructivas vale?

program musica;
uses crt;
var
te:char;
as,cox,le,er,pu,x,bo,a,b,c,num:integER;
sin:array[1..40] of byte;

procedure GRITAAA;
var
za,ze:integer;
BEGIN
za:=random(1100);
if za<700 then za:=700;
FOR ZE:=0 TO ZA DO
      BEGIN
      SOUND(1000-ZE);
      DELAY(1);
      SOUND(RANDOM(90)+ZE);
      DELAY(1);
      END;
      NOSOUND;
END;
procedure doo(d,k:integer);
begin
sound(65*(k+k));{do}
delay(d);{duracion nota}
nosound;
end;

procedure re(d,k:integer);
begin
sound(73*(k+k));{re}
delay(d);
nosound;
end;

procedure mi(d,k:integer);
begin
sound(82*(k+k));{mi}
delay(d);
nosound;
end;

procedure fa(d,k:integer);
begin
sound(87*(k+k));{fa}
delay(d);
nosound;
end;

procedure sol(d,k:integer);
begin
sound(98*(k+k));{sol}
delay(d);
nosound;
end;

procedure la(d,k:integer);
begin
sound(110*(k+k));{la}
delay(d);
nosound;
end;

procedure si(d,k:integer);
begin
sound(123*(k+k));{si}
delay(d);
nosound;
end;
procedure melodia;
begin
    for b:=1 to num do
     begin
     if sin<b>=0 then delay(300);
     if sin<b>=1 then doo(300,8);
     if sin<b>=2 then re(300,8);
     if sin<b>=3 then mi(300,8);
     if sin<b>=4 then fa(300,8);
     if sin<b>=5 then sol(300,8);
     if sin<b>=6 then la(300,8);
     if sin<b>=7 then si(300,8);
     end;
end;

begin
clrscr;
gotoxy(3,1);write('un juego de EIO&EGO 2003');
fa(600,8);mi(600,8);re(1000,8);mi(600,8);sol(600,8);mi(600,8);
fa(600,8);mi(600,8);re(1000,8);
delay(2000);
doo(300,8);doo(300,8);sol(300,8);sol(300,8);la(300,8);la(300,8);
sol(600,8);fa(300,8);fa(300,8);mi(300,8);mi(300,8);re(300,8);re(300,8);doo(600,8);
delay(2000);
textmode(co40);
randomize;
clrscr;
cox:=10; {centrar los gotoxy }
pu:=1; {posicion de gotoxy para ?}
num:=2;{cuantas ? salen ej 5 ---> 3????}
le:=0; {de nivel}
as:=5; {5 repeticiones sube nivel}
 repeat
  {melodia}
  if bo=0 then
   begin
   pu:=1;
   er:=0;
   {melodia al azar}
   delay(2000);
   gotoxy(1,3);write('estamos en el nivel---> ',le);
   clrscr;
   gotoxy(1,3);write('estamos en el nivel---> ',le);
   for b:=2 to num do
    begin
    gotoxy(b,1+cox);write('?');
    end;
   for b:=1 to num do
   begin
   a:=random(8);
   sin<b>:=a;
   end;
   {suena melodia}
   melodia;
   bo:=1;
   gotoxy(1,1+cox);write(sin[1]);
   end;
 te:=' ';
 if keypressed then
  begin
  te:=readkey;
  pu:=pu+1;
  end;
 if te='0' then
  begin
  x:=0;
  end;
 if te='1' then
  begin
  x:=1;
  doo(300,8);
  end;
 if te='2' then
  begin
  x:=2;
  re(300,8);
  end;
 if te='3' then
  begin
  x:=3;
  mi(300,8);
  end;
 if te='4' then
  begin
  x:=4;
  fa(300,8);
  end;
 if te='5' then
  begin
  x:=5;
  sol(300,8);
  end;
 if te='6' then
  begin
  x:=6;
  la(300,8);
  end;
 if te='7' then
  begin
  x:=7;
  si(300,8);
  end;
 gotoxy(3,1);write('oido musical de EIOM301@HOTMAIL.COM');
 gotoxy(1,3);write('1=do 2=re 3=mi 4=fa 5=sol 6=la 7=si');
 gotoxy(1,4);write('0=silencio ESC=salir');
 gotoxy(1,3+cox);write('nivel:',le);
 gotoxy(1,4+cox);write(pu);
 {comprueba}
 if (sin[pu]=x) and (pu>1) then
  begin
  if pu=num then
    begin
    le:=le+1;
    if le>as then
     begin
     as:=as+5;
     num:=num+1;
     end;
    if num>=40 then num:=40;
    bo:=0;
    end;
  gotoxy(pu,1+cox);write(x);
  end;
 if (sin[pu]<>x) and (pu>1)  then
  begin
  er:=er+1;
  if er<5 then doo(700,1);
  if er>4 then gritaaa;
  gotoxy(pu,1+cox);write(x);
  delay(600);
  gotoxy(1,1+cox);write(sin[1]);
  for b:=2 to num do
   begin
   gotoxy(b,1+cox);write('?');
   end;
  pu:=1;
  melodia;
  end;
gotoxy(1,2+cox);write('Errores:',er);
until te=chr(27);
end.