2011 m. balandžio 13 d., trečiadienis

"Priešistorė", III dalis

Žemiau pateikiu "baisią" programą, kurią rašiau pamenu nemažai laiko.
Apskritai, buvau pamiršęs ir nemokėjau susiveikti grafinės aplinkos, tai teko pasitenkinti ASCII grafika, t.y. simbolių grafika.
Programos kodas toks baisus, kad pats nedrįsčiau dabar skirti valandos laiko jo perpratimui.
2008-10-08.
Programos mintis buvo gauti "materialų tašką", kuris turėdamas tam tikrą greitį, galėtų judėti stačiakampėje plokštumoje tam tikra (reikia įvesti) kryptimi.
Dar įdėjau programoje "navarotą" - pyptelėjimą po kiekvieno "materialiojo taško" pasislinkimo (žingsnio). O "grafika" atnaujinama dirbtinai, užpildant ekraną tūkstančių eilės skaičiumi vienodų "tuštumą reiškiančių" simbolių :) .

Vualia:

program entr1;
uses crt;
var a,e,f,b,c,c1,c2,c3,d,ax,adx,ay,ady,o,m,n,k,l,p,r,s,t,u,v:integer;
begin
clrscr;
randomize;

writeln('Raide lauke 2008-10-08 (pradzia - spauskite "2" ir "Enter")');

c1:=2;
c2:=5;
c3:=3;
textcolor(c2);

readln(o);
if o=2
then
begin

ax:=random(20)-10;
ay:=random(20)-10;

end;

ax:=40;
ay:=12;
adx:=0;
ady:=0;
m:=0;
repeat
delay(300);
m:=m+1;
begin

clrscr;

end;

ay:=ay+ady;
if ay<2 then ady:=-ady;
if ay>24 then ady:=-ady;
if ay<1 then ay:=1;
if ay>25 then ay:=25;
u:=0;
if ay<>1 then
repeat
u:=u+1;
if u=1 then textcolor(c1) else textcolor(c2);
begin

v:=0;
repeat
v:=v+1;
if v=1 then textcolor(c1);
if v=80 then textcolor(c1);
if u=1 then textcolor(c1);
write('_');
textcolor(c2);
until v=80;

end;

until u=ay-1;

e:=0;
begin

ax:=ax+adx;
if ax<2 then adx:=-adx;
if ax>79 then adx:=-adx;
if ax>80 then ax:=80;
if ax<1 then ax:=1;
n:=0;
if ax<>1 then
repeat
e:=e+1;
if e=1 then textcolor(c1) else textcolor(c2);

write('_');
until e=ax-1;
textcolor(c3);
write('H');
textcolor(c2);
if ax<>80 then
repeat
e:=e+1;
if e=79 then textcolor(c1) else textcolor(c2);
write('_');
until e=79;

end;

if u<24 then
repeat
u:=u+1;

begin

v:=0;
repeat
v:=v+1;
if v=1 then textcolor(c1);
if v=80 then textcolor(c1);
if u=24 then textcolor(c1);
write('_');
textcolor(c2);
until v=80;

end;
textcolor(c2)
until u=24;
delay(300);

if m=1 then
begin
writeln;
textcolor(3);
writeln('Raide stovi lauke 80x25. Iveskite judejimo vektorius x,y (svekuosius)');
readln(adx);
readln(ady);
textcolor(c2);
end;

until m=20;

readln;

end.

Komentarų nėra:

Rašyti komentarą