Pascal game for fun only
here is the code:
program wordguess;
uses crt;
var
a,b,c,d,e,f,g,k,l,m,n,o,p,q,r,s,t,i,skor:integer;
u:char;
ab,ac:array[1..100,1..100]of string;
ae:array[1..100]of string;
ad,af:array [1..100] of integer;
x,j,z:integer;
label
easy,medium,hard,proses,lanjut,hitung,permainan,prosesdua,ulang;
begin
d:=1;
n:=0;
m:=0;
textbackground(black);
clrscr;
begin
delay(1000);
textcolor(white);
gotoxy(1,1);
writeln(' ');
writeln(' ');
writeln(' ');
writeln(' oooooooooooo');
writeln(' oooooooooooo ');
writeln(' ');
writeln(' ');
writeln(' oooooooooooo ');
writeln(' oooooooooooo ');
writeln(' oooo ');
writeln(' oooo ');
writeln(' oooooooooooooooo');
writeln(' ooooooooooooooooo');
writeln(' ');
delay(800);
gotoxy(51,3);writeln ('o');
gotoxy(50,4);writeln ('ooo');
gotoxy(49,5);writeln ('ooooo');
gotoxy(48,6);writeln ('ooooooo');
gotoxy(47,7);writeln ('oooo oooo');
gotoxy(46,8);writeln ('oooo oooo');
gotoxy(45,9);writeln ('oooo oooo');
gotoxy(44,10);writeln('oooo ooooooo');
gotoxy(43,11);writeln('oooo ooooooooo');
gotoxy(43,12);writeln('ooo oooo ');
gotoxy(43,13);writeln('oo oooo ');
writeln;
writeln;
writeln;
delay(800);
textcolor(blue);
gotoxy(20,15);writeln(' ooooooo ooooooo ooooooo ooooo oooooooo ');
gotoxy(20,16);writeln(' o o o o o o o o ');
gotoxy(20,17);writeln(' o ooooooo o o ooooo o ');
gotoxy(20,18);writeln(' o o o o o o o ');
gotoxy(20,19);writeln(' oooooo o ooooooo o oo o ');
gotoxy(20,20);writeln(' ');
textcolor(red);
gotoxy(20,21);writeln(' I T S I N T H E G A M E ');
delay(5000);
ulang:
clrscr;
m:=0;
n:=0;
gotoxy(32,17);
write(' N o w L o a d i n g ');
gotoxy(35,18);
write('_______________');
gotoxy(35,20);
write('---------------');
while m<15 do
begin
delay(100);
gotoxy(35+n,19);
write('o');
n:=n+1;
m:=m+1;
end;
clreol;
repeat
for o:=1 to 10 do
begin
textcolor(o);
gotoxy(20,17);
clreol;
gotoxy(33,17);
write(' Press Enter');
gotoxy(33,21);
write(' Press Enter');
delay(100);
end;
until keypressed;
readln;
end;
clrscr;
repeat
textcolor(white);
gotoxy(26,10); writeln(' Type 1 for easy');
gotoxy(26,11); writeln(' Type 2 for medium');
gotoxy(26,12); writeln(' Type 3 for hard');
gotoxy(1,8); write('Choose the difficult = ');readln(x);
if (x=1) or (x=2) or (x=3) then
break;
clrscr;
until 1>2;
clrscr;
gotoxy(21,10); writeln(' H O W T O P L A Y');
gotoxy(21,11); writeln('- Guess a word from it');
gotoxy(21,12); writeln('- One shot for each question');
gotoxy(21,13); writeln('- U can guessing for unlimited time');
gotoxy(21,14); writeln('- Dnt use a capital words ');
gotoxy(31,17);
write(' N o w L o a d i n g ');
gotoxy(35,18);
write('________________');
gotoxy(35,20);
write('----------------');
m:=0;
n:=0;
while m<16 do
begin
delay(100);
gotoxy(35+n,19);
write('o');
n:=n+1;
m:=m+1;
end;
clreol;
repeat
for o:=1 to 11 do
begin
textcolor(o);
gotoxy(20,17);
clreol;
gotoxy(33,17);
write(' Press Enter');
gotoxy(33,21);
write(' Press Enter');
delay(100);
end;
until keypressed;
clrscr;
z:=x;
if (x=1) then
goto easy
else if (x=2) then
goto medium
else if (x=3) then
goto hard;
easy:
e:=1;
ab[1,0]:='leak'; ab[1,6]:='peep'; ab[1,12]:='tool';
ab[1,1]:='kick'; ab[1,7]:='seed'; ab[1,13]:='help';
ab[1,2]:='dead'; ab[1,8]:='book'; ab[1,14]:='rare';
ab[1,3]:='read'; ab[1,9]:='poop'; ab[1,15]:='view';
ab[1,4]:='tear'; ab[1,10]:='find'; ab[1,16]:='hour';
ab[1,5]:='keep'; ab[1,11]:='good'; ab[1,17]:='fast';
goto proses;
medium:
e:=2;
ab[2,0]:='almighty'; ab[2,6]:='reduce'; ab[2,12]:='phone';
ab[2,1]:='abnormal'; ab[2,7]:='create'; ab[2,13]:='computer';
ab[2,2]:='mighty'; ab[2,8]:='group'; ab[2,14]:='female';
ab[2,3]:='amazing'; ab[2,9]:='message'; ab[2,15]:='access';
ab[2,4]:='ancient'; ab[2,10]:='partner'; ab[2,16]:='instant';
ab[2,5]:='speed'; ab[2,11]:='discount'; ab[2,17]:='agree';
goto proses;
hard:
e:=3;
ab[3,0]:='belligerent'; ab[3,6]:='mercenaries'; ab[3,12]:='television';
ab[3,1]:='ambitious'; ab[3,7]:='different'; ab[3,13]:='favorite';
ab[3,2]:='profesional'; ab[3,8]:='accomplished'; ab[3,14]:='penalty';
ab[3,3]:='beautiful'; ab[3,9]:='decorate'; ab[3,15]:='transfer';
ab[3,4]:='beneficial'; ab[3,10]:='frustated'; ab[3,16]:='routine';
ab[3,5]:='conversation'; ab[3,11]:='refrigator'; ab[3,17]:='football';
goto proses;
proses:
goto hitung;
prosesdua:
clrscr;
l:=1;
g:=0;
s:=0;
P:=0;
for k:= 1 to 11 do
begin
randomize;
f:=random(17);
if k>1 then
begin
repeat
f:=random(17);
for r:= 1 to k do
begin
if (f = af[r]) then
s:=s-1;
end;
if s=0 then
break;
s:=0;
until 2<1;
end;
af[k]:=f;
for j:=1 to length(ab[e,f]) do
begin
a:=length(ab[e,f]);
repeat
b:=random(a+1);
until b<>0;
if(j>1) then
begin
repeat
g:=0;
repeat
b:=random(a+1);
until b<>0;
for c:= 1 to j-1 do
begin
if b = ad[c] then
begin
g:=g-1;
end;
end;
if g=0 then
begin
goto lanjut;
end;
until 2<1;
end;
lanjut:
gotoxy(35+p,9);(write(ab[e,f][b]));
P:=P+2;
ad[j]:=b;
end;
P:=0;
gotoxy(27,20);write('Whats your answer = ');readln(ae[k]);
if (ae[k]) = (ab[e,f]) then
skor:=skor+1;
clrscr;
gotoxy(1,1);write(' Your Score = ',skor);
end;
gotoxy(31,17);
write(' C a l c u l a t i n g ');
gotoxy(35,18);
write('_______________');
gotoxy(35,20);
write('---------------');
m:=0;
n:=0;
while m<15 do
begin
delay(100);
gotoxy(35+n,19);
write('o');
n:=n+1;
m:=m+1;
end;
repeat
for o:=1 to 10 do
begin
textcolor(o);
gotoxy(20,17);
clreol;
gotoxy(33,17);
write(' Press Enter');
gotoxy(33,21);
write(' Press Enter');
delay(100);
end;
until keypressed;
readln;
clrscr;
textcolor(white);
write (' You can answer ',skor,' out of 10 Question');
writeln;
writeln;
writeln;
if (skor = 0) then
write(' Your rating is D ')
else if (skor > 0) and (skor < 5) then
write(' Your rating is C ')
else if (skor > 5) and (skor < 8 ) then
write(' Your rating is B ')
else if (skor > 7) then
write(' Your rating is A ');
repeat
for o:=1 to 10 do
begin
textcolor(o);
gotoxy(20,17);
clreol;
gotoxy(33,17);
write(' Press Enter');
delay(100);
end;
until keypressed;
readln;
clrscr;
gotoxy(45,0);
skor:=0;
textcolor(white);
writeln(' Wanna try again ? [Y/N] ');
repeat
u := readkey;
until upcase(u) in['Y', 'N'] ;
if (u='Y') or (u='y') then
goto ulang
else if (u='N') or (u='n') then
halt;
hitung:
textbackground(black);
textcolor(white);
writeln;writeln;
writeln;writeln;
writeln;writeln;
writeln;writeln;
writeln(' **** ****** **** *** *** *** ');
writeln(' ***** ****** ****** **** *** *** ');
writeln(' ** ** *** ** ** ***** ** ** ');
writeln(' ****** ****** ** ** ** ** **** ');
writeln(' ***** ****** ****** ** ** **** ');
writeln(' ** ** *** ****** ** ** ** ');
writeln(' ** ** ****** ** ** ** ** ** ');
writeln(' ** ** ****** ** ** *** ** ');
delay(400);
goto prosesdua;
end.
0 komentar:
Posting Komentar