i,j,k:longint;
a,b,c,d,money,x,y,speed,power,hp,mhp,atk,wei,exp,mexp,s2,moneya,s:int64;
aa:string;
price,xy:array[1..100]of int64;
pricem:array[1..100]of double;
unlock,ehp1,star:array[1..100]of 0..1;
q:array[1..100]of string;
w:array[1..2500,1..2]of int64;
ehp:array[1..6]of integer=(5,10,15,30,15,100);
eatk:array[1..6]of integer=(0,3,2,3,7,0);
size:array[1..6]of integer=(2,4,4,3,3,3);
xp:array[1..6]of integer=(1,2,3,5,6,0);
procedure die;
begin
writeln('YOU DIED!');
write('reviving');
for i:=1 to 10 do
begin
for j:=1 to 100000000 do a:=a;
write('.');
end;
writeln('Welcome back!');
end;
procedure abc(x1,x2,x3:int64);
begin
c:=trunc(random(x2-x1))+x1+1;
j:=0;
while j<c do
begin
a:=trunc(random(49))+1;
d:=0;
for i:=a to a+size[x3]-1 do if xy[i]>0 then d:=1;
if d=0 then
begin
for i:=a to a+size[x3]-1 do xy[i]:=x3;
ehp1[a]:=ehp[x3];
inc(j);
end;
end;
end;
procedure battle;
begin
writeln('choose level');
for i:=51 to 100 do if unlock[i]=1 then writeln(i-50,':',q[i]);
readln(aa);
if (length(aa)<2)and(ord(aa[1])>48)and(ord(aa[1])<58)then
begin
val(aa,b);
hp:=mhp;
if unlock[b+50]=1 then
begin
fillchar(xy,sizeof(xy),0);
fillchar(ehp1,sizeof(ehp1),0);
fillchar(star,sizeof(star),0);
case b of
1:abc(5,10,1);
2:begin
abc(3,4,2);
abc(1,2,3);
end;
3:begin
abc(3,4,4);
abc(3,4,5);
end;
4:begin
for i:=48 to 50 do xy[i]:=6;
ehp1[48]:=100;
end;
end;
wei:=0;
while wei<50 do
begin
i:=0;
while i<50 do
begin
if i=wei-2 then
begin
write(hp);
str(hp,aa);
if length(aa)>1 then inc(i,length(aa)-1);
end;
if (ehp1[i]>0)and(wei=i-1) then
begin
write(ehp1[i]);
str(ehp1[i],aa);
if length(aa)>1 then inc(i,length(aa)-1);
end;
inc(i);
write(' ');
end;
if b=4 then
begin
inc(s);
if (s mod 5=0)and(xy[48]>0) then
begin
s:=0;
star[48]:=1;
end;
for i:=1 to 50 do if star[i]=1 then
begin
star[i]:=0;
star[i-1]:=1;
end;
end;
i:=0;
writeln;
while i<50 do
begin
if i=wei-2 then
begin
write('\o/');
inc(i,2);
end;
if (star[i]=1)and(i<>wei) then write('*');
if xy[i]=1 then write(')(');
if xy[i]=2 then write('(^^)');
if xy[i]=3 then write('(**)');
if xy[i]=4 then write('\#/');
if xy[i]=5 then write('\@/');
if xy[i]=6 then write('\?/');
if xy[i]>0 then inc(i,size[xy[i]]-1);
if(xy[i]=0)and((i-wei>0)or(i-wei<-2))then write('_');
inc(i);
end;
if b=4 then
if star[wei]=1 then
begin
star[wei]:=0;
dec(hp,trunc(random(3))+2);
dec(wei,trunc(random(4))+2);
if hp<1 then
begin
die;
exit;
end;
end;
if xy[wei+1]=0 then inc(wei)
else
begin
dec(ehp1[wei+1],atk);
dec(hp,eatk[xy[wei+1]]);
if hp<1 then
begin
die;
exit;
end;
if ehp1[wei+1]<1 then
begin
inc(exp,xp[xy[wei+1]]);
for i:=wei+1 to wei+size[xy[wei+1]] do xy[i]:=0;
end;
end;
if b=4 then
if star[wei]=1 then
begin
star[wei]:=0;
dec(hp,trunc(random(3))+2);
dec(wei,trunc(random(4))+2);
if hp<1 then
begin
die;
exit;
end;
end;
for i:=1 to 30 do writeln;
for i:=1 to 10000000 div s2 do a:=a;
end;
if b=4 then
begin
writeln('game completed!');
writeln('thank you for playing!');
writeln('author:lyx');
readln;
halt;
end;
writeln('You Win!');
if exp>=mexp then
begin
a:=atk;
while exp>=mexp do
begin
exp:=exp-mexp;
mexp:=round(mexp*1.5);
inc(atk);
end;
writeln('level up!','(x',atk-a,')');
writeln('atk+',atk-a);
end;
unlock[b+51]:=1;
writeln('Welcome back!');
end;
end;
end;
procedure shop;
begin
writeln('Welcome to the shop!(type <exit> to return)');
while true do
begin
for i:=1 to 4 do
if unlock[i]=1 then
writeln(q[i],'(price: ',price[i],')');
if unlock[5]=1 then writeln(q[5]);
readln(aa);
if aa='exit' then exit;
if (length(aa)=1)and(ord(aa[1])>48)and(ord(aa[1])<58)then
begin
val(aa[1],a);
if money<price[a] then writeln('No enough money!')
else
begin
money:=money-price[a];
price[a]:=round(price[a]*pricem[a]);
case a of
1:speed:=round(speed*0.6);
2:power:=round(power*1.618);
3:begin
unlock[3]:=0;
unlock[51]:=1;
unlock[4]:=1;
unlock[5]:=1;
writeln('Well done! now type <battle> at home to fight monsters!');
end;
4:begin
unlock[4]:=0;
s2:=2;
end;
5:begin
inc(moneya,money);
money:=0;
if moneya>100000 then mhp:=round((ln(moneya)/ln(10)-5)*(ln(moneya)/ln(10)-5)*(ln(moneya)/ln(10)-5))+10;
writeln('money burnt:',moneya);
end;
end;
writeln('upgrade success!');
writeln('money:',money);
end;
end;
end;
end;
begin
randomize;
writeln('THE INTERESTING GAME');
writeln('press <enter> to earn money');
writeln('type <shop> to visit the shop');
writeln('type <exit> to exit');
price[1]:=1;
price[2]:=10;
price[4]:=100000000;
price[3]:=1000000;
pricem[1]:=1.618;
pricem[2]:=2;
power:=1;
mhp:=10;
mexp:=10;
s2:=1;
atk:=1;
for i:=1 to 3 do unlock[i]:=1;
q[1]:='1:increase arrow speed';
q[2]:='2:increase money per tick';
q[3]:='3:???';
q[4]:='4:double battle speed';
q[5]:='5:burn all your money';
q[51]:='the small forest';
q[52]:='the land of slimes';
q[53]:='the evil castle';
q[54]:='the boss';
speed:=10000000;
while true do
begin
readln(aa);
if (aa='battle')and(unlock[51]=1) then battle;
if aa='exit' then halt;
if aa='shop' then
begin
shop;
writeln('Welcome back!');
end;
for i:=1 to 60 do
begin
for j:=1 to speed do a:=a;
write('>');
end;
inc(money,power);
writeln;
writeln('money: ',money);
end;
end.