Tuesday, August 18, 2015

Pento

  I was settling in as managing editor at LOADSTAR by the time issue #47 was published, and was publishing some of the old programs I'd started in Las Cruces. Pentominoes was a puzzle game I'd been introduced to in Arthur C. Clarke's novel IMPERIAL EARTH.

  Note: See how my memory works? Yesterday I was sure that I got pentominoes from an Isaac Asimov novel. After reading the Read It for Pento, I see that it was Arthur C. Clarke. I'm not really working too far ahead in this project. I'm re-discovering all these things as I introduce them to you.

  In the early 80s I was living in Las Cruces and playing with the Calhoon Brothers but we didn't have a steady gig like we had in the late 70s. Sometimes we'd only play one or two nights a week and I had time on my hands. So I got into the concept of pentominoes and came up with a board that would allow you to solve the puzzle using substantial tiles rather than pieces of cardboard or whatever. More about that later.


 But first, the program. Here's the Read It:

  There are some things in this great universe of ours that are the same no matter where you are. Counting numbers, the Platonic solids, pi, the gravitational constant, the speed of light, the age of Jack Benny — all of these remain constant throughout the universe. To this illustrious list you can add pentominoes.

That’s right, pentominoes.

If you take two squares and glue them together, you come up with a domino. Three squares will give you a tromino (or triomino). Five squares glued together will produce a pentomino. How many distinct ways can you glue five squares together? No cheating — stick to one plane.

Let’s see, you can have five squares in a line. Or four squares in a line and one square off to the side of one of the end squares. How about four squares in a line and one square off to the side of one of the middle squares? Then there’s three in a line and two stuck off to the side. See how many you can find before turning the page. No matter how many you come up with, there are twelve and only twelve. Here they are.
 

Note: I couldn't get this part of the Read It to show properly in the blog, so here is a screen shot from the Commodore itself showing the twelve ways to adjoin 5 squares. The shapes are named I, L, Y and N (top row), then T, V, U, P (middle row), followed by X, F, W and Z (bottom row).


Each pentomino has its own distinct shape and characteristics (and is named by a letter of the alphabet that most closely resembles it). There are a lot of things you can do with pentominoes and this game, PENTO, is only one of them. You can play against the computer or against a fellow human. Since the computer plays completely without intelligence, the best games will be against a friend, but I think you’ll find the computer beating you more often than is comfortable.

The ‘board’ is a typical 8 x 8 checkerboard. The players take turns playing a pentomino on the board. The last person able to play a piece on the board is the winner. That’s about all there is to it.

There are on-screen prompts and instructions to help you move the pentominoes onto the board. Remember that each piece can be rotated and flipped. Decide where you want the white square of the pentomino placed and enter that number. For instance, ‘38’ would be the third row, eighth column. If you change your mind about playing a certain piece after choosing it, simply rotate (by pressing ‘R’) the piece until the piece removes itself from the board and you are prompted for another piece.

Press RETURN when you are satisfied with your move.

PENTO doesn’t recognize when the game is over. You can press F1 anytime and you’ll be asked if you want to play again or quit to LOADSTAR. When there are no more moves left press F1 to end the game.

The only real strategy I’ve been able to come up with is rather obvious — always make sure that there are an even number of plays left AFTER you make your play. This roughly translates into: always make sure there are an even number of ‘areas’ left AFTER you make your play.

There is an excellent book on pentominoes called ‘Polyominoes’, by Solomon Goloumb of the University of Southern California. I first learned about pentominoes from Arthur C. Clarke’s Imperial Earth. Both of these are terrific reading.

The task described in Imperial Earth is to place all twelve pentominoes in a 6x10 rectangle. I must humbly admit that I am an expert at this task and have personally found (without aid of computer) over 1000 of the 2339 possible solutions. I have them charted and would happy to share my information with any fellow pento-freaks out there.

Write to me, Fender Tucker, care of LOADSTAR. Jim Butterfield wrote an ML program that ‘solves’ the 6x10 puzzle, but it takes several hours to find even one. It’s sort of inspirational to know that there are tasks that my feeble human brain performs thousands of times faster and better than a Butterfield ML program.




Back here in 2015. Now that we have a mouse to move things around, the system I came up with for PENTO is hilariously complicated.  A few years later, I had C.E. "Spock" Prince, a young guy from Shreveport who came to work for Softdisk, write a much better version of PENTO for LOADSTAR. 

  The programming in this game illustrates something that I imagine all professional programmers might agree with: as you get better, it all gets simpler. The logic I came up with for this game (one of my first) is incredibly complicated. I'm sure I couldn't understand it if my 40-year-old self tried to explain it to the 68-year-old I am today. But it didn't have to be complicated! Later on I learned techniques and algorithms that make a game like this quite simple. I guess my recommendation to programmers is to spend 10 years studying algorithms, then start writing code, rather than the way I did it.

  I still have some of the pentominoes boards I made back in the early 80s out of bathroom tiles and Super Glue. The boards were made from masonite with a velour cover. Here's my masterpiece, with little snakes drawn on each tile.

Another tile set in action.
Here's another set, using a 5x12 board rather than the standard 6x10 board.
 And the weirdest of them all, a set where the intersections of of the five squares are marked, rather than the general shape of the pentomino. Also, the board is not a 6x10, but two 6x5 areas offset by one in the middle.

And in case you doubt the severity of my obsession with pentominoes in the late 70s, here is one page (of dozens like it) with some solutions to the 6x10 pentomino puzzle.
 See that "2" up in the left corner of the page? That means that each of these solutions is actually 2 solutions because each one has a couple (or more) tiles that can be flipped to make a different solution. Three of the solutions above were found to have even more than one flipping possible -- the ones with (6) or (4) above them. Like I said, I really got into pentominoes.
 
  Tomorrow night brings us to the second and final Inspector La Mort mys-adventure from LOADSTAR #48, Murder in the Monastery. If you think these blog entries are getting a little wordy, you're right, but Monastery takes the cake. Not only will you get the complete adventure program tomorrow, I'll supply you with the PDF and ebook of the novelization of the game. You won't have to struggle through the Library of St. Isosceles game; I've written it all out noir-style for you. Lotsa words.