Форум: "Прочее";
Текущий архив: 2006.10.22;
Скачать: [xml.tar.bz2];
ВнизГлюки... Найти похожие ветки
← →
MaRVeL (2006-10-03 22:49) [0]function doit(y,x:integer):boolean;
var i:integer;
good:boolean;
begin
doit:=false;
good:=false;
for i:=1 to 8 do
begin
if ((x+xs[i])<=m)and((y+ys[i])<=n)
and ((x+xs[i])>0)and((y+ys[i])>0)
and ((a[(y+ys[i]),(x+xs[i])]=".")or((a[(y+ys[i]),(x+xs[i])]="s")))
and (a[(y+ys[i]),(x+xs[i])]<>"+")
and ((m*(y+ys[i]-1)+(x+xs[i])-1) in b)
then
begin
q:=false;
if (i>0)and(i<3)
then
begin
if (a[y-1,x]<>"*")and(a[y-2,x]<>"*")
then
q:=true;
if (a[y,x+xs[i]]<>"*")and(a[y-1,x+xs[i]]<>"*")
then
q:=true;
end
else
if (i>2)and(i<5)
then
begin
if (a[y,x+1]<>"*")and(a[y,x+2]<>"*")
then
q:=true;
if (a[y+ys[i],x]<>"*")and(a[y+ys[i],x+1]<>"*")
then
q:=true;
end
else
if (i>4)and(i<7)
then
begin
if (a[y+1,x]<>"*")and(a[y+2,x]<>"*")
then
q:=true;
if (a[y,x+xs[i]]<>"*")and(a[y+1,x+xs[i]]<>"*")
then
q:=true;
end
else
begin
if (a[y,x-1]<>"*")and(a[y,x-2]<>"*")
then
q:=true;
if (a[y+ys[i],x]<>"*")and(a[y+ys[i],x-1]<>"*")
then
q:=true;
end;
if (q=true)
then
begin
x:=x+xs[i];
y:=y+ys[i];
inc(l);
good:=true;
b:=b-[m*(y-1)+x-1];
if (a[y,x]="s")
then
begin
doit:=true;
if l<best
then
best:=l;
doit:=true;
b:=b+[(n-1)*y+x-1];
dec(l);
exit;
end
else
doit(y,x)
end;
end;
end;
if good
then
begin
b:=b+[m*(y-1)+x-1];
dec(l);
end;
end;
← →
Alx2 © (2006-10-03 22:55) [1]const Pi=
3.141592653589793238462643383279502884197169399375105820974944592307
81640628620899862803482534211706798214808651328230664709384460955058
22317253594081284811174502841027019385211055596446229489549303819644
28810975665933446128475648233786783165271201909145648566923460348610
45432664821339360726024914127372458700660631558817488152092096282925
40917153643678925903600113305305488204665213841469519415116094330572
70365759591953092186117381932611793105118548074462379962749567351885
7527248912279381830119491298336733624;
← →
Loginov Dmitry © (2006-10-03 22:58) [2]И точно глюки...
... у автора
← →
Zeqfreed © (2006-10-03 23:01) [3]Это все можно было заменить на
function doit(y,x:integer) : boolean
const
res : array[0..1] of Boolean = (true, false);
begin
Result := res[Random(2)];
end;
без потери функциональности.
Страницы: 1 вся ветка
Форум: "Прочее";
Текущий архив: 2006.10.22;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.041 c