• No results found

Catalogue of solutions of the rectangular 3x4x5 pentomino problem

N/A
N/A
Protected

Academic year: 2021

Share "Catalogue of solutions of the rectangular 3x4x5 pentomino problem"

Copied!
312
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Bouwkamp, C. J. (1981). Catalogue of solutions of the rectangular 3x4x5 pentomino problem. (2nd print ed.) Eindhoven University of Technology.

Document status and date: Published: 01/01/1981 Document Version:

Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication:

• A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website.

• The final author version and the galley proof are versions of the publication after peer review.

• The final published version features the final layout of the paper including the volume, issue and page numbers.

Link to publication

General rights

Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain

• You may freely distribute the URL identifying the publication in the public portal.

If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement:

www.tue.nl/taverne

Take down policy

If you believe that this document breaches copyright please contact us at:

openaccess@tue.nl

providing details and we will investigate your claim.

(2)

..

I

v

TECHNISCHE HOGESCHOOL EINDHOVEN Department

of

Mathematics

Catalogue of solutions

of the rectangular 3x4x5 solid

pentoinino problelll

(3)

July, 1967

Technological University Bindhoven and

Philips Research Laboratories, N. V.Philips' Gloeilam.pe:ntabrieken, Eindhoven, lletherlands

(4)

2

CONTENTS

1. Introduction

2. Classification of solutions 3. Comments on the tables

4.

Comments on the FORTRAN programme

5.

Faster programmes

6.

Text of source programme in CDC-FORTRAN PIECE CODES

Matrix MAT

1.

Text of source programme in ELX8-ALOOL Table I, numerical

Table II, literal

page

3

5

10 12 16 19 21 24 28

33

113

(5)

by C. J • .BOUWKAMP

1. IN'l'BODUC'l'ION

Aa Golomb writes on page 117 of his fascinating book 1) , it is a natural problem to fit the 12 planar pentominos in their solid form into a 3%4%5 rectangular solid ( see his Figure 113, showing the step-by-step construction of 11one of the many solutions to

this problem•• ).

Some years ago, when W.L. van der Poel of Delft showed me two solutions ( which he had obtained by hand in a few hours of work ) I decided, in an a.dmi ttedly weak moment, going to construct all possible solutions by means of the computer. A first programme in machine code was soon rea~ and successfully run on the IBM-1620 ( model I ) of the Technological University Eindhoven. Although progress was very slow, I found 576 different solutions of a cer-tain type ( type 17, see below ) in the course of perhaps one year, now and again running the programme at shorter or longer intervals and steadily improving it by invoking all sorts of tricks suggest-ed by the IBM-1620 instruction set and addressing system. However, needless to say that finishing the problem in this way was out of the question.

2

In the mean time, Jager ) , a student of Van dar Poel, had pro-grammed the puzzle in ALGOL-60 on the 'l'B4 of the Technological Uni-versity Delft. Re did find three solutions, but one of them is that contained in Golomb's book and at least one ot the two others is identical with one of the two found by Van der Poel. In a.ddi tion, it was lett unnoticed that yet two other solutions are easy to get by a simple displacement of two pentominos in Golomb's as well as in Vander Peel's solution. As stated by Jager, his programme, al-though in principle correct, would need hundreds of years to find all solutions of the pentomino puzzle.

(6)

4

While I was occasionally running my programme on the IBM-1620, skilled puzzlers as N.G.de Bruijn and J.H.van Lint continually came along with new solutions found b.f hand: De Bruijn alone got an odd fifty different solutions. In a letter from H.F.Trotter of Prince-ton University I was told that he had run a programme on a CDC-1604 that produced 180 solutions of a certain kind in about 50 minutes. Thus newly inspired, and even becoming more and more fascinated by the problem, I then started writing programmes for some fast compu-ters: the newly installed Eleotrologica X8 of our University and the CDC-3600 of the Philips Computing Centre. Very unfortunately, not being familiar with the machine language of either computer, I could only write ALGOL and FORTRAN programmes for these two compu-ters, respectively. However, the two programmes were about 5 and 40 times faster than my IBM-1620 programme. This gain in speed was sufficient to encourage me to continue the project until its very end, and through the combined efforts of the three computers men-tioned the final number of 3940 different solutions, not counting reflections and rotations of the solid, was established on March 16 1967. Of this total number of solutions, 1769 were obtained en the CDC, 1568 on the IBM, and 603 on the ELX8 for the first time.

The main object of this report, then, is to list these 3940 solutions systematically in a form that permits construction and identification of any solution most easily. This is accomplished by means of two different tables in suitable code, numerical or literal, as explained later on.

1) Solomon

w.

Golomb, Polyominoes, Charles Scribner's Sons, New York, 1965.

2) J. J. Jager, (unpublished) Report, II • .An Algol programme

for the solution of the three-dimensional pentomino

(7)

that it has {in some arbitrary unit) leDgth 5, width. 4, and height 3 and suppose that in accordance with this terminology it is placed in front of the reader and on his desk such that he views this solid in its length direction. Let two horizontal planes divide the solid in-to three plane layers each of 20 unit cubes, henceforth in-to be called bottom, middle, and top layer, in an obvious way. The corresponding cubes (or holes, if we think of a rectangular 3x4X5 box to be filled

Wi. th the 12 pentominos) will be numbered from 1 to 20 in the bottom, from 21 to 40 in the middle, and from 41 to 60 in the top layer, re-spectively, as indicated in figure 1.

1 2 3 4

5

6

7

8

9 10 11 12 13 14 15 16 17 18 19 20 bottom 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 middle 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 top Figure 1. System of numbering of the unit cubes.

The 12 pentominos will be numbered from 1 to 12 in the ordera I, X, L, Y, N, P,

u,

T,

z,

W, V, F

where the letters are the names of the pentominos as suggested b,y

Golomb (ref. 1, p. 23). Clearly, pentomino I fits into the solid in only one orientation, namely, in the length direction of the solid. Similarly, pentomino X has only three possible orientations.

B.1

in-spection it is further seen that 12 orientations are possible for each of the pentominos

u,

T,

z, w,

V; 16 for L, Y, N; and 24 tor P, F. In this manner the 12 solid pentominos lead to 160 different oriented pentominos in relation to the rectangular solid. These oriented pentominos will be called pieces, and they will be numbered from 1 to 160 as shown in figure 2. Thus, to each piece we have now associated a pentomino number (ranging from 1 to 12} and a piece number (r&Dging from 1 to 160).

(8)

6

Figure 2.

/

#

~

cfP

/ 7 2 2

9

672

2 I I 7

/Z/

1

9:

/ ? I

2 3 4 5 6 7 8

~

17

g

,

f

CITfj

Eho

EfiTI

9 10 11 12 13 14 15 16

crrfj

;

~ ~

/ Z Z £

LZ07

/227'

'Z/777

17 18 19 20 21 22 23 24

#

#

;

~

ITtr

dhJ

cdb

25 26 27 28 29 30 31 32

(

~

~

~

/ 2 2

9'7

wz

2 7

q;z/

I

/<Z27

33 34 35 36 37 38 39 40

a#

?

~

*

ITfb

Cfto

o:fP

dfD

41 42 43 44 45 46 47 48

I

I

~ ~

tz97

LZ:;Z7

£67

/7Z

49

so

51 52 53 54 55 56

m

69

4!7

§7

ern

EEb

cEB

ttP

57 58 59 60 61 62 63 64

¢

~

cttJ

@'

~

E§ E§

§j

65 66 67 68 69 70 71 72

rn

~

~

~

/777

L/LZ/

f f

f f

(9)

B:B

a=a

~ ~

§;

~

~

$

81 82 83 84 85 86 87 88

/#a:Z

r

ffi'

o:f3

~

8

§=o

89 90 91 92 93 94 95 96

Jb

~

~

~

L/z/7

dP

zg

%

97 98 99 100 101 102 103 104

#

Etg

~

gB

Jf

I

~

~

105 106 107 108 109 110 111 112

L::z.99

.c:;LP

~

~

I

9t

%

ffP

113 114 115 116 117 118 119 120

e

J

~

~

4'

§771

/ % /

#z,

'Z?

121 122 123 124 125 126 127 128

(

~

~

~

cili

)

~ .~

129 130 131 132 133 134 135 136

q;z7

4

~

c6b

#

6£b

/Q7 gb

137 138 139 140 141 142 143 144

dt

~

41

qf3

1P

qf

Efp

8=b

145 146 147 148 149 150 151 152

JP

$

&

$

J

~

.JlJ

~

153 154 155 156 157 158 159 160

(10)

8

Bote that tor simplicity of drawing figure 2 shows the individual pentominos in their planar shapes. It figure 2 might not be too clear at first sight, let me help the reader to mention that (the plane of) piece 2 is perpendicular to the height direction (thus piece 2 lies horizontally), that piece 3 is perpendicular to the width direction, that piece

4

is perpendicular to the length direction, that pieces

5

to 12 are perpendicular to the height direction, and so on.

It some piece is placed into an otherwise empty box, its cubes will till five holes, each hole having a number (in the range from 1 to 60J see figure 1). The cube corresponding to the lowest of the five numbers is called the origin of that piece. For example, piece 1 fits into the box if its origin fills hole 1; piece 1 then also fills holes

5, 9,

13, and 17. Similarly, if piece 2 has ita origin in hole

6, then it fills the holes 9, 10, 11, 14 as well. The latter situation

m~ simply be described b,y s~ng that piece 2 is in hole 6. Accord-ingly "piece 45 is in hole 7" means that pentomino B is placed into the box filling holes 7,

a,

25, 26, and 27.

Because three-dimensional reflections and rotations of a solution of the solid-pentomino puzzle are to be identified, it is of advantage to let pentominos I and X pl~ a special part. Pentomino I can be fi tt-ed into the box in either of 12 posi tiona, but because of symmetry with respect to reflection and rotation we need only consider four of them, for which we choose those which lie in the lower-left guarter of the box. That is to say, piece 1 is in hole 1, or in hole 2, or in hole 21, or in hole 22. If pentomino I has been forced in one of these four positions, we turn to pentomino X and make a list of the possible positions of pieces 2, 3, and 4. Again because of symmetry, certain positions can be ignored; we shall ignore positions of X in that half of the solid which is facing the reader.+ In so doing, we are left with 62 combinations of I and X to be considered. One of them, namely, piece 1 in hole 2 and piece 3 in hole 9, has no solution as is almost trivial to see. Each of the remaining 61 combinations leads to at least one solution of the puzzle.

Accordingly, 61 different types of solution will be distinguished, as specified in the table on the next page.

as the 11type list" in what follows.

This table is referred to

+Positions of piece 2 in the top layer can also be ignored if pentomino I is in the middle layer.

(11)

3

1 1

22

2

40

4

1

1

23

2

140

ss

1

1

26

2

14

6S

1

1

27

2

55

7

1 1

42

2

131

8

1 1

43

2

181

9S

1

1

46

2

32

lOS

1

1

47

2

38

11

1 1

6

3

47

12

1

1

7

3

107

13

1

1

8

3

397

14S

1 1

10

3

40

15S

1

1

11

3

53

16S

1

1

12

3

62

17

1

1

2

4

576

18

1

1

3

4

88

19

1

1

6

4

201

20

1 1

7

4

115

21S

1

1

10

4

40

22S

1 1

1 1

4

41

23

2

1

22

2

78

24

2

1

23

2

2

25S

2

1

26

2

22

265

2

1

27

2

1

27

2

1

42

2

54

28

2

1

43

2

15

295

2

1 46 2

26

30S

2

1

47

2

2

31

2

1

7

3

2

32

2

1

8

3

42

335

2

1

11

3

3

34S

2

1

12

3

6

35

2

1

3

4

61

36

2

1

7

4

38

37S

2

1

1 1

4

6

38

21

1

3

2

77

395

21

1

6

2

2

40S

21

1

7

2

22

41S

21

1

23

2

19

42SS

21

1

27

2

2

43S

21

1

6

3

64

44S

21

1

7

3

31

45S

21

1

8

3

35

46SS

21

1

10

3

37

475S

21

1

11

3

16

48SS

21

1

12

3

10

49S

21

1

3

4

15

50S

21

1

7

4

6

51SS

21

1

1 1

4

1

52

22

1

2

2

166

53

22

1

3

2

16

54S

22

1

6

2

32

55S

22

1

7

2

13

565

22

1

5

3

113

57S

22

1

7

3

77.,

58S

22

1

8

3

47

59SS

22

1

9

3

13

60SS

22

1

1 1

3

39

61SS

22

1

12

3

14

(12)

10

For example, solutions of type

17

are those in which piece

1

is in hole 1 and piece 4 in hole 2, and there are 576 different solu-tions of this ~e. The letter S in the first column indicates that the corresponding combination of I and X pentominos has one plane o.f symmetr;y; SS means that there are two of these planes. For example, in solutions of type

2S

pentomino

I

fills holes

1,

5, 9,

13, 17

and pentomino X fills holes

7,

10, 11, 12, 15. This configuration has a plane of symmetry perpendicular to the length direction of the box. The remaining holes can be filled by the other 1 0 pentOIIinoa in 68 different ways, bat the ensuing solutions are to be identified pairwise, thus giVing

34

distinct solutions of type

2S.

Similarl7, if there are two planes of s~etr;y (SS) the ensuing solutions come in sets of four of which onl7 one is included in the catalogue. The computer programme does not eliminate symmetries S and SS in the list of solutions; selection of a representative out of two or four symmetrical solutions was done manuall7. The symmetrical solution that is first obtained is kept, the other one or three are ignored. 3. CO:MUNTS ON TBE TABLES

The first table of 79 pages is in numerical cede, which requires some comments. The first three numbers on a line have an obri.ous meaning; the7 are, in order, the identification number of the solu-tion ( ranging from 1 to

3940 ) ,

the type of the solution { ranging from 1 to 61 ), and the ordinal number of the solution as it occurs in the class of solutions of that particular type (ranging from 1 to a maximum depending on the type).

The remaining 10 numbers on the line constitute an ordered se-quence of piece numbers from which the solution in question can be

readily constructed. For example, take the very first line of the table. Firat note that type 1 is indicated, meaning that piece 1 is in hole 1 and piece 2 is in hole

3.

Therefore, holes 1,

3, 5,

6,

7,

8, 9, 11, 13, 17

all are filled by pentominos I and X. Secondl7, it is observed that the hole with the lowest number not 7et filled is hole 2, th~ first free hole as we shall 8&7• We now turn to the or-dered sequence of piece numbersa

(13)

free hole is found to be hole 4-, and we place piece 100, the next of the sequence, in this hole 4. If this process is continued, we are led to a solution with piece 100 in hole 4, piece 77 in hole 10, piece 119 in hole 18, piece 130 in hole 20, piece 101 in bole 23, piece 144 in hole 30, piece 48 in hole 33, piece 21 in hole 43, and finally piece 6 in hole 49. If the reader is in possession of a set of solid pentominos, he will not have any difficulty in foll-owing this construction.

The disadvantage of the table is that it can be used only in combination with the type list and figures 1 and 2. On the other hand, it is very compact. A further advantage is that it clearly illustrates the tree structure of the solution set. Also symmetric-al parts in the pentomino packing are easy to spot and particular solutions are easy to identity. For example, (the reflection of ) Golomb's solution is number 1786 of our catalogue, and it is seen that number 1787 is closely connected to it: we get it from 1786

b,y a simple displacement of the T and V pentominos.

The second table of 197 pages is almost self-explanatory. The packing of pentominos is displayed b,y showing the filling of bot-tom, middle, and top layers by the cubes of the various pentominos all represented by their letter names. This second table is less compact than the first but any solution can be constructed at once; identification of a solution is not so easy, however.

The aecond table is also usetul in the search for particular solutions. For example we may ask for all solutions in which pento-mino P or U lies wholly inside the solid: there are 22 and 18 of them, respectively. Those with P are the numbers 82, 174, 175, 246, 678, 803, 804, 806, 884, 885, 1395, 1484, 1596, 1775, 2000, 2220, 2302, 2303, 2836, 2999, 3107, 3144J those with U are the numbers 118, 126, 142, 242, 268, 271, 802, 1472, 2187, 2196, 2197, 2301, 2888, 2905, 2908, 3019, 3088, 3099·

A vety beautiful solution is that in which 3 pentominos

(L,•,v)

are packed into a 1x3X5 solid, while the remaining 9 pentominos are packed into a 3x3x5 solid. Except for trivial transformations, this solution is unique. It occurs at 16 places in the catalogue:see the

(14)

12

numbers 2891, 2892, 2894, 2895, 2909, 2910, 2911, 2912, 3373, 3374, 3375, 3376, 3929, 3931, 3932, and 3933. Although there are several possibilities for packing 3 pentominoa into a 1x)%5 box and 9 pen-tominos into a 3X3x5 box ( for example, with pieces 1, 151, 99, 28, 117, 84, 2, 64, 12; or 1, 52, 118, 110, 58, 35, 125, 2, 77 ), there is exactl7 one combination of 3 and 9 pentominos that does bo-th. This most remarkable solution was found by the IBM-1620 for the first time.

It is left 'to the reader, b,y using the two tables, to searoh for pairs of solutions such that one solution can be obtained from the other b,y simply displacing some pentominos without changing their orientation (that is, to fill the box with the same pieces, in two different WB.7s).

ot

course, we mean to search for such pairs other than those following from the above remarkable solution. 4. COMMEBTS ON THE FORTRAN PROGRAMME

Each of the 160 different pieces can be coded numerioall7 b.f

five positive integers: PIS1, PIS2, PIS3, PIS4, and PISS. The first of them is simply identical With the pentomino number associated with the piece in question. For example, PIS1(45) • 5 because piece 45, an oriented N pentomino, has pentomino number

5.

The remaining tour integers are the filled-hole numbers relative to the origin-hole number of the piece if the latter is placed somewhere in the box. Again, let piece 45 be placed in hole 7, thus filling holes 7, 8, 25, 26, and 27. If one subtracts the first integer from the remaining four, one gets 1, 18, 19, and 20, as hole numbers rela-tive to the origin hole 7. It ma7 be clear that these four integers do not depend on the particular position of piece 45 in the box, and we set

PIS2(45).1, PIS3(45).18, PIS4(45)•19, PIS5(45)•20.

To this sequence of five positive integers we add a siXth, namely, PIS6(45)•52+1•53, which in the general case is constructed as followsa Take any piece, obtain from figure 2 the maximum piece number of all pieces corresponding to the same pentomino, and add 1 to it. The use of PIS6 will be explained later on.

The six integers associated with any piece as indicated above were determined b.f hand and punched into cards, together with a serial number, one piece per card.

(15)

only. We set MAT(i,k) • 0 if piece i can be placed in hole k with-out crossing the boundary ot the box; otherwise MlT(i,k) • 1. It is sufficient to consider values of k not greater than 56 because the first free hole cannot exceed that value. Again, the relevant se-quences of zeros and ones were determined by hand and punched into cards, together with a serial number, one row per card.

At the start ot the programme the PIECE CODES and MATRIX decks

are read by the computer.If either deck should not be in the oorreot sequential order, further execution of the programme would be sup-pressed after a message to that effect had been printed.

The 60 holes of the box are represented by BODY(k), assuming values 1 or 0 according as hole k is tilled or empty, k • 1(1)60. BLCK stands for a blocking register; BLCK(k) is 0 or 1 depending on whether pentomino k is or is not available for further packing, k • 1(1)12. COPIS and COBOL are linear arrays each of 12 elements in which are to be stored the piece numbers of pieces alrea~ placed and the corresponding sequence of hole numbers, respectively.

Ini-tially these four arrays are cleared to zero.

Before the search tor solutions is started, several things have to be taken care of. First the variable LEAVE is to be set; tor example, LEAVE.2 tells the computer that the first two of the pieces (yet to be placed in the box) should be lett untouched. Which pieces should be placed initially, and in which holes, and how many pieces, is to be indicated b.J appropriate information punched into one card. The first punching concerns BUM, the serial number of the solution; initially it should be

o.

Then oome1 hole number and piece number ot

first piece to be placed, hole number and piece number of second piece to be placed, etc., up to a maximum of 8 initial pieces. The

data on the card is read via a buffer register :stJF and stored appro-priately in COHOL and COPIS.Thereupon the computer determines L, the number of pieces to be packed into the box initially as indicat-ed implicitly by the initialization card.

This initial packing is done in two stages, with a modification of the matrix l4AT in between. The first few (two) pieces indicated (LEAVE.2) are handled in DO-loop Sa hole number K1 and piece number

(16)

14

K2 are assessed, the corresponding pentom:i.no is blocked, and five holes of the box are filled, all as m&J17 times as was indicated b,y I.JUVE.

Now the matrix MAT may be adjusted, because the configuration ot pentominos so far packed and to be lett untouched forbids further packing of some pieces in certain holes. That is to say, in the col-umns ot MAT corresponding to holes not yet filled, some ot the zeros can be replaced by 1. A further modification of MAT resul ta in the following situation. For any k corresponding to an empty hole, MAT(i,k) • 0 if piece i can be placed in hole k without crossing the boundary of the box and without overlapping with the pentom:i.nos al-ready packed. Otherwise MAT(i,k) • j, where j is the minimum integer such that MA.T(j,k). 0 and i<j<161; if j does not exist then MA.T(i,k) • 161. That means, if we run down along the column k of MAT we see that any nonzero element is identical with the row number of the next zero element. If there is no next zero element, the nonzero element is 161. The modified matriX is in store after execution of DO-loop 13.

If the initialization card indicated further packing, then the remaining L - LEAVE pieces are placed in the box (see DO-loop 14) and, the initialization being complete, the computer may now start finding solutions of the pentomino problem.

Before the actual start, however, the state of the initial pen-tomino configuration is printed for checking purposes, a counter ERASE is cleared to zero, and the number of the first tree hole is determined. The counter is increased by 1 whenever a piece is re-moved from the box; after 20 000 such erasures (and about as many

fillings, of course) the state of pentomino configuration is printed again, this information being useful if for some reason or other the programme should be continued at a later time. In the backtracking process of filling and erasing pentomino pieces, the current first free-hole number is stored in li'REHOL.

The library subroutine XMODF takes care of a neat output (50 lines per page) under control of the variable LIIE. For any solution two lines are printeda the ordered sequence of holes and that of the corresponding pieces both preceded by the serial number of the solu-tion. After 20 000 erasures, onlJ the first 8 pieces are printed.

(17)

as the computer tries to remove pentomino

x,

the programme termi-nates

b.1

printing the total number of solutions obtained.

Besides I and X some other pentominos may have been placed in-itially. Backtracking for solutions then starts from this initial configuration. This back-tracking goes as follows. Let k denote the number of the current first free hole before the next filling is attempted. Then column k of MAT(i,k) is inspected in the direction of increasing i, the starting value of i being 5 (see statement 15).

It is first tested whether the pentomino corresponding to piece i is still available. If this is not so, the programme "jumps" over all subsequent pieces of that pentomino, which is made possible by the very variable PIS6. If the pentomino is available, MAT(i,k) is tested upon zero. If it is nonzero, a jump to the next zero is performed as indicated b.y the value of this nonzero element. If MAT(i,k) •

o,

filling of piece i is attemptedr it is tried whether the remaining four cubes of the piece fit into four empty holes. If not, the next piece should be considered. If this TEST is positive, however, we then can FILL the piece. The new first free hole is assessed, and again the new trial piece is initialized with i •

5.

If it turns out that, in the run down the column k of .MA.T{i,k), all attempts are in vain, no turther filling is possible and the piece last filled must be removed. After ERASE, the next trial for filling must start with the piece immediately following on that which was just erased, and so on and on. For further details the reader should consult the actual FORTRAN-programme text.

The FORTRAN programme is not complete so long as PIECE CODES and MAT are not specified. Whereas the FORTRAN programme proper does not depend on the sequential ordering of the pentominos, nor on the

'

system of numbering in the bottom, middle, and top layers of the box (see figures 1 and 2), PIECE CODES and .MATRIX depend on both. At the very beginning I had reasons to believe that the ordering shown in figure 2 would be optimal in a certain sense in view of ~ I~1620

programme.The numbering and layout of figure 1 is certainly the best from the point of View of a catalogue of solutions and the reader's use of it, but run time on the computer is not minimal.

(18)

16

5.

FASTER PBOGB.AMJaES

Our

search for solutions by systematic filling and removing of pieces comes down to backtracking along an enormous tree with a tremendous number of branches and branch points at twelve different levels of height. By paraphrasing De Bruijn, one may say that "this tree bears millions of apples, one apple on every branch, but it is only the few (that is, 3940) on the very top branches which are sun-kissed and worth picking".

As implied by the numbering system of unit cubes in figure 1 the packing of pentominos is performed in the order: width, length, and height of the solid, but it might be better to pack the pentominos in the order: height, width, and length of the solid, because in the latter case branching of the tree is expected to be lese heavy. The corresponding cube-numbering system would be as follows;

1

4

7 10 2 5 8 11 3 6 9 12

13 16 19 22 14 17 20 23 15 18 21 24 25 28 31 34 26 29 32 35 27 30 33 36 37 40 43 46 38 41 44 47 39 42 45 48 49 52 55 58 50 53 56 59 51

54

57 60

bottom middle top

Figure 3. An alternative numbering system of the unit cubes. Now, as is easy to verify, the variable ERASE counts the number of branohes modulo 20 000 and, therefore, the number of branches of the tree can be estimated from the computer output. In so doing, it was observed that, roughly, computation time is proportional to the number of branches (500 branches per second is a fair estimate for the FORTRAN programme). To mention some examplesr the 47 solutions of type 11 emerge from a tree of approximately 5.2 million branchea in the first packing, and from a tree of approXimately 0.9 million branches in the second packing. Computation time correspondingly drops from 168 to 34 minutes. J.Por type 258 the numbers of branches are 3.9 and 1.0 million, computation times are 120 and 29 minutes. For type 438: 4.8 and 1.9 million branohes, 165 and 72 minutes.

(19)

packing less heavy than in the second packing. For example, in type 39S: o. 06 and o. 40 million branches, about 3 and 19 minutes comp-utation time. Type 52: 2.0 and 2.7 million branches, 84 and 91 minutes. In the large, however, the second packing is superior to

the first so far as computation time is concerned.

A further decrease of computation time is possible by a judi-cious choice of the initial positions of the I and X pentominos. In particular, the X pentomino should be plaoed in the smallest

possible hole number, by an appropriate reflection or rotation of the solid. The combined effects of best packing and initialization

may be illustrated on a few examples, as follows:

type number of branches{:x:1o6) computation time(minutes)

27 9.1 1.12 350 33 28 6.2 0.56 215 19 35 5.0 1.30 200 51 45S 3.9 0.92 130 35 49S 3.1 0.84 115 33 50S 2.3 0.50 75 18

In these si:x: types of solution, the number of tree branches is reduced from almost 30 million to a little more than 5 million, and computation time from 1085 minutes to 189 minutes.

It should be noted that PIECE CODES and MATRIX data as shown at the end of the ne:x:t section pertain to the second packing, that is, they are based on the numbering system of figure 3, not on that of figure 1. Therefore, if the FORTRAN programme of section 6 is run on the computer, the solutions of a given type will not come in the form and order as shown by the catalogue. On the CDC-3600, the programme of section 6 will need about 60 hours computing to obtain all 3940 solutions of the pentomino problem. Similarly, the ALGOL programme of section 7, if run on the ELX8, needs about 500 hours, and ~ present IBM-1620 machine-code programme about 2500 hours.

Ot course, a really fast programme can only be w:ri tten by use of the machine code of the computer. Thus, the 60-bit configuration

(20)

18

of BODY and the 12-bi t d.i tto of BLCIC are easy to store in two words of CDC-3600. In the numbering system of figure 3, the bit pattern of an:r piece (except piece 1 ) can even be stored in one word ( 48 bits). In this manner, the process of filling and erasing of pieces comes down to an interplay of shifts and logical operations on sin-gle or double words. With the help of A. Koene, of the Philips Com-puting Centre, who wrote two bit-handling subroutines in COMPASS, I tried to accelerate the FORTRAN programme in its essential parts, but the resulting gain in speed was a mere 10 per cent or so.

Recently, A.J.Dekkers of the Philips Computing Centre succeeded in constructing a ver.y fast programme approximately 20 times faster than my FORTRAN programme. In its initial phase, Dekkers ' programme generates man:r short subprogrammes in machine code, stored sequent-ially, each subprogramme handling filling and remoVing of one piece in one of its possible positions (there are more than 2000 of these subprogrammes).It is believed that Dekkers' programme, in its pres-ent form, is able to compute all solutions in about three hours on the CDC-3600. To mention one example, the 576 solutions ot type 17

were obtained in about 17 minutes, as compared to 240 hours which were needed on the IBM-1620.

(21)

PROGRAM PENS OL

C.J.BOUWKAMP, MARCH, 1967

c

TYPE INTEGER

PIS1.tPIS2,PIS3~.,PIS4,PIS5,~PIS6,BUF

*,BODY,BLCK,CCHOL,~OPIS,FREHvL,TRYPIS,tRASE

c

c

c

DIMENSION

PIS1(160),PIS2(160)~PIS3(160)

1

PIS4(160) *,PIS5(160).tPIS6{160J.tMAT(l60

1

~6),BUF(24J,B0DY(60)

*,BLCK(12),~0HOL(12),~0PIS(12J

INPUT PIECE CODES

DO 1 1•1 160

READ loo;KfPISl(I},PIS2(1),PIS3(1),PIS4{1),PIS5(1),PIS6(1)

IF( 1-K) uO

0

91

1 CONTINUE $ GOTO 90

91 PRINT 101

$

STOP

1

00 FORMAT ( 7 15 )

101 FCRMAT(lOX,*PIECE DECK OUT OF ORDER*}

c

C

INPUT MATRIX

c

c

90 DO 2

1•1,

160

READ

200~(MAT(I,J),J•1,56),K

IF( 1-K) uOTO 92

2 CONTINUE $ GOTO 3

92 PRINT 201 $ STOP

200 FCRMAT(5611 19)

201 FORMAT(lOX,'MATRIX DECK CUT OF ORDER*)

INITIALIZATION

3 DO 4 J•l.t60

4 BODY(J}•u

DO

5

J•l 12

5 BLCK(J).tOHOL(J)•COPIS(J)•O

c

C

SET NUMBER OF PIECES TO BE LEFT

LEAVE•2

c

C

INPUT UP TO 8 PIECES

c

·READ

300~NUMr(BUF(J),J•1,16)

300

FORMAT(I~.t16

4)

DO

6

J•l

.~

COHOl(J)•BUF(2*J-1}

$

COPIS(J)•BUF(2*J)

6 CONTINUE

J•O

7 J•J+l

$

IF(COHOL(J)) GOTO 7

$

L•J-1

DO

8

K•l LEAVE

Kl•COHOLlK)

$

K2.COPIS(K)

BLCK(PIS1{K2))•BODY(Kl)•BODY(Kl+PIS2(K2))•

*BODY(K1+PIS3(K2))•BODY(K1+PIS4(K2))•BODY(Kl+PIS5(K2))•1

8

CONTINUE

(22)

20

c

C

ADJUST MATRIX

c

c

DO 13 K•l 56 $ IF(BODY(K)) GOTO 13

DO 10

1·1~160

$ IF(MAT(IlK)) GOTO 10

IF

(BLCK(~IS1(1)})

GOTO

~

IF (BODY(K+PIS2( I}}) GOTO 9

IF (BODY(K+PIS3(1))) GOTO 9

IF (BODY(K+PIS4(1))) GOTO 9

IF (BODY(K+PIS5(1))) GOTO 9

GOTO

10

9 MAT(I K)•l

10

CONTI~UE

1·161

11 M•O

12

1•1-1

$

IF (I.EQ.O} GOTO 13

IF

(MAT(~

1

K).EQ.O)

GOTO

11

M-M+1

$

MAT{I,K)•I+M $ GOTO 12

13 CONTINUE

LEAF•LEAVE +

1

DO 14 K•LEAF L

Kl.COHOL( K)

~

K2.CCP

fS(

K)

BLCK(PIS1(K2)}=BODY(Kl)•BODY(Kl+PIS2(K2))•

*BOOY(K1+PIS3(K2})•BODY(K1+PIS4(K2))•BODY{Kl+PIS5(K2))•1

14 CONTINUE

C

INITIALIZATION READY

C

CHECK INITIAL STATE

LINE•l

PRINT 400 NUM {COHOL(I} 1•1

8)

PRINT 400: NUM: (COP IS {

I): 1•1

:a)

400 FORMAT{20X,18,2X,1215)

c

c

c

c

ERASE•O $ FREHOL•l

15 TRYP I S•5 ·

16 IF (FREHOL.GT.56) GOTO 25

IF (BODY{FREHOL)) 17 18

17 FREHOL•FREHOL+l $ GOfO 16

18 IF (TRYPIS.GT.160) GOTO 24

IF {BLCK(PIS1(TRYPIS))) 19,20

19 TRYPIS•PIS6(TRYPIS) $ GOTO

18

20 M•MAT(TRYPIS,FREHOL)

I

F(M) 21 22

21 TRYPIS•M'$ GOTO 18

TEST

22 12-FREHOL+PIS2{TRYPIS}

13-FREHOL+PIS3(TRYPIS)

14-FREHOL+PIS4(TRYPIS)

15-FREHOL+PISS(TRYPIS)

I

IF (BODY(I2)) GOTO 23

IF (BODY(I3)) GOTO 23

IF (BODY(I4)) GOTO 23

IF (BODY(I5)) GOTO 23

C

FILL

COHOL(J)•FREHOL $ COPIS(J)•TRYPIS

BLCK(PISl(TRYPIS))•BODY(FREHOL)•

*BOOY(I2)•BOOY(13)•BODY(I4)•BOOY(I5)•1

J•J+l

$

FREHOL•FREHOL+l $ GOTO 15

(23)

c

24 J-=J-1

$

IF (J.EQ.LEAVE) GOTO 26

Kl-=COHOL(J)

$

K2=COPIS(J)

.

COHOL(J)-=COPIS(J)-=BLCK(PIS1(K2)}-=BODY(K1)•BOOY(Kl+PIS2(K2})•

*BODY(Kl+PIS3(K2))-=BODY(Kl+PIS4(K2))-=BODY(K1+PIS5(K2))•0

FREHOL•K1-

$

TRYPIS•K2+1

$

ERASE-=ERASE+l

IF (ERASE.LT.20000} GOTO 18

·

LINE•LINE+l

$

IF(XMODF(LINE,25).EQ.l) PRINT 700

PRINT 400,NUM,(COHOL(I),I•1,8)

PRINT 400,NUM.r.(COPIS( I) ,1•1 ,8)

ERASE•O $ GOTu

18

C

SOLUTION OBTAINED

c

25 NUM•NUM+

1

LINE•LINE+l $ IF(XMODF(LINE,25).EQ.1) PRINT 700

700 FORMAT(1H1 //)

PRINT 400, NUM, { C OHOL (

I ) ,

1•1, 12)

PRINT 400,NUM,{COPIS(I),I•1,12)

GOTO 24

C

FINISH

c

26 PRINT 500, NUM

$

STOP

500 FORMAT(20X,*NUMBER OF SOLUTIONS•*,16)

c

END

PIICB CODBS, aa 'ban4 on tigurea 2 and 3a

1

1

12

24

36

48

2

2

2

9

12

15

24

5

3

2

11

12

13

24

5

4

2

2

3

4

6

5

5

3

3

6

9

12

21

6

3

3

6

9

12

21

7

3

3

6

9

21

21

8

3

12

15

18

21

21

9

3

12

24

33

36

21

10

3

3

15

27

39

21

11

3

12

24

36

39

21

12

3

3

12

24

36

21

13

3

12

24

35

36

21

14

3

3

6

8

9

21

15

3

1

3

6

9

21

16

3

1

4

7

10

21

17

3

3

6

9

10

21

18

3

1

12

24

36

21

19

3

1

13

25

37

21

20

3

12

24

36

37

21

(24)

22

21

4

6

9

12

. 15

37

22

4

9

12

15

18

37

23

4

3

6

9

18

37

24

4

3

6

9

15

37

25

4

12

21

24

36

37

26

4

9

12

24

36

37

27

4

12

15

24

36

37

28

4

12

24

27

36

37

29

4

3

5

6

9

37

30

4

2

3

6

9

37

31

4

3

4

6

9

37

32

4

3

6

7

9

37

33

4 . 12

23

24

36

37

34

4

11

12

24

36

37

35

4

12

13

24

36

37

36

4

12

24

25

36

37

37

5

3

6

9

12

53

38

5

3

6

9

12

53

39

5

3

15

18

21

53

40

5

3

6

18

21

53

41

5

12

21

24

33

53

42

5

9

12

21

.33

53

43

5

12

24

27

39

53

44

5

12

15

27

39

53

45

5

3

5

6

8

53

46

5

2

3

5

8

53

47

5

3

6

7

10

53

48

5

3

4

7

10

53

49

5

12

23

24

35

53

50

5

11

12

23

35

53

51

5

12

24

25

37

53

52

5

12

13

25

37

53

53

6

3

9

12

15

77

54

6

3

6

12

15

77

55

6

3

6

15

18

71

56

6

3

12

15

18

77

57

6

9

12

21

24

77

58

6

12

15

24

27

77

59

6

3

12

15

27

77

60

6

3

12

15

24

77

61

6

2

3

5

6

77

62

6

1

3

4

6

77

63

6

.3

4

6

7

77

64

6

1

3

4

7

77

65

6

11

12

23

24

77

66

6

1

12

13

24

77

67

6

1

12

13

25

77

68

6

12

1.3

24

25

71

69

6

1

1 1

12

13

77

70

6

1

2

3

4

71

71

6

1

3

4

5

77

72

6

1

2

4

5

77

73

6

1

2

3

4

77

74

6

1

12

13

14

77

75

6

1

2

13

14

77

76

6

1

2

12

13

77

77

7

6

12

15

18

89

78

7

3

6

12

18

89

79

7

3

12

24

27

89

80

7

3

15

24

27

89

(25)

84

7

1

13

24

25

89

85

7

1

2

3

5

89

86

7

2

3

4

5

89

87

7

2

12

13

14

89

88

7

1

2

12

14

89

89

8

6

9

12

24

101

90

8

12

21

24

27

101

91

8

3

6

15

27

101

92

8

12

15

18

24 101

93

8

3

5

6

7 101

94

8

12

23

24

25

101

95

8

1

2

3

6 101

96

8

1

2

4

7 101

97

8

3

4

5

6 101

98

8

10

11

12

24 101

99

8

12

13

14

24 101

100

8

1

.2

13

25

101

101

9

6

9

12

18

113

102

9

3

12

21

24 113

103

9

3

15

27

30 113

104

9

12

15

18

30 113

105

9

1

12

23

24

113

106

9

1

3

5

6 113

107

9

1

2

3

4 1 13

108

9

1

4

7

8 113

109

9

3

4

5

8 113

110

9

10

11

12

22

113

1 11

9

1

13

25

26

113

112

9

12

13

14

26

113

113

10

9

12

18

21

125

114

10

3

9

12

21

125

115

10

12

15

27

30 125

116

10

3

15

18

30 125

117

10

11

12

22

23

125

118

10

2

3

4

5

125

119

10

1

2

3

5 125

120

10

1

4

5

8 125

121

10

3

4

7

8 125

122

10 1 11

12

23

125

123

10

1

13

14

26

125

124

10

12

13

25

26

125

125

11

12

18

21

24 137

126

1 1

3

6

12

24 137

127

1 1

12

24

27

30

137

128

1 1

3

6

18

30 137

129

11

12

22

23

24

137

130

11

3

4

5

6 137

131

11

1

2

5

8 137

132

1 1

1

2

3

6 137

133

11

3

6

7

8 137

134

11

1

2

12

24

137

135

11

1

2

14

26

137

136

1 1

12

24

25

26

137

137

12

6

9

12

21

161

138

12

9

12

15

27

161

139

12

3

9

12

24 161

lltO

12

12

15

21

24

161

·

(26)

-24 141 12 9 12 24 '27 161 142 12 9 12 15 21 161 14.3 12 12 15 18 27 161 144 12 .3 15 18 27 161 145 12 .3 4 5 6 161 146 12 12 1.3 2.3 24 161 147 12 2 3 4 5 161 148 12 2 3 6 7 161 149 12 1 2 3 5 161 150 12 2 3 4 7 161 151 12 1 2 .3 6 161 152 12 1 4 5 7 161 153 12 .3 4 5 7 161 154 12 10 11 12 23 161 155 12 11 12 24 25 161 156 12 11 12 13 23 161 157 12 1 1 1 12 24 161 158 12 11 12 13 25 161 159 12 1 1.3 14 25 161 160 12 12 13 14 25 161

Jlatrix J1A!, aa ba . . d on :tigurea 2 and 3a

000000000000 111111111111111111111111 11111111111 11111111 1 1 111 000000 11111 1000000 111 111 000000 11111111111111111111111 2 10110110110110110110110110110110110111111111111111111111 3 10110111111110110111111110110111111110110111111110110111 4 111111111 000 111111111 000 111111111000 11 1 111 t 11000 11111111 5 000111111111000 111111111000 111111111000 11111111111111111 6 00011111111100011111111100011111111100011111111111111111 7 0 00 11111111 10 00 111111111 0 00 11 111 1111 000 111 11 11111 1111111 8 11 100000000011100000000011111111111111111111111111111111 9 00000000011100000000011111111111111111111111111111111111 10 000000000 11100000000011111111111111111111111111111111111 11 00000000011100000000011111111111111111111111111111111111 12 10010010010010010010010011111111111111111111111111111111 13 1 00 111111111100111111111100 111111 1111 00 11111111110011111 14 00 111111111100 111111111100 1111111111 00 111111111100111111 15 0 0 111 11111 11 00 11 11111111 00 11111111 11 00 111 1111111 00 1111 1 1 16 001111111111 00 11111 11111001111111111 00 111111111100 111 111 17 00100100100100100100100111111111111111111111111111111111 18 00100100100100100100100111111111111111111111111111111111 19 00100100100100100100100111111111111111111111111111111111 20

(27)

00100100100100100100100100100100100111111111111111111111 83 00100100100100100100100100100100100111111111111111111111 84 01101101111101101101111101101101111101101101111101101101 85 0 110 11 011111 0 11 0 110111110 110 11 0 11111 0 110 110 111110 110 110 1 86 01101101101101101101101101101101101101101101101111111111 87 01101101101101101101101101101101101101101101101111111111 88 11111100000011111100000011111100000011111111111111111111 89 11100000011111100000011111100000011111111111111111111111 90 00000011111100000011111100000011111111111111111111111111 91 00000011111100000011111100000011111111111111111111111111 92 10110111111110110111111110110111111110110111111110110111 93 1 0 11 0 11 0 1 1 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 1111 1111 1111 11111111 1 94 11011011111111011011111111011011111111011011111111011011 95 01101111111101101111111101101111111101101111111101101111 96 01101111111101101111111101101111111101101111111101101111 97 1 1 0 11 0 11 0 1 1 0 11 0 11 0 11 0 11 0 11 0 1 1 0 11 0 1 1 0 1 111 11 11 11111111 1111 98 0 11 0 11 0110 110 110 11 0 110 110 110 110 110 1111111111111111111111 99 0 11 0 11 0 110 110 11011 0 110 110 110 11 0 110 1111111111111111111111 1 00 111111000000 111111000000 111111000000 11111111111111111111 10 1 111000000 111111000000 111111000000 11111111111111111111111 102 00000011111100000011111100000011111111111111111111111111 103 00000011111100000011111100000011111111111111111111111111 104 10110 110 110 110 110 110 110 11 0 110 110 110 111111111111111111111 105 10110111111110110111111110110111111110110111111110110111 106 110 110 111111110 11 0 11111111 0110 111111110 110111111110 110 11 107 0 110111111110 11 0 111111110 110111111110 110 1111111101101111 108 01101111111101101111111101101111111101101111111101101111 109 11011011011011011011011011011011011011111111111111111111 110 0 11 0110 11 0110 110 110 110 110 110 110 110 1111111111111111111111 111 01101101101101101101101101101101101111111111111111111111 112 11111100000011111100000011111100000011111111111111111111 113 11100000011111100000011111100000011111111111111111111111 114 000000 111l11 000000 111111000000 11111111111111111111111111 115 000000111111000000111111 000000 11111111111111111111111111 116 11011011011011011011011011011011011011111111111111111111 117 110 110111111110 110111111110 110 111111110 110 111111110 110 11 118 10110111111110110111111110110111111110110111111110110111 119 0 11 0 111111110 11 0 111111110 110 11111111 0 11 0 111111110 11 0 1111 120 01101111111101101111111101101111111101101111111101101111 121 1 0 11 0 11 0 11 0 11 0 11 0 11 0 1 1 0 11 0 11 0 11 0 11 0 1 11111111111111111111 122 0 11 0 11 0 11 0 110 110 11 0 110 11 0 11 0 11 0 110 1111111111111111111 1 1 1 123 I 0 11 0 11 0 11 0 110 11 0 11 0 11 0 11 0 110 11 0 11 0 1111111111111111111111 124 1 11111 00 0000 1 1111 1 000000 111111 000000 11111111 1 11111111111 125 00000011111100000011111100000011111111111111111111111111 126 00000011111100000011111100000011111111111111111111111111 127 00000011111100000011111100000011111111111111111111111111 128 110110 110 110 110 110 110 110 11 0 11 0 110 110 11111111111111111111 129 11011011111111011011111111011011111111011011111111011011 130 0 110111111110 11 0 111111110 110 111111110 110 111111110 110 1111 13 1 0 11 0 11111 111 0 11 0 11111 111 0 11 0 11 111 11 1 0 11 0 11111· 111 0 11 0 1111 13 2 01101111111101101111111101101111111101101111111101101111 133 01101101101101101101101101101101101111111111111111111111 134 0110 110 110110 110 110110 110 110 110 110 1111111111111111111111 135 0110110 110 110 110110 110110 110 110 1101111111111111111111111 136 111111000000 111111000000 111111000000 11111111111111111111 137 11100000011111100000011111100000011111111111111111111111 138 111 00 0000 111111 000000 111111000000 1111111111111111 1 1

l

1"'111 13 9 11100000011111100000011111100000011111111111111111111111 140

(28)

26

11111100011111111100011111111100011111111100011111111111 21 11100011111111100011111111100011111111100011111111111111 22 00011111111100011111111100011111111100011111111111111111 23 00011111111100011111111100011111111100011111111111111111 24 11100000000011100000000011111111111111111111111111111111 25 11100000000011100000000011111111111111111111111111111111 26 00000000011100000000011111111111111111111111111111111111 27 000000000111000000000 11111111111111 ll

t

11111111111111

t

111 28 10011111111110011111111110011111111110011111111110011111 29 1 00 1111111111 00 1111111111 00 1111111 111 00 111111111100 11 111 30 0 01111111111001111111111 00 111111111100 111111111100 111111 3 1 0 0 111111111100 1111111 111 00 111111111100 1111111111 00 1111 11 32 10010010010010010010010011111111111111111111111111111111 33 1 00 100 100 100 100 1 00 100 100 111111111111111 11111111111111111 34 00100100100100100100100111111111111111111111111111111111 35 0 0 1 00 1 00 100 100 100 100 100 1111111111 11 111111111111111111111 3 6 111111 000 111111111 000 111111111000 111111111000 11111111111 3 7 111000111111111 000 111111111000111111111 00011111111111111 38 000 111111111 000 111111111000 111111111000 11111111111111111 3 9 000111111111000 11 1111111000 111111111000 11111111111111111 40 111 000000000 1 11 000000000 11111111111111111111111111111 111 4 1 11100000000011100000000011111111111111111111111111111111 42 00000000011100000000011111111111111111111111111111111111 43 00000000011100000000011111111111111111111111111111111111

44

1 00 1111111111 0 0 11 1111 11 1 1 00 1 11111 1 1 11 00 111 1 1111 11 0 0 1111 1 45 1 00 111111111100111111111100 1111111111 00 111111111100 11111

46

00111111111100111111111100111111111100111111111100111111 47 00111111111100 1111111111 00 111111111100111111111100 111111 48 100 100 100 100100 100 1 00100111111111111111111111111111111 1 1 49 1oo1oo1oo1oo1ootoo1oo1oo11111111111111111111111111111111 so· 00 1 00 1 00 1 00 1 00 100 1 00 100 1111111111111 11111111111111111111 5 1 00 100 1 00 1 00 1 00 1 00 1 00 100 1111111111111111 11111111 111111111 52 11100000011111100000011111100000011111100000011111111111 53 00000011111100000011111100000011111100000011111111111111 54 00000011111100000011111100000011111100000011111111111111 55 00000011111100000011111100000011111100000011111111111111 56 11100000000011100000000011100000000011111111111111111111 57 00000000011100000000011100000000011111111111111111111111 58 00000000011100000000011100000000011111111111111111111111 59 00000000011100000000011100000000011111111111111111111111 60 10010011111110010011111110010011111110010011111110010011 61 00100111111100100111111100100111111100100111111100100111 62 00100111111100100111111100100111111100100111111100100111 63 00100111111100100111111100100111111100100111111100100111 64 10010010010010010010010010010010010011111111111111111111 65 00100100100100100100100100100100100111111111111111111111 66 00100100100100100100100100100100100111111111111111111111 67 00100100100100100100100100100100100111111111111111111111 68 10110110110110110110110110110110110110110110110111111111 69 10110110111110110110111110110110111110110110111110110110 70 01101101111101101101111101101101111101101101111101101101 71 01101101111101101101111101101101111101101101111101101101 72 01101101111101101101111101101101111101101101111101101101 73 01101101101101101101101101101101101101101101101111111111 74 01101101101101101101101101101101101101101101101111111111 75 01101101101101101101101101101101101101101101101111111111 76 00000011111100000011111100000011111100000011111111111111 77 000000111111000000 111111000000111111000000 111 1 11 111111

u

78 00000000011100000000011100000000011111111111111111111111 79 00000000011100000000011100000000011111111111111111111111 80

(29)

00000011111100000011111100000011111111111111111111111111

44

1 0 11 0 11111111 0 1 1 0 1111 1111 0 110 l 111 1111 0 11 0 111111110 110 111 145 1 0 11 0110 110 11 0110 110 11 0110 110 110 11 0 111111111111111111111 146 10110111111110110111111110110111111110110111111110110111 147 10110111111110110111111110110111111110110111111110110111 .

148

11011011111111011011111111011011111111011011111111011011 149 1 0 11 011111111 0 110 111111110 110 111111110 110 111111110110 111 150 10110111111110110111111110110111111110110111111110110111 151 01101111111101101111111101101111111101101111111101101111 152 0110111111110110111111110110 111111 t 101101111111101101111 153 11011011011011011011011011011011011011111111111111111111 154 10110110 110110 110 110 110110110 110 110111111111111111111111 15 5 1 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 11 0 111111111111111111111 156 10110110110110110110110110110110110111111111111111111111 157 10 11 0 110 110 110 110 110 110 110, 10 110 110 111111111111111111111 158 01101101101101101101101101101101101111111111111111111111 159 0 110 110 110 110 110.11 0 110 110 110 11 0 110 1111111111111111111111 160

(30)

be§iE- camnent: Solid pentam.ino, C.J .:.Bouwkamp, Tecl:mol. Univ. Eindhoven, Netherlands;

inteier i, il, i2, i3, i4, i5, J, k, kl, k2, 1, m, leave, num, frehol, trypis, erase;

inte§er ~ pisl, pis2, pis3, pis4, pis5, pis6[1:160], mat[1:160, 1:56], body[1:6o],

;2rocedll!:!: Output(n); inte§er n;

~ NLCR; NLCR; SPACE(12); PRIN'.rl'EXT({leave•:f.); ABSFIXT(3, O, leave); SPACE{2); PRINTTEXT({num-.:f.); ABSFIXT(3, O, num); SPACE(2); PRINTrEXT(1:freehole=:J.);

!!:!!

i := 1 !tei? 1 ~ n do ABSFIXT(3, O, cohol[i] ); NLCR; SPACE(36); PRINT!'EX!l'( {solution=.:f.);

!!:!!

i := 1 !tel> 1 ~ n ~ ABSFIXT(3, 0, copis[i])

~ Output; NLCR;

camnent: Input piece codes;

~ i :• 1 steE 1 ~ 160 ~

2!:§in pisl[i] := read; pis2[i] := read; pis3[i] := read; pis4[i] := read; pis5[1] := read; pis6[i] := read

~ i;

ccmnent: Input matrix;

· ~ i :• 1 !_~ 1 ~ 160 ~ ~ k :• 1 ~..E 1 ~g 56~ ma.t[i,k] :=read;

camme~t: Initialization;

~ j :• 1 steE 1 ~ 6o ~ body(J] := o;

for j :• 1 steE 1 ~ 12 ~ blck[j] := cohol[j] := copis[j] := 0;

blck, cohol, copis[1:12]; -J •

K

0 ....,

~

0

'0 11

1

....

::s N

~

00

s

@

(31)

o;

count:j := j + 1;

.!£

cohol[j]

+

0 ~ §Oto count; 1 :• j - 1;

comment: 1 is number of initial pieces;

-camnent: AdJust matrix;

~ k :• 1 !"t!~ 1 ~ leave ~

b!§in kl :• cohol[k]; k2 :• copis[k]; blck[p1sl[k2]] := body[kl] :=

body[k1 + pis2(k2]] := body(kl + pis3[k2]] :• body[kl + pis4[k2]] := body[k1+ pis5[k2]] := l end k•

-

~

tor k :• 1 ste~ 1 ~ 56 ~

!!

bod;y[k] = 0 then b!§in !2,:: i :• 1 s~~ 1 ~ 160 ~

becain!! mat[i, k]

+

o

~ §Oto two;

!!

blck[pisl [1]]

+

0 ~ caoto one;

!!

bod;y[k + p1s2[i]]

+

0 ~ §Oto one;

!!

body[k + p1s3[1]]

+

0 ~ io~ one;

!!

bod;y[k + p1s4[1]]

+

0 !b!~ io~ one;

!!

bod;y[k + pis5[i]]

+

0 ~ io~ one;

§oto two;

one: mat[i, k] :• 1; two:

end 1• - I

(32)

three: m :• O,;

four: i :• i - 1; ~ i • 0 ~ ~o;!:o five;

~ ma.t[i, k] - 0 ~ ssoto three;

m :• m + 1; ma.t[i, k] :• i + m; soto four; five:

end k•

- I

tor k :• leave + 1 !~i 1 ~ 1 ~

~!~~ kl := cohol[k]; k2 := copis[k); blck[pisl[k2]] := body[kl] :=

body[kl + pis2[k2]] :• bo~[k1 + pis3[k2]] :• body[k1 + pis4[k2)] := body[kl + pis5[k2]] := 1

~k;

cc::mnent: Initialization ~;

OUtput(8); erase :• 0; frehol :• 1; first: tr.ypis :• 1;

score: ~ frehol >56~ iote sol;

, ~ b~[frehol}

+

0 ~ beiin frehol : • frehol + 1; §.2:!:2 score ~; last: ~ tr.ypis > 160 ~ §otO eras;

~ blck[pisl ( trypis]] = 1 ~ b!ii~ trypis : • pis6[ trypis]; ~oto last ~; m :• mat[ trypis, frehol]; i t m

+

0 ~ begin trypis :• _m; ~oto last ~;

(33)

15 :• trebol + p1s5[tr,yp1s];

!!

body[15] • 1 ~ §~0 next;

till: cobol[j} := trehol; copis[j] :• trypis;

body[trehol] :• blck[pis1 [tr,ypis]] :::a body[i2] :• body[i3] := b~[i4] := b~Jd¥[15] :• 1;

j :• j + 1; trehol := trebol + 1; §O~ first; next: tr,ypis := tr,ypis + 1; f50~o last;

eras: j :• j - 1 ;

!!

J • leave ~ §oto end; kl :• cohol[j]; k2 :• copis[j];

\

cobol[j] := copis[j] :• blck[pisl[k2]] := body[kl] :=

body[kl + pis2[k2]] :• b~[kl + pis3[k2]] := body[k1 + pis4(k2]] := b~[kl + pis5[k2]] :=

0;

trebol := kl; trypis := k2 + 1; erase :• erase + 1;

g:

erase< 20000 ~§~last;

0Utput(8); erase :•

0;

§Oto last; sol: num :• num + 1; 0Utput(12); §~ eras;

end: NLCR; NLCR; PRINTTEXT({number ot solutions=;f.); ABSFIXT(3, 0, num) end

Referenties

GERELATEERDE DOCUMENTEN

hypothesized that depleted individuals would score higher in procrastination self- perception and that they would procrastinate more than non-depleted individuals due to

Onderzocht zijn de relaties van voeding met achtereenvolgens de sierwaarde van de planten nadat ze drie weken in de uitbloeiruimte stonden, het percentage goede bloemen op dat moment

Universal connector polygons can be extended by attaching non-cascading polygons to any edge or by attaching even height and width rectangles to corners.. Any polygon can be extended

8.5 Chapter VI and Chapter VII provide guidance on how to determine an arm's length consideration for an intra-group transfer of, respectively, intangible property and services.

Ten eerste moest er een mogelijkheid komen om door middel van post-globale commando's er voor te zorgen dat stukken tekst alleen op het computerscherm worden

The grey ‘+’ represents the data point inside the sphere in the feature space.... In this case, there are in total

The grey ‘+’ represents the data point inside the sphere in the feature space... In this case, there are in total

Naast en tegenover deze ,,leermeesters'' staan de drie vrouwen die Lasalle misschien niet verder helpen, maar hem op zijn moeilijk pad wèl ondersteunen: de Cambodjaanse hoer