The Theory
In which our protagonist has an idea, explains it badly, and then explains it well, and Lian writes it down.
The theory came to Kenji on a Sunday.
He was sitting in the chair the king had given him, in the small room he had claimed as his office, with Pip on his shoulder and a book he was not reading on his lap. He was thinking about the storms. He was thinking about the corruption. He was thinking about the fact that all of the symptoms, the droughts, the floods, the earthquakes, the corruption, were happening in different places at different times, with no obvious pattern.
Then he saw the pattern.
It was not a spatial pattern. It was a temporal one. The symptoms were happening in waves, each wave offset by a few hours from the previous one, like ripples in a pond. The first wave had been the earthquakes. The second wave had been the storms. The third wave was forming now, somewhere in the east, where the reports were coming in of strange lights in the sky.
It was, he realized, a process. A process that was running, slowly, through the world's source code, leaving corruption behind it. The process was not random. It was a search pattern. Malachar was searching for something. The storms, the earthquakes, the corruption, were the side effects of the search.
He called Lian. He called Master Yuen. He called the king. He called Elara. He cleared the table. He pulled out a piece of paper. He started drawing.
"The corruption is a process," he said. "The process is searching. It is looking for something in the source code. The storms are side effects. The earthquakes are side effects. The corruption is a side effect. The thing being searched for is the primary effect."
"What is it searching for?" Master Yuen asked.
"I do not know. But I know the pattern. It is a depth-first search. It is going through the source code, methodically, leaving corruption behind it. The corruption is a marker. It is saying 'I have been here.'"
"Like a debugger marking visited nodes."
"Exactly like a debugger marking visited nodes. Malachar is debugging the world's source code. He is looking for something. He is leaving corruption behind. He will find what he is looking for, eventually. And when he does, the side effects will stop."
"What happens when he finds it?"
"I do not know. That is the part of the theory I do not have yet."
Lian was writing. Her notebook was filling up. She had been writing since he started talking, her hand moving fast, capturing every word, every diagram, every line of the pseudocode that Kenji was sketching on the paper.
"The solution," Kenji said, "is not to stop the search. The solution is to find what Malachar is looking for, before he does. The solution is to be faster than the bug."
"How do we do that?" the king asked.
"We read the source code. We use the Compiler. We trace the process. We identify the target. We get there first."
"Is that possible?"
"Any sufficiently well-defined problem is solvable. This is a sufficiently well-defined problem. The theory is clear. The method is clear. The timeline is short. But it is possible."
He paused. He looked at the people in the room. The king, the mage, the apprentice, the dragonfly. They were all looking at him with the same expression: a mix of hope and terror, the expression of people who are about to do something impossible.
"There is one more thing," he said. "The target Malachar is searching for is probably a piece of the original source code. A piece of the world's architecture that was left unfinished. A piece that, when found, will let Malachar do whatever he has been planning for a thousand years."
"What is he planning?"
"I do not know. But the original architect, the original programmer, the one who wrote the world's source code, was Malachar himself. He was the world's first developer. He was the world's first bug."
The room was silent.
"We are debugging a god," Master Yuen said, finally. "We are debugging a god, and the god is the original developer, and the bug is a thousand years old, and the solution is to find the unfinished code before he does."
"Yes."
"That is either the most brilliant plan I have ever heard, or the most insane."
"Probably both."
She looked at him for a long moment. Then she smiled. It was a tired smile, but a real one. "I am in. What do we do first?"
"We build a continental water regulation system. We do it because the next wave of the process is going to be a flood, and the flood is going to be bad, and the water regulation system is going to save millions of lives. And we do it because it is the first step in debugging a god."
"We debug the world with a water regulation system."
"Yes. We debug the world with a water regulation system. And then we debug the world with a magical thermostat. And then we debug the world with a coalition. And then we debug the world with a rewrite. But we start with water."
The room was quiet. The theory was on the table. The plan was clear. The debugging was about to begin.
Pip pulsed, very softly, and the pulse felt like: "Finally. We are going to fix it."
Kenji sent back: "Yeah. We are going to fix it."
# WORLD.md (updated)
## Status
- Theory: Malachar is searching for unfinished source code
- Pattern: depth-first search, corruption as marker
- Target: unknown, possibly unfinished architecture
- Solution: find the target before Malachar does
- First step: continental water regulation system
## Lessons
- Bugs are searching for things. So are the people who debug them.
- The race is on. Be faster than the bug.
- "We debug a god with a water regulation system" is either brilliant or insane. Probably both.
- The original developer was the original bug. The system has been corrupted from the start.