Thing a Week 10: The Loop

Among an endless sea of plain cubicles, a junior developer hired straight out of College 3 sat up straight, pulled his headphones down, and peered over the grey divider to ask his mentor for some help.

“Hey Gus, can I borrow your eyes for a second?”

“Sure,” the older man said, getting up to join Dexter in his cubicle. “What’s up?”

“I haven’t worked much with the Hell loop so I might be misunderstanding how it works,” Dexter started, “but I think something weird might be going on in one of the sims. Hold on, it’s in one of these tabs — oh yes, this one here.”

“Ugh, not another mortality bug.” Gus groaned.

“Maybe not,” Dexter explained, “it doesn’t look like there’s a problem with death itself, just the loop after. Do you know much about how it works?”

“I basically wrote it for these sims,” Gus bragged. “It’s pretty simple, so there’s not a lot of surface area for bugs to be in. Open up the mortality service code and I’ll walk you through it.

“It’s all pretty simple. This code fires off whenever a hume dies, and it does a scan here over the last twenty-four hours of their life. If we see anything we can potentially improve one of our aversion models with, then we trigger a Hell loop. Otherwise, we just start a new sim.

“The loop basically rewinds their life twenty-four hours and the hume gets a ‘do-over’. For the first hundred thousand loops it’s a full rollback for the sim, so the hume goes into the loop with the same memories and state variables it had at the beginning. Or, in other words, we wipe the memory and revert back to how things were twenty-four hours prior. If it dies again in a loop, the loop just triggers again; if it does something different and survives this time, it breaks out of the loop, we record the new data, and then we let the sim keep running.”

“What happens after a hundred thousand loops?” Dexter asked, tabbing back to his original bug.

“It doesn’t happen often, but we let the memory persist.”

“So it knows it’s in a loop?”

“Right,” Gus explained. “Really, we want to train our models without a persisted memory because, well, that’s how real life works. But sometimes a hume knowing it’s in a loop sparks a kind of creativity we don’t see otherwise, which can produce some interesting training data for us.”

“Does it still keep its memory if it breaks out of the loop then?”

“Nope,” Gus said flatly. “Wiped. The whole sim is predicated on humes not knowing they’re in a simulation, so we need to make sure we strip the loop memory data any time they break out. Is that where the bug is?”

“I don’t think so; just curious about that. I think the bug is in pruning loops. Do we ever break humes out of the loop manually?”

“Yeah,” Gus said, peering up at the fluorescents as he tried to remember the exact number of loops a hume would automatically terminate at. “Somewhere around two hundred, three hundred thousand loops: if it hits that we just assume it’s going to repeat the same loop forever and we prune the loop to free up server resources and get a new sim going.”

“I think that’s where the bug is then. Take a look at this hume; it’s nearly forty million loops deep.”

“That might explain some of our resource spikes lately,” Gus chuckled. He leaned in towards the monitor to peer at some of the numbers closer, then asked, “Can I drive?”

Dexter nodded and stood, relinquishing his chair to the expert who sat down and immediately started tracing through code and tying it to variables he was seeing on the stuck hume. He worked quickly and silently for nearly a full minute before he raised an eyebrow and brought the new hire back in on his thoughts.

“The hume’s perceived time is way out of sync with the sim,” he pointed out. “Did you see that?”

“I hadn’t; how far off is it?”

Gus did a double-take when he saw the number.

“Almost three thousand years behind the sim. Almost,” he added, frantically clicking back to the code for some kind of clue as to how this could have happened, “almost back to the sim’s world generation. The sim’s in year 2887 and the hume’s way back in year 7 somehow. It’s definitely a bug; I don’t know how that could even be possible; we don’t even populate humes until around year 1000.”

“Can we watch a loop?”

“Yeah, we should be able to. Here’s a recent one.”

They watched the hume open his eyes and sit up in the grass, outside, and look around. Birds sang songs from a lush forest stretched behind him and soft gusts of wind brought the deep sounds of endless waves crashing over the ocean drifting in. In front of the Hume, a craggy cliff stood several hundred feet over the ocean looking out over a serene, blue horizon.

After a moment, the hume stood up and sighed, took a deep breath of salty air, then sprinted towards the cliff and leaped over the edge, closing his eyes as he felt swiftly to his death at the coastal rocks below.

Before the waves could wash away the blood, the loop ended.

“That’s it?”

“That’s it,” Gus said, clearly confused.

They watched the next one, and the next one after that, and they were both the same: the hume woke up and immediately tossed himself over the precipice.

“Is it broken?”

“Reasoning and logic faculties still seem to be functioning.”

“Maybe we should watch the first loop,” Dexter suggested, “before its time got out of sync?”

“Good idea,” the mentor agreed. He scrolled back to find the earliest loop recording and hit play.

The video started with the hume mid-sentence, arguing with another hume over something in an office setting. Gus checked the metadata and pointed out the second hume was his boss at work; the man had clocked in ten minutes late for the second time that month and was getting chewed out, but the hume they were interested in was arguing that the time clock just wasn’t punching right.

“Let’s skip to the end,” Gus suggested. “It’s supposed to be a twenty-four hour playback, so it’s gonna be pretty uneventful for a while.” He skipped to the end of the recording, with just ten minutes remaining, and checked the metadata.

The hume was driving back from his lunch break, where he’d scarfed down a burger and fries from the only fast food place nearby so he could buy enough time to make it out to the post office and back; today was the deadline to mail in tax forms and, like always, he’d procrastinated. The line at the post office had been particularly long, filled with likeminded humes who’d also waited until Tax Day — and he was racing to get back to work on time when he squeezed through an intersection as the light was turning red and crumpled his car and his body in a four-car accident. He bled out on the street nine minutes later as ambulance sirens screamed from just a few blocks away.

“Extremely common death,” Gus remarked. “We’ve got an entire team dedicated to building models around deaths caused by workplace stress. They actually qualify us for a nice grant by providing data to the government. We use a lot of their models for insurance pricing.”

“The government? What do they want with the data?”

“It helps them with workplace safety regulations. They can’t really regulate if they don’t know what’s happening — or what could be happening. That team builds stress factor models that show what kinds of stress are most likely to lead to death in the real world.”

Dexter nodded. “That makes sense. Should we watch the next loop to see what happens after this death?”

“Probably the same,” Gus explained. “We usually don’t see any changes for hundreds or thousands of loops for accidents, especially car accidents. Let’s check out the last minute anyway, though.”

He pulled up the next loop and it was the same as the first.

“Alright,” Dexter asked, “so how did he get from a car accident to throwing himself off cliffs?”

“That’s a good question,” Gus agreed. “We’re obviously not going to want to watch three thousand years worth of video, and a lot of it would be duplicates anyway… Any idea where to start? We saw the first few loops already, which are probably the same as the first — oh yes, a hundred thousand here — a hundred thousand loops; and we saw the last loops — which, yep, are still going with similar file sizes — so there’s gotta be thousands of those repeating. We should probably check out the first few loops where he has his memory and see if anything changes — unless you have a better idea?”

“Let’s see them,” Dexter said, wracking his brain for a strategy that might help.

They watched loop #100,001:

The hume was driving back from his lunch break at the post office and almost had a distracted car accident right at the beginning of the loop. Gus inspected its memory in real-time and watched terrified thoughts race through his brain as the memories of a hundred thousand deaths came rushing back to it and the fact that it’d been unknowingly stuck in a Groundhog Day situation for what amounted to hundreds of years swiftly settled in. He pulled over, gathered his thoughts, and drove back to work. There was no accident on the way back.

“No accident. It should have broken the loop there,” Dexter noted. “Right?”

“Right,” Gus agreed. “There’s still a few minutes left before the twenty-four hours are up, though. Technically, we don’t roll memories back until then.”

The hume parked his car and turned his rear-view mirror back at himself to stare in bewilderment at the insanity swirling around his head. Getting back to his job on time took a backseat to existential thoughts and trying to process what it was that was happening to him. A little glimmer of hope formed in the back of his mind that he must be important somehow; the only logical explanation was that he must not have fulfilled his purpose yet in life, and some higher being had saved him from certain death — a hundred thousand times.

God was the first thought that came to mind. He’d gone to church as a kid and paid attention, but never really held the same kind of connection everyone around him seemed to feel. He’d prayed but never heard back, listened but never saw a sign he couldn’t reinterpret as something else, and religiously read his bible but eventually fell out of his religious upbringing. His parents, on the other hand, might have some idea about what was happening to him; he resolved to give them a call after work. It’d been several months since they’d talked last; not on purpose, but because work had just been so demanding lately.

Work was the last thing on his mind, and he thought about just skipping out for the day altogether. A small voice of reason whispered from somewhere in his head that he didn’t know what was actually going on and that it was too early to burn any bridges just yet. He should probably call some kind of doctor or specialist after work too, just to check things out. With just thirty seconds left on the playback, the hume locked his car and headed back to his office job, where he tripped on the stairs, fell down and hit his head, and died again.

“Well, that’s different,” Gus said, preemptively pulling up the next loop to watch.

“So it didn’t break the loop after all.”

“Right. And it’s going to go again but with this extra memory now, also. Let’s watch.”

The hume drove back from his lunch break at the post office quickly and efficiently, driving safely yet still shaving a few seconds off his return. He sat in his car and thought about calling his parents, or a doctor, or a therapist, or his boss, but decided to go back to work again. If this — whatever this was — was actually happening, surely he wouldn’t be the only one it had ever happened to. He decided to sneak in some online research at work before making those calls that night, so he’d have at least a little background and context of what was possible when inevitably sounding like a lunatic describing his experience to others.

He climbed the stairs to his office carefully this time, but accidentally tripped and fell just like before and died again.

“No way,” Gus laughed as the playback ended abruptly. “What are the odds?”

“Apparently pretty good,” Dexter said. “Isn’t it common for repeat deaths? It seems like it’s just the car accident all over again, except with stairs now.”

“Not like this,” Gus explained. “For one, its memory is intact now. It should be able to predict what’s going to happen and avoid it. That’s why we do the extra loops with memory; it’s a last-ditch effort to save the sim and get what we can out of it since it’s pretty much cheating at that point. It usually only takes a loop or two to break out when it knows what’s coming.

“Falling like that was a hilarious accident the first time. The second time is just an absurd coincidence. Either something is — ”

“Wait,” Dexter interrupted, “I have an idea. We store the time in the loop metadata, right? Is that how you knew it was thousands of years off?”

Gus nodded.

“Can we search the loops and find the first one that’s out of sync?”

“Good idea, do you want to drive? I can show you around the metadata. It’s something you should probably learn sooner rather than later.”

The two developers switched seats again and Dexter took over at the keyboard while Gus explained how the metadata for each sim, loop, and hume worked. He wrote a query that filtered out all loops that were still in sync with the sim time, then sorted the results by how far out of sync they had gotten compared to the loop that came before them.

“This should give us the loop that caused the biggest time desync,” Dexter said, starting playback on the top result.

The hume sat up from lying down in the grass between a forest chirping with birds and a cliff overlooking the ocean, quickly got to his feet, and sprinted to his death over the edge.

“What’s the desync on that one?”

Dexter checked the results and read off, “twenty-three hours, fifty-nine minutes, forty seconds.”

“That’s it,” Gus exclaimed, reaching his hands in to take over the computer again. “That’s the bug. Well, more of an edge case, I guess. Still, unintended.”

“What is it?”

“It figured out the rules of the game. This hume is trying to time travel.”

Dexter raised an eyebrow. “Time travel?”

Gus flipped quickly through the code, hunting for something in the mortality service. He highlighted a block, deleted it, then started typing quickly while he explained: “We use the extra memory loops to give humes the advantage they need to get back to a regular sim, and then we clear their memory they’re successful. We code them to be smart, but they’re only as smart as what they’re given to reason with. This one has three thousand years worth of memories factoring into its decisions and has an understanding of the sim I haven’t seen with any other hume.”

“If it’s just killing itself over and over, are you sure it’s not, I don’t know, depressed? I’d be depressed if I was stuck in its situation.”

“Pretty sure,” Gus grinned. “It’d spend way less time depressed if it spent any amount of time sleeping instead of throwing itself off a cliff over and over, immediately waking to repeat the day.

“We saw this one realize he’s in a loop in the playback — which is not only common but actually the goal — and it tried to get out of it. For whatever reason, it didn’t break the loop; it kept dying and kept repeating its loop, which usually only happens in no-win scenarios.”

“And you said you prune those,” Dexter followed. “After how many?”

“And therein lies the edge-case. Well, maybe it is more of a bug after all. Here’s the code here: we prune when the loop size is two hundred thousand, but we only count loops over that initial twenty-four hour period. Somewhere between a hundred thousand and two hundred thousand loops, this hume died early. Over and over.

“The mortality code triggers a loop on every death, as it’s supposed to. It just died early in the loop, so it went back twenty-four hours from that point and basically underflowed into the past, instead of restarting the loop from the same time each time. And since it was technically still in the same loop, we never wiped its memory.

“It figured out dying would send itself twenty-four hours into the past,” Dexter realized, “so it started killing itself immediately to go further and further back. And now it’s trying to get back to… to the beginning?”

“I assume so,” Gus said, leaning back in his chair.

“But why?”

“Why not? We saw the memory banks showing heightened thoughts of purposefulness, faith, and so on. It clearly thinks there’s some higher power out there that chose it to do something, but it doesn’t know what and probably felt helpless in its loop. Praying is one way to try to open some communication there, but when that fails? I think our hume is trying to travel back in time to meet its maker in person, at the origin of creation.”

“I guess it kind of did,” Dexter smiled, “even if it doesn’t know it. Is this going to affect our team’s models?”

“It shouldn’t. We’re just looking for averages over the sim cloud. We discard any outliers in the data anyway, and this is definitely one of them. I’ll get that bug fixed for tomorrow’s updates; thanks for pointing it out. We should be good to terminate the sim and start a new one.”

“Awesome, thanks for the help,” Dexter said. Gus returned to his cubicle and the two developers put their headphones back on and got back to work.

Leave a Reply

Your email address will not be published. Required fields are marked *