Captain Vorpatril’s Alliance

Captain Vorpatril's Alliance Captain Vorpatril’s Alliance is the latest book in Lois McMaster Bujold’s long-running Vorkosigan series of space operas. It takes place between Diplomatic Immunity and Cryoburn, and though Miles Vorkosigan makes a brief appearance this is a book solidly about Miles’ cousin Ivan Vorpatril.

Long-time readers of the series will be familiar with Ivan, who’s been a foil for Miles in a number of the books; he plays the comic relief in Cetaganda, gets trapped in a giant water pump in the Thames estuary in Brothers in Arms, throws Miles in a tub of ice water in Memory, and helps foil a plot or two in A Civil Campaign. Still, he’s usually the comic relief; and unlike his cousin he’s not at all the go-getter type. What Ivan wants is a quiet life; and for most of his life, due to his dreadful nearness to the throne of Barrayar, having a quiet life has required being unambitious and unnoticed. Ivan, like Claudius, has spent his life hiding his light under a bushel. We see this cover slip a bit in A Civil Campaign, where he gets caught up in some intrigue with Imperial agent Byerly Vorrutyer; and it comes all of the way off in this latest book.

It seems that Ivan (who’s not at all stupid, even though Uncle Aral has always called him “that idiot Ivan”) has risen to the rank of aide to the admiral in charge of operations for the entire Barrayaran fleet. He’s invaluable in that role because of his highly developed political sense, and he likes it because the admiral is a good boss, and he usually gets to stay in the capital, Vorbarr Sultana. As the book begins he’s on Komarr with the admiral conducting a surprise inspection, when Byerly Vorrutyer catches him and (Miles-like) gets him totally wrapped up in something that doesn’t concern him…until suddenly it concerns him very closely indeed. He might even (consternation, uproar!) end up….married!

I have long been in the habit of reading Bujold’s new books aloud to Jane. They read aloud well, and they are usually funny in spots, and we enjoy trying to figure out where’s she’s going before we get there. This one came out on the Tuesday, 6 November, and I had to finish reading it to her by Saturday, 10 November, because I was getting on a plane first thing on Sunday. It was rough, but I managed it, and enjoyed every minute.

The whole series is good; the worst are pretty good and the best are really amazingly good. The last really amazingly good one was A Civil Campaign, which is brilliant; the next two were at the lower end of the scale, and this one pleasantly comes in about the middle of the pack: a solid entry, and some good storytelling.

If you’ve not read anything by Bujold, start with Young Miles or Cordelia’s Honor and work your way through.

Back from Chicago

I’m just back from a week in Chicago, at this year’s Tcl conference. If you left a comment on a recent blog post during the last week, I might just have responded today.

I visited St. Peter’s in the Loop a couple of times, and hey, Julie, they have two copies of your book in their bookstore.

Recursive Backtracking

Here’s yet another maze, produced by a method called recursive backtracking. Unlike the previous algorithm, which is something I came up with myself, this is a well-known algorithm with rather delightful properties, as you can see for yourself.

Mta

The algorithm is straightforward:

  • Create a new, blank maze in which all cells are free. (A free cell is connected to no other cell). You can think of the free cells as square rooms with a closed door in each of the four walls.
  • Initialize an empty stack of cells.
  • Let C be a cell chosen randomly.
  • Repeat:
    • If there is at least one free cell next to C,
      • Let D be a free cell next to C, chosen randomly.
      • Open a door from C to to D.
      • Push C onto the stack.
      • Let C = D.
    • Otherwise,
      • Pop an old C from the top of the stack.
  • Until the stack is empty.

The maze shown above uses a slight variant called “inertia”, which makes it a little more likely that the next free cell chosen will be in the same direction as the previous. This makes the straight corridors just a little longer.

Like the previous algorithm, it produces a “dendritic” maze: one in which each cell is connected to every other cell by exactly one path. That’s cool if you’re printing the maze on a place mat, but a little boring if you’re using the maze in a game, so the next step is to take a maze like this and modify it in various ways.

A Bigger Maze

For Mark Lambert, here’s a bigger maze with an entrance and an exit.

Bigmaze

Kardde was curious how it was produced.

First, a maze is represented as a rectangular array of cells. Each cells is square, and has a wall on each side, and each wall has a door. When the algorithm begins, all of the doors are closed. The algorithm proceeds by judiciously opening doors into neighboring cells until all of the cells are reachable. A cell with all of its doors still closed is said to be “free”. Here’s the algorithm:

  • First, create a maze in which all of the doors are closed.
  • Pick a cell randomly, and add it to the list of growth candidates. (It will be the only entry.)
  • While there is at least one cell in the list of growth candidates,
    • Take a cell, C, from the list of candidates.
    • Find any free cells adjacent to C (north, south, east, or west), and pick one randomly. Call it F. If there are none, continue with the next candidate cell.
    • Let D be the direction from C to F.
    • Randomly pick a number N, from 1 to 4.
    • Beginning at cell C, drive in direction D, opening doors into free cells, until you’ve reached the Nth room, or the edge of the map, or a cell that’s not free.
    • If there are still free cells left adjacent to C, add it to the list of candidates.
    • Add the last cell to the list of candidates.
  • When no candidates remain, all cells are connected, and the maze is complete.

There are a number of things you can change about this. In particular, you can change how you pick the next candidate: the first entry, the second entry, a random entry, and so forth. Different choices will result in different looking mazes. Second, you can vary the number of steps to drive while opening cells. In the maze shown above, you drive up to four cells, random chosen from 1 to 4. Again, different numbers of cells make a difference. For example, suppose that instead of choosing a number from 1 to 4, I simply always choose 4:

Bigmaze2

As you’ll note, it looks quite a bit different.

Amazing

Here is the first real maze produced by my new Java code. It’s not a great maze (there are better algorithms), but I learned a lot from doing it.

Mta

A Cup of Joe

I’m a long time Tcl programmer; I can make Tcl sit up and beg. It’s been brought home to me, though, that the demand for making Tcl sit up and beg is low where I work. If funding were cut for my current project and I had to jump to another, my Tcl experience might not count for much. (One doesn’t always have the luxury of starting a new project and picking the infrastructure one wants.) Java, on the other hand, is widely used; and though I’ve done some work in Java it’s been around eight years. A Lot Can Happen in Eight Years, and in the case of Java it has. When I last used Java, it was Java 1.4 (or maybe even Java 1.3; I seem to recall that 1.4 was brand new). Java 6 is fairly standard today, and Java 7 is picking up steam.

I didn’t like Java 1.4 much, but Java 5 (i.e., Java 1.5; they dropped the “1.” around then) added a bunch of nifty new features that make the language much nicer to work with:

  • Parameterized Types (i.e., Generics)
  • A colllections library based on Generics
  • Annotations
  • Enum Classes
  • Auto-boxing and unboxing

(And no, I’m not going to describe all of those.)

More than that, I did all of my work at the command line, using the Emacs editor; all the cool kids these days seem to be using this Integrated Development Environment called Eclipse. Seems that if I want to fit in on an existing project, I’d better learn that too. So that’s my new project for awhile: rediscovering Java and learning how to use Eclipse.

I don’t know how much I’ll blog about it, but I thought I’d show the fruits of my first morning’s work: an image rendered by a short Java program.

Checker

Some years ago I wrote a little old-school dungeon-crawling game called Ramble, and I put together some algorithms for creating random dungeon mazes. I’m thinking that I’ll try re-implementing some of those in Java, as a first project; and save the finished mazes as PNG images. Think of the above as the proof-of-concept: how to draw an image and save it to disk.

My Sisters the Saints

My Sisters the Saints: A Spiritual Memoir Recently I received a review copy of My Sisters the Saints, a “spiritual memoir” by Colleen Carroll Campbell, and I confess I stayed up late to finish it.

In this book Campbell shares her life with us, both the good and the bad, and along the way she tells about particular saints who helped her get through. The names are familiar: St. Teresa of Avila; St. Therese of Lisieux; St. Faustina, St. Edith Stein, Mother Teresa, and St. Mary, Mother of God. She tells us of their lives and writings, and just what there was about them that spoke to her and helped her to cope with the trials of her life. I was familiar with most of the saints in question, but nevertheless I learned a thing or two about them.

The compelling part of the book, though, is Campbell’s own story, and her efforts to get over herself, and to learn to serve and love God. Running through much of the book is the story of her father’s struggles with Alzheimer’s Disease. These passages resonated especially strongly with me, because my own father was afflicted with Alzheimer’s in his last years.

My father was a brilliant man, and a born problem-solver, and it was horrifying and distressing to watch his capabilities fade. More than that, nothing made Dad angrier than a problem he could nothing about (politics, consequently, always made him furious), and as time went on there were more and more of these. Once he got terribly angry with my wife Jane, because “People aren’t keeping me informed about what’s going on!” Jane, with perfect grace, said, “Yes, Dad, you’re right.” And he was—not for lack of trying on our part, but he was right.

Every since then, I’ve determined that if I get Alzheimer’s in my turn, as seems likely (all of his siblings who lived long enough have shown the signs), that I want to be jolly rather than grumpy. And to be jolly then, I figure I need to stop being grumpy now. It’s a hard thing to do.

But Campbell’s father has shown me a better way. Campbell came to befriend the saints while learning to cope with her father’s illness; but her father had spent the better part of his life learning to know God and his saints. And in the year or so after the onset of Alzheimer’s, when he could still talk and make some amount of sense, everyone who met him was struck by his joy and his faith. Here was a man who was offering up his trials to God, and spreading God’s love and peace to his family and to the others in the nursing home where he lived.

Eventually Campbell’s father deteriorated to the point where he couldn’t even talk anymore, far past where my father was when my father died; and he suffered horribly. But he held on to the joy as long as he could.

So that’s my new goal. I don’t just want to be jolly when I’m old and infirm; I want to be joyful, and a blessing to those around me. May it be so.