The note was still mostly legible, Fabian decided. You could read the vowels, for instance. If you squinted.
In all fairness, it might have been written with painstaking care, but chewing on it certainly did nothing to aid the author’s personal war with penmanship. Fabian hadn’t meant to chew on it, but how else was he expected to discover a slip of paper in his pottage?
He sighed, trying again to decipher the message. It was signed with a single initial, “J”—he could make that much out—but the few other words that could be parsed were unhelpful. Perhaps the message was meant to be read upside-down… Or maybe backwards?
“That’s cows for you,” he muttered, and wondered once again what his father had meant by the phrase.
His musings were interrupted by the sound of someone coming down the hall outside his cell. There was a loud rumbling, accompanied by footsteps and a jaunty whistling—a sound so jarringly cheerful that it made Fabian want to hurt someone. He listened with growing trepidation as the whistler grew closer, and closer. As he’d feared, the rumbling—and the whistling—stopped just outside his cell.
There was a soft mutter. Keys jangled. The whistling started up again—perhaps perkier than before—as a key was inserted into the lock of his cell.
Click.
And then…nothing. Only the whistling continued, just outside his door, which was now definitely unlocked and even slightly ajar.
Was…was someone actually waiting for him to open the door? To, essentially, let himself out? That was kind of unprecedented. Well, actually, Basil had done just that the last time, but he didn’t think this was Basil. His master never whistled, for one thing.
The suspense was…well…not killing him, precisely. More like beating him really badly, but leaving him maimed and bloody as a lesson to others. He had to know.
He got up quietly and tiptoed to the door. Then he pried it slowly open, just enough to peek out.
The door squealed, of course.
To say the man in the hallway was “gaunt” would be criminal understatement. The word would need to call in reinforcements, like “severely” and “skeletally”, and maybe even a superlative or two. Even then, these poor words would likely feel outnumbered in the face of this man’s excessive thinness. If a mop were to grow arms and legs, it would look positively portly next to this fellow.
He was standing next to a barrel on wheels which had various cleaning implements poking up out of it: a mop, a few brooms. Several well-used rags were draped around the barrel’s rim. Fabian realized he was looking at the source of the rumbling sound.
At the squealing of the door, the extraordinarily lean gentleman glanced around quickly. He ceased whistling, and a toothy smile easily twice as wide as his head blossomed on his face. “Master Fabian!” he said.
Fabian gawked. “Captain Chuckleworthy?” he said incredulously.
The man made a deprecating gesture. “Pfaw, just Jasper these days, young Master.”
“But…but…” Fabian paused to open the door a bit wider and glanced up and down the hall. “I thought, after the last time, my brother would have…you know…”
Jasper laughed. “Master Fergus?” he asked. “Oh, he was a bit upset, sure. Gave me quite a talking to, he did! Told me I did wrong to let you loose, but I told him that I just couldn’t stand to see the two of you at odds, so I had to do something about it.”
Fabian blinked. “And he didn’t…kill you, or anything?”
Jasper did a little pirouette. “Very alive, as you can see! In fact, he made me one of the janitors! Such a step up from the guard duty. I still thank him every time I see him. No more armor, for one thing. It was marvelously sturdy, but I always struggled a bit to put it on. And now I get one of these!” He held up a squeegee about as long as his arm, with a broad sponge on one side of the head, and a glistening rubber blade opposite it. The handle was black—possibly even ebony—inlaid with some kind of pale wood, and carved in intricate geometrical patterns.
Fabian paused in spite of himself. “That,” he said, “is a nice squeegee.” He reached out and reverently ran a finger along the rubber blade. Then he shook himself. “Did you leave me the note in my breakfast, then?”
Jasper nodded, grinning. “Aye! The way I figured it, what better place to hide it, eh? You’re hardly likely to miss it!” He laughed jovially.
Fabian just smiled and shook his head. “I…kind of accidentally chewed on it.”
Jasper laughed again, harder. The sound echoed down the hallway, and Fabian winced. He gestured for the man to quiet down. “What did the note say?”
Jasper wiped tears from the corners of his eyes. “You were hungry, weren’t you!” He shook his head, chuckling. “The note just said I’d be by around lunchtime to unlock your door. Told you to be ready. Looks like you got by just fine without it!”
“Well, thanks, Jasper,” Fabian said. “I owe you—again. But what about the guard down here? And what about my brother?”
Jasper tapped his head and smiled. “Ah, but I’m a thinker, see. I took care of it all. Roscoe’s got himself a girl in town, you know, and I volunteered to watch the dungeons so he could slip out to see her. There’s no one down here but us two!” He smiled triumphantly.
“But what about when I’m missed?” Fabian asked. “Won’t the guard—Roscoe—get in trouble for it?”
Jasper thought a moment. “Well now, that’s possible, I suppose.” A frown tried to displace his smile, and failed. He shrugged. “But then he’d probably have more time to spend with this girl, wouldn’t he? Things always work out.” He made a shooing motion. “Now go, get a move on. You’ll need to take the back exit again, since your brother has posted extra guards along the front way. I’ll just mosey back to the guardroom and get comfortable.”
Fabian thanked the jovial janitor once more and moved swiftly down the hallway as before, only with significantly less panic this time. It wasn’t long before he reached the darkened sections and paused in a familiar alcove. He pulled his twig out, summoning Nigel with a quick gesture.
A bang, a puff of sharp black smoke, and a thundering voice.
“WHO SUMMONS ME? ANSWER, MORTAL, OR FEEL MY WRATH!”
“Shush!” Fabian said desperately. “Will you please doing stop that?”
Nigel harrumphed. “It’s in my contract,” he said. “Article two, paragraph five.”
“Fine,” Fabian said, rolling his eyes. “But can you at least tone it down?”
“Tone it down?” Nigel sounded incredulous. “What? Maybe you’d like me whisper it?” He dropped his voice to a hoarse whisper. “Answer, mortal, or feel my wrath!” He shook his head and spat disgustedly. “Pshaw! I’d be the laughing stock of the Nether Realms! All the truly great demons arrive thunderously.”
“But, come on. You aren’t even a—”
“DON’T SAY IT.” For the first time, Nigel’s voice truly sounded menacing.
Fabian sighed. “Whatever. Fine. Anyway, you said if I escaped from my cell again, you’d show me another way to find a decent path out of here.”
A small light blossomed around Nigel. He still seemed vaguely put-out, but he looked around and nodded. “Yes, and you do appear to be out of that lovely little box they put you in. Fine. Allow me to introduce you to my good friend, ‘A-star’”.
Fabian raised an eyebrow skeptically. “You’re going to show me a star?”
Nigel rolled his eyes. “You are so dense you could scratch diamond, my friend. Not ‘a star’, no. It’s the name of an algorithm: ‘A’ followed by an asterisk, pronounced ‘star’. ‘A*’. Got it?”
Fabian shrugged uncomfortably. “Whatever. Any chance you could just do the thing and then teach me how it works while we go? I’d like to avoid wasting too much time, here.”
Nigel tsked. “Wasting time? Learning something is wasted time? You need to watch that attitude of yours before it wastes your opportunities.” He turned and surveyed the hallway. “But, as you wish. I’ll be right back.”
The homunculus was gone about five minutes, this time. Fabian had just enough time to begin worrying before Nigel returned.
“I thought you said this one was fast?” Fabian complained.
Nigel growled. “It is,” he said. “Compared to Dijkstra’s. Everything is a trade-off, right? You want the absolute shortest path, you’re going to have to wait for it. You want a path right now, you’re going to get a lousy path. A* falls in between.”
“Fine, fine,” Fabian said. “I didn’t mean to complain. Let’s just get going before I’m missed.”
Nigel snorted dubiously. He eyed Fabian a long moment before turning and leading them deeper into the darkness.
They reached the stairwell after just two minutes of walking, having taken an apparent shortcut through an ancient storeroom. At least, Fabian hoped it was a storeroom. There weren’t many other pleasant reasons he could imagine for a dungeon to include a room full of large pine boxes.
Two minutes. Fabian was heartened. “This really is going faster,” he remarked to Nigel as the old door squealed open.
Nigel eyed Fabian resentfully. “I won’t say ‘I told you so’,” he said, “even though I did, and even though you deserve it.” He was silent a moment as they started up the stairs. Then he barked a laugh. “Who am I kidding? Of course I will. ‘I told you so.’”
Fabian shook his head. “So, how does this A* thing work, anyway?”
“Well,” Nigel said, choosing his words. “It’s really just another variation on Dijkstra’s. All you do is change the heuristic that decides which clone gets to do the walking.”
“Which heuristic is that?”
Nigel paused at one of the landings and considered a moment before replying. “Remember what I told you about the greedy best-first search?”
Fabian nodded. “I think so. You always choose the cell that’s closest to the exit, in a direct line.”
“Correct,” Nigel said, crouching down and drawing a small maze in the grime on the floor of the landing. “And you can think of Dijkstra’s as always choosing the next unvisited cell that’s nearest to the starting point. We start here.”
He marked the first location.
“Then we move out from there, one step.” He marked the locations just adjacent to the starting point.
“And we continue like this,
“Step,
“After step,
“To the end.” He marked the last location, beside the exit. “In other words, Dijkstra’s is always trying to find all the shortest paths of all possible lengths, from shortest to longest.”
Fabian considered that. “I think that makes sense,” he said. “That’s how it guarantees that it will find the shortest path between any two points, then. Yeah? Because by the time it gets to any given point, it’s already found the shortest path to the cell just before it.”
Nigel eyed Fabian speculatively. “That’s very…inductive of you.” He sounded surprised.
Fabian blushed.
“Anyway,” Nigel said. “The A* algorithm strikes a balance between those two.” He rubbed out the maze and drew another one.
“As before, I walk the maze, and clone myself at each branching, right?” He drew a path through the maze, stopping at one of the branches.
“To decide which clone walks next, I take the actual distance I’ve walked so far,
“And add that to the direct-line distance to the exit.
“Whichever clone comes up with the smaller number,
“Wins.” He circled one of the clones and tapped it with his finger.
Fabian chewed his lip a moment. “And that works?”
“What do you mean, ‘and that works’?” Nigel asked, indignant. He stood up and dusted his hands off. “Of course it works. Think about it. Dijkstra’s always tries to minimize the distance you’ve traveled, and thus eventually gives you a shortest path, right?”
Fabian nodded hesitantly. “…Right.”
“And greedy,” Nigel continued, turning and proceeding up the next flight of stairs. “It always tries to minimize the direct-line distance to the exit, right?”
Fabian nodded again, a bit more confidently. “Right. Only, that’s it’s problem, isn’t it? Because that direct-line distance is almost never going to be the real distance you have to travel to get to the exit. It’s a guess, and could be really off the mark.”
Nigel nodded as he climbed. “Exactly. It’s a best-possible distance to the exit, but it’s a guess. A heuristic. So you take the A* algorithm, and it scores each location based on the sum of the distance traveled from the starting point—which is a known value—with that direct-line distance to the exit—a heuristic. In other words, it’s trying to minimize the estimated total length of the path.”
Fabian mulled that over as they continued up the stairs. “I don’t know,” he finally said. “It doesn’t seem all that different from greedy.”
Nigel sighed. “Simplify it. Consider a straight line.
“On that line, Dijkstra’s is always looking backward, counting how far it’s traveled.
“Greedy is always looking forward, guessing how far it has yet to go.
“But A*, now…it looks both forward and backward, trying to estimate how long the line really is.”
Fabian squinted, thinking. “Right, but…why doesn’t it have the same problems that greedy does?”
“Oh, it isn’t perfect,” Nigel said. “But it avoids the problems that greedy has because it considers how far it’s traveled at each point. That’s a known value. By informing each decision with that known value, the algorithm knows to jump to another clone if one path starts to get a bit too long.”
Fabian shook his head. “I might need to take your word for it. I’m having a hard time seeing this one.”
Nigel reached another landing and glanced around. “Here,” he said. He drew a quick maze on one of the walls, and then tapped it in two places. “The start—here—and the finish—there.” Then he drew a line through the maze, connecting the two locations. “And that’s the shortest path between them, for comparison. Now, watch.” He tapped it again, and another little line magically began drawing itself in the grime.
Fabian watched, transfixed, as the line seemed to snake around like lightning striking, first pursuing one path, then another, the path getting slightly longer each time but jumping around surprisingly often. Eventually, it reached the finish.
“That was A*?” Fabian asked.
Nigel nodded. “Yeah. But, you know—” He drew two more copies of the maze. “Try this. Watch how those three algorithms all solve the same maze, at the same time. Maybe it’ll help you see how they compare.” He tapped the wall again, and the lines began snaking through the mazes in unison. Fabian watched raptly.
Greedy finished quickly, then A*, and finally Dijkstra. Fabian nodded in realization. “I think I see,” he said. “Greedy basically goes with a single path, trying as few alternatives as possible because it never thinks about how far it’s traveled. Dijkstra tries all shortest paths—even those that can’t possibly be solutions—because it’s never looking ahead at all.” He pointed at the A* maze. “But this one—it knows when a path is getting too long, because it can recognize that it has traveled a good distance but still has some way to go before it could possibly reach the exit. So it’s able to try more alternatives.”
Nigel nodded, smiling. “There you go!” He snapped his fingers and the mazes disappeared from the wall. “Now, come on. Playtime’s over.”
They moved through two more storage rooms in what seemed to be a nearly direct line for the servant’s exit at the back of the keep. Fabian was oddly pleased to note that most things seemed unchanged since he had lived here, but there were a few differences. Strange paintings hung on some walls, odd landscapes and even a farmyard setting that he recognized from his childhood, except…the version he remembered had included livestock grazing in the fields. He decided that Fergus had gained a decidedly unusual taste in fine art.
They were making good time, and Fabian began to hope that perhaps this time he’d actually escape. He’d need to send a message to Basil somehow, to let him know to meet him outside the mazes. Maybe his master would hear that Fabian was gone and figure the rest out. He was clever that way. Usually.
Nigel abruptly turned down one of the servants' passages and then halted in a small alcove opposite one of the kitchens. Fabian looked around, confused.
“What are we stopping for?” he asked.
Nigel gestured to the wall. “I’m waiting for you to open this door.”
Fabian pursed his lips. “That’s…a wall.”
Nigel sighed. “Actually,” he said. “It’s a concealed door.”
“What?” Fabian asked. “Really?”
Nigel shook his head. “What is your deal? Yes, really.”
“That’s crazy,” Fabian said, tapping the wall gingerly. “I never knew there were any secret passages in the castle. How do I open it?”
The homunculus shrugged. “No idea. Not my job, remember? But you just let me know when you figure it out, and we’ll move on.”
Fabian tried pushing on the wall, tapping on bricks, wiggling lamp fixtures, and even begging. Nothing worked. He was well aware of time passing, and the urgency wasn’t helping him to think.
“How am I supposed to know?” he asked Nigel. “Why would you even choose this path? I don’t know how to open doors like this!”
Nigel shrugged and considered his fingernails.
Fabian sighed and looked around. He caught sight of a painting hanging in the alcove, and paused. A painting? Here? Why would they hang a painting in a servants' passage? And… Looking more closely, he realized something odd about the picture. Unlike virtually every other painting he’d seen in the castle so far, this one actually included livestock. A small herd of cattle grazed in the field, with one black-and-white heifer a bit off from the others.
A dead-end. A difficult decision. That’s cows for you.
On a hunch, he raised his hand and tapped the lone cow.
There was a click and the wall beside Nigel swung slightly outward, moving silently on what must have been very some well-oiled hinges.
Fabian gaped. Even Nigel looked surprised.
“Well,” the homunculus said after a moment. He turned and eyed Fabian. “Well. I wonder if a pig somewhere just sprouted wings.” He pushed open the door and stepped inside the darkened room beyond. “Come on,” he said. Fabian followed, carefully closing the door behind him.
The room plunged into blackness.
“Really?” Nigel said, voice echoing slightly in the dark. “You couldn’t leave the door open a crack?” He sighed in a most put-upon manner before suddenly flaring himself to light. “Anyway, let’s—”
“What,” Fabian said, breathlessly, “is all this?”
The room—what they could see of it in the darkness—was large, and full of tables. Each table was covered in glass vials, decanters, crucibles, mortars and pestles. Jars filled with colorful powders and liquids sat beside bowls of various sizes and shapes. Books lined the shelves.
Nigel eyed it all quickly. “It’s a laboratory, is my guess.”
Fabian licked his lips. “Well, yes, of course it is, but…” He looked at Nigel. “Why?”
Nigel sighed. “One would think you would eventually stop asking me questions like that.”
Fabian walked over to one of the tables and looked over the equipment. “I mean, it looks alchemical.” He said the word distastefully. “Look at the books. ‘Calcination and You’. ‘Fifteen Fun Projects with Aqua Fortis’. ‘Truth and Fiction in Lunafaction’. These are all alchemical texts.”
Nigel raised an eyebrow. “So?”
Fabian shook his head. “Why would Fergus be involved with alchemy? He’s better than that. And besides, he’s already a wizard. He spent five years studying under Orville the Oracular himself. He doesn’t need to stoop to…to…this.” He gestured to include the room and its implements, and grimaced.
Nigel shrugged. “There’s no accounting for taste.” He looked around disinterestedly. “Shall we go?”
Fabian hesitated, but nodded. “Yeah. But I sure wish I could talk to Fergus about this room.”
Nigel led them to the far side of the laboratory, weaving around tables and stools and stacks of books. They reached an unremarkable door which Fabian pushed open, revealing another alcove and hallway which echoed with odd crashing sounds. They were much closer to the rear exit now.
Nigel gestured and moved into the hallway. Fabian followed, ears ringing from the noise. “I recognize this area,” he said, shouting to be heard over the din. Realization was dawning, and a bit of panic, too. “This—this is where—”
They turned a corner, and walked into a large room. Weapons lined the walls in racks and on stands. A dozen armored guards looked up from their sparring in surprise.
Fabian sighed. “This is where the guards are trained.”
Back in his cell, Fabian growled. “You’ve not been very helpful so far, you know.”
Nigel shrugged, slouching against the wall. “Go ahead. Blame your tools. Speaks volumes about your competence, you know.”
Fabian sighed. “Fine. So teach me!”
Nigel rolled his eyes. “If it wasn’t for the fact that you now owe me two sandwiches, I’d leave you high and dry. I hate teaching.”
“It shows,” Fabian spat.
“The problem,” Nigel said, “is that you keep asking the wrong questions. You are specifying the wrong goals. You don’t just want out, you want out via a short path, quickly discovered, which also avoids time sinks and danger zones, like secret doors and”—he coughed discreetly—“guard rooms.”
“Shouldn’t that be obvious?” Fabian asked. “Do I really need to spell it all out?”
“Actually,” Nigel said. “Yes. Yes you do.”
“So what would you do differently if I asked you what you just said?”
Nigel stroked his goatee. “Differently? Hmmm.” He sighed. “I suppose I’d begin by talking to you about cost…”