home *** CD-ROM | disk | FTP | other *** search
- //⌐ David Jean, 1993
- game tiles is 93 by 51;
-
- // A1
- // A2 A10
- // A3 A11 A16
- // A4 A12 A17 A20
- //A9 A22 A0
- // A5 A13 A18 A21
- // A6 A14 A19
- // A7 A15
- // A8
-
- // attention les pile Θtant lhorizontal les cartes
- // sont numΘrotΘe de droite a gauche...
-
- {--------------------------------------------------------------------------}
-
- #include 'tiles.cdh'
-
- stack A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13,
- A14, A15, A16, A17, A18, A19, A20, A21, A22;
-
- const alls := |A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22|;
-
- {--------------------------------------------------------------------------}
-
- stack A1 is
- X := 8;
- Y := 2;
- Direction := lhorizontal;
- W := 73;
- H := 7;
- Handler := tile;
- Size := 12;
- //****************************
- Start is TilesInit;
- //****************************
- SelectLeft(Spos : Index) is SelectTile(Spos);
- //****************************
- SelectRight(Spos : Index) is ShowAll(alls);
- //****************************
- CanReceive : Index is
- if IsEmpty?(1,!) then return PutIn(1,!)
- else if random(2)=0 then return SlideL2R(1,!)
- else return SlideR2L(1,!);
- //****************************
- IsFree?(l : Index) is
- if ([l]=EmptyTile) or ((l<>Left) and (l<>Right)) then return FALSE
- else return TRUE;
- end A1;
-
-
- stack A2 from A1 is
- X := 20;
- Y := 8;
- W := 49;
- Size := 8;
- //****************************
- IsFree?(l : Index) is return IsCover?(A10,l,-1);
- end A2;
-
- stack A3 from A1 is
- X := 14;
- Y := 14;
- W := 61;
- Size := 10;
- //****************************
- IsFree?(l : Index) is return IsCover?(A11,l,-2);
- end A3;
-
- stack A4 from A1 is
- X := 8;
- Y := 20;
- W := 73;
- Size := 12;
- //****************************
- IsFree?(l : Index) is
- if (l=Left) and (l=1) then
- if A0[2]=EmptyTile then return TRUE
- else return FALSE
- else if (l=Right) and (Right=Size) then
- if A9[1]=EmptyTile then return TRUE
- else return FALSE
- else return IsCover?(A12,l,-3);
- end A4;
-
- stack A5 from A1 is
- X := 8;
- Y := 26;
- W := 73;
- Size := 12;
- //****************************
- IsFree?(l : Index) is
- if (l=Left) and (l=1) then
- if A0[2]=EmptyTile then return TRUE
- else return FALSE
- else if (l=Right) and (Right=Size) then
- if A9[1]=EmptyTile then return TRUE
- else return FALSE
- else return IsCover?(A13,l,-3);
- end A5;
-
- stack A6 from A1 is
- X := 14;
- Y := 32;
- W := 61;
- Size := 10;
- //****************************
- IsFree?(l : Index) is return IsCover?(A14,l,-2);
- end A6;
-
- stack A7 from A1 is
- X := 20;
- Y := 38;
- W := 49;
- Size := 8;
- //****************************
- IsFree?(l : Index) is return IsCover?(A15,l,-1);
- end A7;
-
- stack A8 from A1 is
- X := 8;
- Y := 44;
- W := 73;
- Size := 12;
- end A8;
-
- stack A0 from A1 is
- X := 80;
- Y := 23;
- W := 13;
- Size := 2;
- //****************************
- CanReceive : Index is
- if (A4[1]=EmptyTile) or (A5[1]=EmptyTile) then return 0
- else return SlideL2R(1,2);
- //****************************
- IsFree?(l : Index) is
- if l=1 then return TRUE
- else if [1]=EmptyTile then return TRUE
- else return FALSE;
- end A0;
-
- stack A9 from A1 is
- X := 2;
- Y := 23;
- W := 7;
- Size := 1;
- //****************************
- CanReceive : Index is
- if (A4[12]=EmptyTile) or (A5[12]=EmptyTile) then return 0
- else return SlideR2L(1,1);
- //****************************
- IsFree?(l : Index) is return TRUE;
- end A9;
-
- stack A10 from A1 is
- X := 27;
- Y := 7;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A2,2,7,1);
- end A10;
-
- stack A11 from A1 is
- X := 27;
- Y := 13;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A3,3,8,2);
- //****************************
- IsFree?(l : Index) is return IsCover?(A16,l,-1);
- end A11;
-
- stack A12 from A1 is
- X := 27;
- Y := 19;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A4,4,9,3);
- //****************************
- IsFree?(l : Index) is return IsCover?(A17,l,-1);
- end A12;
-
- stack A13 from A1 is
- X := 27;
- Y := 25;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A5,4,9,3);
- //****************************
- IsFree?(l : Index) is return IsCover?(A18,l,-1);
- end A13;
-
- stack A14 from A1 is
- X := 27;
- Y := 31;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A6,3,8,2);
- //****************************
- IsFree?(l : Index) is return IsCover?(A19,l,-1);
- end A14;
-
- stack A15 from A1 is
- X := 27;
- Y := 37;
- W := 37;
- Size := 6;
- //****************************
- CanReceive : Index is return CoverRC(A7,2,7,1);
- end A15;
-
- stack A16 from A1 is
- X := 34;
- Y := 12;
- W := 25;
- Size := 4;
- //****************************
- CanReceive : Index is return CoverRC(A11,2,5,1);
- end A16;
-
- stack A17 from A1 is
- X := 34;
- Y := 18;
- W := 25;
- Size := 4;
- //****************************
- CanReceive : Index is return CoverRC(A12,2,5,1);
- //****************************
- IsFree?(l : Index) is return IsCover?(A20,l,-1);
- end A17;
-
- stack A18 from A1 is
- X := 34;
- Y := 24;
- W := 25;
- Size := 4;
- //****************************
- CanReceive : Index is return CoverRC(A13,2,5,1);
- //****************************
- IsFree?(l : Index) is return IsCover?(A21,l,-1);
- end A18;
-
- stack A19 from A1 is
- X := 34;
- Y := 30;
- W := 25;
- Size := 4;
- //****************************
- CanReceive : Index is
- return CoverRC(A14,2,5,1);
- end A19;
-
- stack A20 from A1 is
- X := 41;
- Y := 17;
- W := 13;
- Size := 2;
- //****************************
- CanReceive : Index is return CoverRC(A17,2,3,1);
- //****************************
- IsFree?(l : Index) is return A22[1]=EmptyTile;
- end A20;
-
- stack A21 from A1 is
- X := 41;
- Y := 23;
- W := 13;
- Size := 2;
- //****************************
- CanReceive : Index is return CoverRC(A18,2,3,1);
- //****************************
- IsFree? from A20;
- end A21;
-
- stack A22 from A1 is
- X := 45;
- Y := 19;
- W := 7;
- Size := 1;
- //****************************
- Start is
- begin
- TilesInit;
- TilesShuffle(alls);
- end;
- //****************************
- CanReceive : Index is
- if ([1]<>EmptyTile) or
- (A20[1]=EmptyTile) or (A20[2]=EmptyTile) or
- (A21[1]=EmptyTile) or (A21[2]=EmptyTile) then return 0
- else return 1;
- //****************************
- IsFree?(l : Index) is return TRUE;
- end A22;
-
- {--------------------------------------------------------------------------}
-
- order A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13,
- A14, A15, A16, A17, A18, A19, A20, A21, A22;
- title:='Tiles'.
-