Geri git   Van.GEN.TR Forum | Yerel Van Forumu > Bilgisayar > Programlama > Pascal

Cevapla
 
Konu Araçlarý Stil
Alt 24/04/07, 01:01   #1
gokhanaygun
Tuðgeneral
 
gokhanaygun - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Apr 2007
Bulunduðu yer: VAN
Yaş: 36
Mesajlar: 924
Tecrübe Puanı: 26 gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold gokhanaygun is a splendid one to behold
Standart yýlan oyunu

program snake29;
uses crt;

const
left=#75;
right=#77;
up=#72;
down=#80;
Esc=#27;
var
Ch : Array [1..20,1..40] of char;
Name : Array [1..6] of String;
HiScore : Array [1..6] of integer;
AHead,BHead : Array [1..15000] of integer;
a,b,aFood,bFood,i,k,j,iTail,iCounter,iCrash,iGaine d,xGamble,yGamble,
iLastScore,iList,iLive,iLifeScore,iMove,iScore,iTe mp,Color,iLevel,iFactor,iChance : integer;
StTemp,User : String[10];
ChLevel,Decision,key,KeyControl : Char;
Lock,Pause,SoundLock : Boolean;

Procedure CreateFrame;
begin
gotoxy(19,9);
write('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ SNAKE ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»');
for i:=10 to 16 do
begin
gotoxy(19,i);
write('º º');
end;
gotoxy(19,17);
write('º ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º');
gotoxy(19,18);
write('º º º º');
gotoxy(19,19);
write('ÈÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍͼ' );
end;


begin
randomize;
clrscr;

textcolor(11);
gotoxy(25,13);
write('*** LUCKY SNAKE ***');
gotoxy(24,15);
textcolor(9);
write('a Mr.Stork Production...');
textcolor(15);

readkey;

textcolor(15);
iCounter:=1;
clrscr;
writeln('Please write your name!');
readln(User);
iList:=6; {It is 6,because we have 5 people in hi-score list.}
Name[iList]:=User;
clrscr;

iLevel:=3;
iFactor:=3;
iLifeScore:=1500;
SoundLock:=True;
repeat
clrscr;
iLive:=2;

CreateFrame;

gotoxy(21,10);
writeln('What would you like to do ',User,'?');
gotoxy(21,11);
writeln('1. Let us roll!');
gotoxy(21,12);
writeln('2. I will decide how fast I am !');
gotoxy(21,13);
writeln('3. I wonder who is the best?');
gotoxy(21,14);
writeln('4. New player');
gotoxy(21,15);
writeln('5. Sound Option');
gotoxy(21,16);
writeln('6. Quit');

repeat
for k:=1 to 500 do
begin
gotoxy(31,18);
Write(' º');
delay(20000);
gotoxy(31,18);
write('*** GOOD LUCK *** º');
if KeyPressed then Break;
delay(60000);
end;
Decision:=Readkey;

if Decision='1' then
begin
if SoundLock=True then
begin
for i:=1 to 3 do
begin
if KeyPressed then Break;
delay(30000); {Start Music}
sound(100);
delay(30000);
sound(150);
delay(30000);
sound(200);
delay(30000);
sound(75);
delay(30000);
sound(175);
delay(30000);
NoSound;
end;
end;
end;
until(Decision in ['1','2','3','4','5','6'] );

case Decision of
'1' :
begin
repeat {That is for lives}
clrscr;
gotoxy(21,12);
writeln('PRESS ENTER WHEN YOU ARE READY! ',User);
readln;

if (i>j) then
begin
for a:=1 to 1500 do
begin
AHead[a]:=0;
BHead[a]:=0;
end
end
else
for a:=1 to 1500 do
begin
AHead[a]:=0;
BHead[a]:=0;
end;

clrscr;
writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ » ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»');

for i:=1 to 20 do
begin
writeln('º º º º ');
end;

writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ¼ ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ');

gotoxy(45,4);
write('Score: ');
gotoxy(45,4);
write('Score: ',iScore);
gotoxy(45,6);
write('Lives: ',iLive);
gotoxy(45,8);
iList:=1;
write('Leader: ',Name[iList]);
gotoxy(45,10);
if (HiScore[iList]=0) then
begin
write('Hi-Score: ',iScore);
gotoxy(45,8);
write('Leader: ',User);
end
else
begin
write('Hi-Score: ',HiScore[iList]);
gotoxy(45,8);
write('Leader: ',Name[iList]);
end;
a:=1;
b:=1;
i:=10;
aFood:=10;
bFood:=16;
gotoxy(bFood,aFood);
textcolor(13);
write('~');

for j:=2 to 4 do
begin
AHead[a]:=i;
BHead[b]:=j;
Ch[i,j]:='';
gotoxy(j,i);
write(Ch[i,j]);
a:=a+1;
b:=b+1;
end;

key:=Right;
iTail:=1;

repeat
iList:=6;
Name[iList]:=User;

repeat {If it is alive,go on}
delay(60000 div iLevel);
gotoxy(45,2);
write(User);
Lock:=True;

KeyControl:=Key;

if KeyPressed then
begin
key:=Readkey;
end;

if (key=#0) then
begin
key:=Readkey;
end;

if ((key<>Up) or (key<>Down) or (key<>Right) or (key<>Left) or (key<>Esc)) {This control is for monkey touching}
and
((key<>Up) and (key<>Down) and (key<>Right) and (key<>Left) and (key<>Esc)) then
Key:=KeyControl;

case key of
Right: j:=j+1; {Right}

Left : j:=j-1; {Left}

Up : i:=i-1; {Up}

Down : i:=i+1; {Down}

Esc : begin
gotoxy(50,18);
write('PAUSED');
gotoxy(46,20);
write(' 1. QUIT ');
gotoxy(46,21);
write(' 2. Continue ');

repeat
Decision:=Readkey;
until (Decision in ['1','2']);

case Decision of
'1' : EXIT;
'2' : Pause:=True;
end;

if (Pause=True) then
begin
key:=KeyControl;
gotoxy(50,18);
write(' ');
gotoxy(45,20);
write(' ');
gotoxy(45,21);
write(' ');
Continue;
end;


end;
end;

if (i>21) or (i<2) or (j>41) or (j<2) then Continue; {If it runs into the wall,stop!}

for iCrash:=a downto iTail do
begin
if (AHead[iCrash]=i) and (BHead[iCrash]=j) then {We'll use this statement again!Don't forget!}
begin
Lock:=False;
break; {Gives up the loop if the snake bites itself}
end;
end;

if Lock=True then {If it eats itself,we cannot open this}
begin
gotoxy(j,i);
Ch[i,j]:='';
write(Ch[i,j]);

AHead[a]:=i;
BHead[b]:=j;
a:=a+1;
b:=b+1;
iMove:=iMove + 1;

if (iMove=65) then
begin
Ch[xGamble,yGamble]:=' ';
gotoxy(46,12);
write(' ');
gotoxy(yGamble,xGamble);
write(Ch[xGamble,yGamble]);
xGamble:=50;
yGamble:=50;
gotoxy(45,14);
write(' ');
end;

if (iCounter mod 6=0) then
begin
repeat
xGamble:=Random(20);
yGamble:=Random(40);
iChance:=Random(2);
for iCrash:=a downto iTail do
if (AHead[iCrash]=xGamble) and (BHead[iCrash]=yGamble) then Break;

until (xGamble > 1) and (yGamble > 1) and (AHead[iCrash]<>xGamble) and (BHead[iCrash]<>yGamble);
Ch[xGamble,yGamble]:='?';
gotoxy(yGamble,xGamble);
write(Ch[xGamble,yGamble]);
gotoxy(46,12);
write('ARE YOU BRAVE ENOUGH?');
iGained:=Random(250);
iCounter:=iCounter + 1;
iMove:=0;
end;

if (xGamble=i) and (yGamble=j) then
begin
gotoxy(45,4);
write('Score: ');
gotoxy(45,4);
write('Score: ',iScore);
Ch[xGamble,yGamble]:='';
gotoxy(46,12);
write(' ');
if (iChance=1) then
begin
iScore:=iScore + iGained;
gotoxy(46,12);
write('YOU HAVE BONUS!');
end;
if (iChance=0) then
begin
iScore:=iScore - iGained;
gotoxy(46,12);
write('HA-HAH! YOU LOSE :-D');
end;
gotoxy(yGamble,xGamble);
write(Ch[xGamble,yGamble]);
xGamble:=50;
yGamble:=50;
end;

if (aFood=i) and (bFood=j) then
begin
iCounter:=iCounter + 1;
gotoxy(bFood,aFood);
write('');
iScore:=iScore + (10 * iFactor);
if (iScore > iLifeScore) then
begin
iLive:=iLive + 1; {HEEY!We have one more life!}
gotoxy(45,14);
write('WELL DONE! EXTRA LIFE!');
iLifeScore:=iLifeScore + 1500;
gotoxy(45,6);
write('Lives: ',iLive);
end;
gotoxy(45,4);

if SoundLock=True then
begin
delay(30000); {Music part when the snake feeds}
sound(200);
delay(10000);
sound(150);
delay(10000);
sound(150);
delay(30000);
sound(300);
delay(30000);
NoSound;
end;
write('Score: ');
textcolor(15);
gotoxy(45,4);
write('Score: ',iScore);
iList:=1;
if (iScore > HiScore[iList]) then
begin
gotoxy(45,10);
write('Hi-Score: ');
gotoxy(45,10);
write('Hi-Score: ',iScore);
gotoxy(45,8);
write('Leader: ',User);
end
else
begin
gotoxy(45,10);
write('Hi-Score: ');
gotoxy(45,10);
write('Hi-Score: ',HiScore[iList]);
gotoxy(45,8);
write('Leader: ',Name[iList]);
end;
repeat
aFood:=random(19);
bFood:=random(39);
for iCrash:=a downto iTail do
if (AHead[iCrash]=aFood) and (BHead[iCrash]=bFood) then break;

until ( (aFood>1) and (bFood>1) ) and ( (AHead[iCrash]<>aFood) and (BHead[iCrash]<>bFood) );
gotoxy(bFood,aFood);
Ch[aFood,bFood]:='~';
repeat
Color:=random(15);
until (Color > 8);
textcolor(Color);
write(Ch[aFood,bFood]);
Continue;
end;

gotoxy(BHead[iTail],AHead[iTail]);
Ch[AHead[iTail],BHead[iTail]]:=' ';
write(Ch[AHead[iTail],BHead[iTail]]);
iTail:=iTail + 1;

end; {End of Boolean}

until ( (i>21) or (i<2) or (j>41) or (j<2) ) or ( (AHead[iCrash]=i) and (BHead[iCrash]=j) );
if (i>21) or (i<2) or (j>41) or (j<2) then
begin
if SoundLock=True then
begin
for i:=1 to 3 do
begin
delay(30000);
sound(100);
delay(30000);
sound(125);
delay(30000);
sound(75);
delay(60000);
NoSound;
end;
end;
Break;
end;

if (AHead[iCrash]=i) and (BHead[iCrash]=j) then
begin
if SoundLock=True then
begin
for i:=1 to 3 do
begin
sound(350);
delay(60000);
sound(150);
delay(60000);
sound(70);
delay(60000);
NoSound;
end;
end;
Break;
end;

until KeyPressed;
iLive:=iLive - 1;
until (iLive=0);
gotoxy(20,8);
textcolor(28);
write('GAME OVER');
gotoxy(8,13);
write('Press any key to return menu..!');
Readkey;
textcolor(15);
iList:=6;
HiScore[iList]:=iScore;
iScore:=0;
for iList:=1 to 6 do
for k:=iList + 1 to 6 do
begin
if (HiScore[k] > HiScore[iList]) then
begin
iTemp:=HiScore[iList];
HiScore[iList]:=HiScore[k];
HiScore[k]:=iTemp;

{Score is ordered,let's order the name!}

StTemp:=Name[iList];
Name[iList]:= Name[k];
Name[k]:=StTemp;
end;
end;

end; {End of game part}

'2' :
begin
clrscr;
CreateFrame;
gotoxy(20,11);
writeln('1. Probably I can beat a turtle!');
gotoxy(20,12);
writeln('2. Let us run a little faster!');
gotoxy(20,13);
writeln('3. I feel as if I was a cheetah');
gotoxy(20,14);
writeln('4. Wind is my nickname!');
gotoxy(20,15);
writeln('5. My only opponent is Turkish Airlines!');

repeat
for k:=1 to 500 do
begin
gotoxy(31,18);
Write(' º');
delay(20000);
gotoxy(31,18);
write('** CHOOSE LEVEL **º');
if KeyPressed then Break;
delay(60000);
end;
ChLevel:=Readkey;
until(ChLevel in ['1','2','3','4','5'] );

case ChLevel of
'1': begin
iLevel:=1;
iFactor:=1;
end;

'2': begin
iLevel:=2;
iFactor:=2;
end;

'3': begin
iLevel:=3;
iFactor:=3;
end;

'4': begin
iLevel:=4;
iFactor:=4;
end;

'5': begin
iLevel:=5;
iFactor:=5;
end;
end;
end;

'3' :
begin {Outputs hi-score list}
clrscr;
for iList:=1 to 5 do
begin
writeln(iList,'. ',Name[iList],' ',HiScore[iList]);
end;
readkey;
end;

'4' : begin
clrscr;
writeln('Welcome!..Please write your name');
readln(User);
iList:=6;
name[iList]:=User;
end;

'5' : begin
clrscr;
writeln('1. Sound on');
writeln('2. Sound off');

repeat
Decision:=Readkey;
until (Decision in ['1','2']);

case Decision of
'1' : SoundLock:=True;

'2' : SoundLock:=False;
end;
end;

'6' : begin
clrscr;
gotoxy(25,13);
textcolor(red);
for i:=1 to 2 do
begin
clrscr; {I just wanted it's to seem a little more}
gotoxy(25,13);
write('TO BE CONTINUED...');
Delay(65000);
end;
end;

end;

until (Decision='6');

end.

{written by mr.stork}
{mr.stork@mynet.com}
gokhanaygun isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayýsý: 187
Alt 20/06/08, 15:21   #2
firari
Mareþal
 
firari - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Sep 2007
Mesajlar: 5.835
Tecrübe Puanı: 104 firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute firari has a reputation beyond repute
Standart

Paylaşım için tşkler…
__________________



firari isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayýsý: 613
Takýmýnýz:
Alt 30/06/08, 01:59   #3
Mattet
Cumhurbaþkaný
 
Mattet - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: May 2008
Bulunduðu yer: van
Mesajlar: 7.027
Tecrübe Puanı: 48 Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute Mattet has a reputation beyond repute
Standart

teŞekkÜrler PaylaŞim İİÇİn
__________________





Düþmeden Bulutlarda Koþmam GereK !
Mattet isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayýsý: 866
Alt 31/07/08, 15:36   #4
Neutralizer
Yasaklý kullanýcý
 
Neutralizer - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Jan 2008
Bulunduðu yer: Ýstediðin yerden
Mesajlar: 1.883
Tecrübe Puanı: 0 Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute Neutralizer has a reputation beyond repute
Standart

paylaşım için tşkrlr
Neutralizer isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Konu Sayýsý: 316
Takýmýnýz:
Cevapla


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Yeni Mesaj yazma yetkiniz Aktif deðil dir.
Mesajlara Cevap verme yetkiniz aktif deðil dir.
Eklenti ekleme yetkiniz Aktif deðil dir.
Kendi Mesajýnýzý deðiþtirme yetkiniz Aktif deðildir dir.

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-KodlarıKapalı
Gitmek istediğiniz klasörü seçiniz


Bütün Zaman Ayarları WEZ +3 olarak düzenlenmiştir. Şu Anki Saat: 02:04 .


Powered by vBulletin
Copyright © 2000-2007 Jelsoft Enterprises Limited.
Sitemap
6, 5, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 113, 16, 17, 18, 19, 81, 20, 27, 22, 23, 24, 25, 26, 48, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 136, 40, 58, 45, 42, 44, 46, 47, 53, 54, 55, 56, 57, 59, 60, 70, 61, 62, 63, 64, 65, 66, 68, 69, 71, 72, 74, 75, 76, 77, 78, 79, 80, 82, 83, 96, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 98, 97, 100, 101, 102, 103, 106, 104, 105, 112, 109, 108, 107, 110, 111, 114, 115, 118, 116, 117, 119, 148, 154, 124, 165, 122, 120, 123, 121, 150, 153, 125, 128, 129, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 151, 149, 202, 175, 164, 152, 167, 155, 156, 157, 158, 159, 160, 161, 162, 163, 195, 169, 166, 168, 170, 171, 172, 199, 174, 173, 196, 200, 176, 177, 180, 178, 179, 182, 189, 187, 184, 186, 191, 192, 193, 194, 197, 198, 201, 203, 229, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 236, 231, 232, 233, 234, 235, 237, 240, 239, 241, 243, 242, 244,