Ну, здравствуйте...

Мутотень, глупости, непризнанные аргументы и прочее ждет вас здесь!

пятница, 18 ноября 2011 г.

GAME

Вот она, вот она игра моей мечты...



program castlemania;
uses CRT;
var start_agree,player_name,adventure_agree,answer1,weapon,answer4,answer5,an1,an2,an3:string;
map,gold,mapgold,action,answer2,weaponlvl,answer3,rage,buying,golda,robers,answer6:integer;
begin
writeln ('%%%%%%%%%%loading%%%%%%%%%%%%%');
writeln ('***Welcome to Castle Mania***');
writeln;
writeln ('***Creator: Leonid  Prohor***');
writeln;
writeln ('type ^start^ to play the game');
readln (start_agree);
                                                    {ïåðåìåííûå}
 map:=0;
 mapgold:=0;
 gold:=0;
 weaponlvl:=0;
 weapon:='no';

if start_agree='start' then
    begin
    writeln ('^^^type your name pls^^^');
    readln (player_name);
      if player_name=''then player_name:='noname';
    writeln ('Hello, ', player_name,'!');
    writeln (player_name,', you must to save princess... she is in the castle! Dragon steal her :(');
    writeln ('  Are you ready for yhe ADVENTURE???');
    readln (adventure_agree);
    if adventure_agree='yes' then
         begin
         while action<>4 do
             begin
             writeln ('You have ',gold,' gold and ',weapon,' weapon .What will you do? ');
             writeln ('type what you want to do with number of action');
             writeln ('   1)go to weapon shop;');
             writeln ('   2)go to library;');
             writeln ('   3)go to gold prisk;');
             writeln ('   4)go to kill the dragon and save the princess!!!;');
             readln (action);
             if action=2 then
                          begin  {library}
                          writeln (player_name, ' come to the library and see somebody');
                          while answer1<>'no' do
                                  begin
                                  writeln ('?????: ',player_name,', do you want to ask smth?');
                                  readln (answer1);
                          if answer1='yes' then
                          begin
                          writeln ('1)how to kill dragon; 2)how to get money;');
                          readln (answer2);
                          if answer2=1 then begin
                             writeln ('?????: i know how to do this!');
                             writeln (player_name, ': ???');
                             writeln ('?????: you must have a cool weapon to defeat dragon :D');
                             writeln (player_name, ': where i can get it?');
                             writeln ('?????: in the weapon shop :) here is ticket fo shop. If u have it saleman will not kill you :D');
                             writeln (player_name, ': ok');
                             map:=1;                    {OMGOMGOMGOMGOMGOMGOGMOGMGOMGOMG!!!!!!!!!!!!!!!!!!!!!!!!!}
                             end else begin
                                                          writeln ('?????: i think that...');
                             writeln (player_name, ': ???');
                             writeln ('?????: you can get money by doing smth');
                             writeln (player_name, ': where i can do this?');
                             writeln ('?????: in the gold prisk :)');
                             writeln (player_name, ': ok :(');
                             mapgold:=1; {OMGOMGOMGOMGOMGOMGOGMOGMGOMGOMG!!!!!!!!!!!!!!!!!!!!!!!!!}
                            
                          end;
                          end;
                          writeln (player_name,' lives library');
             end; end;
           if action=1  then
                          begin
                           begin
                             while answer3<>1 do
                             begin
                             writeln (player_name,' comes to weapon shop and knock door');
                             writeln ('saleman: what are you need?');
                             if map=0 then begin
                                   writeln (player_name,': open door, pls');
                                   writeln  ('saleman: Grrr.... go out stupid knight!!!!');
                                   end else
                                   begin
                                    writeln (player_name,': somebody send me to you');                                      {BUYBUYBUY!!!!}
                                     writeln  ('saleman: Ow... Come in :D');
                                     writeln ('saleman: you can buy something if you have money :)');
                                     writeln ('1)=====0 (stick) 10 gold');
                                     writeln ('2)<>========<> (double-stick) 20 gold');
                                     writeln ('3)========IoI> (super stick) 30 gold' );
                                     writeln ('4)=I=====> (sword) 50 gold');
                                     writeln ('5)=II+=+=+=+=<> (super duper mega extra chain-sword :D) 100 gold');
                                     writeln ('what do you want to by, if your gold - ',gold);
                                     writeln ('if you try to buy smth so reach, thet you have not money for it, i will take your money!!!');
                                     readln (buying);
                                         while answer4<>'no' do
                                         begin
                                          if (buying=1) and (gold>=10) then begin
                                                                            writeln ('you have bought stick for 10 gold');
                                                                            weaponlvl:=1;
                                                                            weapon:='stick';
                                                                            gold:=gold-10;
                                                                            end;
                                                                            if (buying=2) and (gold>=20) then begin
                                                                            writeln ('you have bought double-stick for 20 gold');
                                                                            weaponlvl:=2;
                                                                            weapon:='double-stick';
                                                                            gold:=gold-20;
                                                                            end;
                                                                            if (buying=3) and (gold>=30) then begin
                                                                            writeln ('you have bought super stick for 30 gold');
                                                                            weaponlvl:=3;
                                                                            weapon:='super stick';
                                                                            gold:=gold-30;
                                                                            end;
                                                                            if (buying=4) and (gold>=50) then begin
                                                                            writeln ('you have bought sword for 50 gold');
                                                                            weaponlvl:=4;
                                                                            weapon:='sword';
                                                                            gold:=gold-50;
                                                                            end;
                                                                            if (buying=5) and (gold>=100) then begin
                                                                            writeln ('you have bought super duper mega extra chain-sword for 100 gold');
                                                                            weaponlvl:=5;
                                                                            weapon:='super duper mega extra chain-sword';
                                                                            gold:=gold-100;
                                                                            end;
                                          writeln ('do you want to by something more? You have ' ,gold, ' gold');
                                          readln (answer4);
                                          end;
                                   end;
                             writeln ('lives shop (1) or come again (2)');
                             readln (answer3);
                           end;

                          end;

                         
                          end;
                          if action=3 then
                          begin

                              golda:=random (10);
                              writeln ('you comes to the gold priisk and find ',golda,' gold');
                              gold:=gold+golda;

                           end;

                         

   
     end;
     writeln (player_name,' take ',weapon,' and ',gold,' gold and go to the dragons cave...');
     writeln ('but suddenly ',player_name,' see robbers :O');
     writeln ('roobers want to kill him or get 75 gold');
     writeln ('1)get it!(give to them 75g); 2)go out, i will kill you!!!');
     readln (robers);
     if robers<>1 then
                      begin
                      writeln ('robbers kill ',player_name);
                      writeln ('~~~~~~ THE BAD END ~~~~~~~~');
                      writeln ('no extars :(');
                      end else
                      begin
                      if gold<75 then
                                            begin
                      writeln ('robbers kill ',player_name);
                      writeln ('~~~~~~ THE BAD END ~~~~~~~~');
                      writeln ('no extars :(');
                      end else
                                                              begin
                                                              writeln ('you give them money and walk away to the cave...');
                                                              writeln (player_name,' enters the cave :P');
                                                              writeln (player_name,' see a big red DRAGON!!!!!!!!!!!!!');
                                                              writeln ('DRAGON: I WILL KILL YOU AND PRINCESS!!! MVA-HA-HA-HA-HA!!!');
                                                              writeln ('1)flee; 2)attack;');
                                                              readln (answer6);
                                                              if answer6=1 then
                                                                         begin
                                                                            writeln ('dragon eat princess');
                                                                             writeln ('~~~~~~ THE BAD END ~~~~~~~~');
                                                                              writeln ('no extars :(');
                                                                              end else
                                                                                 begin
                                                                                 writeln ('you attacks the dragon by ',weapon);
                                                                                 if weaponlvl=5 then
                                                                                                 begin
                                                                                                 writeln ('YOU DEFEAT DRAGON!!!');
                                                                                                 writeln ('...and save princess');
                                                                                                 writeln ('~~~~~~ HAPPY END!!! ~~~~~~~~');
                                                                                                 writeln ('see extars?');
                                                                                                 readln (an2);
                                                                                                 if an2='yes' then
                                                                                                                 begin
                                                                                                                 writeln ('~~~~~~~~~~~~~EXTARS~~~~~~~~~~~~');
                                                                                                                 writeln;
                                                                                                                 writeln ('======PROHORCHENKO LEONID======');
                                                                                                                 writeln ('          ) IDEA (             ');
                                                                                                                 writeln ('         ) PROGRAMM (           ');
                                                                                                                 writeln ('          ) TEXT (             ');


                                                                                                                  end;
                                                                                                
                                                                                                 end else
                                                                                                     begin
                                                                                                     writeln (' with no effect');
                                                                                                     writeln ('dragon eat ',player_name);
                                                                                                      writeln ('~~~~~~ THE BAD END ~~~~~~~~');
                                                                                                      writeln ('no extars :(');
                                                                                                     end
                                                                                 end;
                                                              end;
                      end;
end;
end;
end.

воскресенье, 13 ноября 2011 г.

суббота, 12 ноября 2011 г.

Olympia!

Втречайте программу, над которой я работал около часа. Олимпиадная задача №1. Помимо строгих подсчётов, выводит ещё и прикольный рисунок :D

program ex1;
uses CRT;
var a:array[0..100,0..100]of integer;
i,j,k,w,h,n,x1,y1,x2,y2,Ko,R:integer;
begin
writeln ('dlina x shirina');
readln (h,w);
Ko:=0;
for i:=1 to w do
     begin
     for j:=1 to h do
         A[i,j]:=0;
     end;
 for i:=1 to w do
     begin
     for j:=1 to h do
         write (A[i,j]);
     writeln;
     end;
writeln ('kol-vo <>');
readln (n);
for k:=1 to n do
    begin
    writeln ('x1,y1,x2,y2');
    readln (x1,y1,x2,y2);
        for i:=x1 to x2 do
           begin
           for j:=y1 to y2 do
              A[i,j]:=A[i,j]+1;
           end;
    end;
     for i:=1 to w do
     begin
     for j:=1 to h do
         if A[i,j]>0 then Ko:=Ko+1;
     end;
for i:=1 to w do
   begin
   for j:=1 to h do
         write (A[i,j]);
   writeln;
   end;
R:=h*w-Ko;
writeln (R);
end.

Ваш, ждущий побед, автор

суббота, 5 ноября 2011 г.

SURVIVAL

Умение выжить и вовремя вытащить отмороженное лицо из ледяной воды делает человека особенно нужным. Я это прочувтвовал, сделав 20 задач по физике, накатав геометрию и рассмотрев олимпиадную задачу по информатике, да кстати вот она:

program ex1;
var a:array[1..12] of integer;
    n,i,d,c,w:integer;
begin
for i:=1 to 12 do
 begin
  if (i=1) or (i=3) or (i=5) or (i=7) or (i=8) or (i=10) or (i=12) then a[i]:=31 else a[i]:=30;
  if i=2 then a[i]:=28;
 end;
writeln ('vvedite 0<n<365');
readln (n);
d:=0;
for i:=1 to 12 do
  begin
  d:=d+a[i];
  if d>n then
      begin
      c:=a[i]-(d-n);
      w:=n mod 7;
      if w=0 then w:=7;
      writeln (c,' ',i,' ',w);
      break;
      end;
  end;
end.

Наслаждайтесь...

Ваш, дарящий наслаждение, решивший всю домашку, автор