|
请教关于PortalCrane的问题,实在想不明白。发现placeIsFree调用的一个问题:当通过PortalCrane的Strategy下的自定义可利用位置(Define your own method for searching an available location)时,自定义程序为:" ~+ d4 p7 l5 H) a7 K& Y8 p
(byref x1,y1,z1 : integer; part : object) : boolean4 b5 i" b' M* u/ ?8 {
is8 T* a# R2 W8 w3 M6 C9 G" P
i,j,k,w : integer;
0 o$ }- k- n2 L$ i& t1 m3 ado
/ z3 ?' ?" a5 Z1 X8 \+ z; t, W for k := 1 to Crane.getStoreZDim loop8 q# w) l# m6 Y
for i := Crane.getStoreXDim downto 1 loop
- A7 p( A5 v; `6 v" }1 f. x7 s for j := 1 to Crane.getStoreYDim loop" z! z7 c$ Y* y: Q0 j" P
if Crane.placeIsFree(i,j,k) then1 j; H$ k6 P- x s' L
x1 := i;7 i& y! m- J6 F, U4 t, K0 G
y1 := j;* c0 V% n8 E5 p( q6 V+ I
z1 := k;
2 S" D& d6 N0 T- P% Y: a g2 G if Crane.placeIsFree(14,1,2) then2 `4 [. R, I* [9 P+ o7 l% @2 b4 t
w:=1
1 Q+ x9 R, K* ^5 [) u7 _6 H1 g end;
. t8 O- W1 |/ | return true;% s, U6 ^5 ], { S+ P+ M0 ]8 K
end;7 V/ C! x1 M2 r- M8 N4 m( d0 j
next;
' n; `& g3 S3 {' }& q. t next;1 ]7 Z( R2 a% z5 w3 B- z/ Z
next;3 u0 V1 Y; S/ ~+ T, J
return false;
& b6 q: S/ ]# L! Rend;( @* W3 f+ p/ M
判断的位置(14,1,2)的Free是True;而在某个程序中直接调用placeIsFree时, 判断的(14,1,2)的Free是False。保证两次判断位置(14,1,2)一直没有被占用。想知道是什么原因?placeIsFre方法到底该如何用?请求赐教?
! ~) a: p7 ]: C |
|