BARONER FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

BARONER FORUM

Bahadır Arda Onur Eren
 
AnasayfaGaleriLatest imagesAramaKayıt OlGiriş yap

 

 MAYIN TARLASI YAPIMI

Aşağa gitmek 
YazarMesaj
ONUR
Admin
ONUR


Mesaj Sayısı : 52
Kayıt tarihi : 25/11/08

MAYIN TARLASI YAPIMI Empty
MesajKonu: MAYIN TARLASI YAPIMI   MAYIN TARLASI YAPIMI Icon_minitimeC.tesi Ocak 10, 2009 2:03 pm

MAYIN TARLASI OYUNU

uses crt;
var
s: array[0..21,0..21] of shortint;
a,b,c,d :integer;
bomba,bul :boolean;
ch :char;

procedure yap(m :shortint);
begin
if m=-1 then inc(s[a,b]);
end;

procedure patla;
begin
bomba:=true;
for c:=1 to 20 do
for d:=1 to 20 do
if s[c,d]=-1 then
begin
gotoxy(d*3+2,c+1); write('@');
end;
end;

procedure sifir(y,x :shortint);
begin
if (s[y,x]=0)and(y>0)and(x>0)and(y<21)and(x<21) then
begin
gotoxy(x*3+2,y+1);
write('0'); s[y,x]:=9;
sifir(y-1,x);
sifir(y+1,x);
sifir(y,x-1);
sifir(y,x+1);
{sifir(y-1,x-1);
sifir(y-1,x+1);
sifir(y+1,x-1);
sifir(y+1,x+1);}
end;
end;

begin
textbackground(5);
clrscr;
textcolor(10);
randomize;
for a:=1 to 20 do
for b:=1 to 20 do
if random(6)=1 then
s[a,b]:=-1;
for a:=1 to 20 do
for b:=1 to 20 do
if s[a,b]=0 then
begin
yap(s[a-1,b]);
yap(s[a+1,b]);
yap(s[a,b-1]);
yap(s[a,b+1]);
yap(s[a-1,b-1]);
yap(s[a-1,b+1]);
yap(s[a+1,b-1]);
yap(s[a+1,b+1]);
end;
gotoxy(5,2);
for a:=1 to 20 do
begin
for b:=1 to 20 do
write('* ');
gotoxy(5,wherey+1);
end;
a:=5;b:=2;
gotoxy(a,b);
repeat
ch:=readkey;
if ch=#0 then ch:=readkey;
case ch of
#77:if a<62 then inc(a,3);
#80:if b<21 then inc(b);
#75:if a>5 then dec(a,3);
#72:if b>2 then dec(b);
#42:
if s[b-1,(a-2) div 3]=-1 then patla else
if (s[b-1,(a-2) div 3]>0)and(s[b-1,(a-2) div 3]<>9) then
begin
write(s[b-1,(a-2) div 3]);
s[b-1,(a-2) div 3]:=9;
end else
sifir(b-1,(a-2) div 3);
end;
gotoxy(a,b);

until (ch=#27)or(bomba)or(bul);

readln;
end.

ALINTI :http://www.programlama.com/sys/c2html/view.php?DocID=6478
Sayfa başına dön Aşağa gitmek
 
MAYIN TARLASI YAPIMI
Sayfa başına dön 
1 sayfadaki 1 sayfası
 Similar topics
-
» DELPHİ TROJAN YAPIMI

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
BARONER FORUM :: PROGRAMLAMA :: TURBO PASCALL-
Buraya geçin: