program memorizacion;
uses
crt;
type
numero = array[1..6] of byte;
var
r, m, t : integer;
num : string[6];
tecla : char;
toma : byte;
elnume : numero;
cierto : boolean;
procedure memoria;
begin
clrscr;
randomize;
t := 1;
repeat
toma := 0;
toma := random(8) + 1;
elnume[t] := toma;
t := t + 1;
until t > 6;
write(' El Numero E#s : ');
for t := 1 to 6 do
write('',elnume[t]);
writeln;
delay(3000);
clrscr;
t := 3;
gotoxy(20,1);write(elnume[t]);
t := 5;
gotoxy(21,1);write(elnume[t]);
t := 2;
gotoxy(22,1);write(elnume[t]);
t := 1;
gotoxy(19,1);write(elnume[t]);
t := 4;
gotoxy(18,1);write(elnume[t]);
t := 6;
gotoxy(17,1);write(elnume[t]);
t := 1;
cierto := true;
writeln;
writeln;
repeat
r := 1;
gotoxy(2,4);write(' Intento N. ',t,' Numero : ');
repeat
tecla := readkey;
if tecla in['1'..'9'] then
begin
num[r] := tecla;
num[0] := chr(r);
gotoxy(28 + r,4);write(num[r]);
r := r + 1;
end;
if tecla = #8 then
begin
r := r - 1;
if r < 1 then
r := 1;
num[r] := ' ';
gotoxy(28 + r,4);write(' ');
end;
until r > 6;
for m := 1 to 6 do
begin
if elnume[m] = ord(num[m]) - 48 then
begin
end
else
cierto := false;
end;
if cierto = false then
begin
t := t + 1;
gotoxy(28 + r,4);clreol;
writeln;
end;
until (t > 3) or (cierto = true);
clrscr;
writeln;
if cierto = true then
begin
writeln(' Numero Correcto');
write(' ');
for t := 1 to 6 do
write(elnume[t]);
end
else
begin
writeln(' Numero Incorrecto');
write(' ');
for t := 1 to 6 do
write(elnume[t]);
end;
writeln;
writeln;
writeln(' Pulse Una Tecla');
readkey;
end;
procedure menu;
var
tecla : char;
sal : boolean;
begin
sal := false;
repeat
clrscr;
writeln;
writeln(' **** MEM(ORIZANDO NUMERO ****');
writeln;
writeln(' 1 = Jugar');
writeln(' 2 = Instrucciones');
writeln(' 3 = creditos');
writeln(' 4 = Salir');
writeln;
writeln(' Teclee la opcion deseada');
repeat
tecla := readkey;
until tecla in['1','2','3','4'];
clrscr;
case tecla of
'1' : begin
memoria;
end;
'2' : begin
writeln(' Tomada Opcion 2');
writeln(' Pulse Una Tecla');
readkey;
end;
'3' : begin
writeln(' Tomada Opcion 3');
writeln(' Pulse Una Tecla');
readkey;
end;
'4' : sal := true;
end;
until sal = true;
end;
begin
menu;
end.