When Pac-Man involves AI technology, what should this game actually do? Ethan didn't know. But when Evelyn dragged him into the garage of their new home—her new "base of operations"—and spread the design drawings across the worktable, she already seemed to have a plan.
"Ethan, levels, scores, models—those can all be done later. But these four intelligent ghosts need to be figured out first," she said firmly. "Without them, the entire game would have no soul."
Ethan agreed without hesitation. Seeing his nod, Evelyn smiled, "Then let's start with the ghosts, shall we? First question: in your vision, how much do these four ghosts have in common? Are there shared behaviors, a shared model?
Because once we know their common pattern, we can copy that part of the code directly."
Ethan thought he understood what she meant—but not completely.
Copying? Well, sure, that made sense. In his previous life, he'd heard plenty of jokes about programmers copy-pasting code. But what exactly did she mean by "common pattern"?
"Oh Evelyn, what exactly do you mean by that?" Ethan asked directly.
"Common patterns? I mean their behavior," Evelyn explained patiently. "Is there anything they all have in common?"
Seeing Ethan's puzzled look, she gave him an example:
"For instance, all four ghosts chase the player. That would be a common pattern. But in our case, that doesn't really apply—because you gave each ghost different behavior traits."
She pointed at the first ghost on the drawing.
"The red ghost's trait is direct pursuit. So its code would calculate, in real time, the shortest path between itself and the player—and constantly move along that path."
She moved to the next one. "The pink ghost's trait is ambush. So its code needs to track the player's current position, then project a few pixels ahead in the direction the player is facing, and use that as the target point. Each time the player changes direction, the pink ghost's target point will update too."
She tapped the blue ghost next. "The blue ghost's trait is cooperation. It works together with the red ghost to trap the player. Its code needs to take the player's position as the center point, connect one line to the red ghost and another to itself, and then calculate a symmetrical path to create a right-angled intersection. When that intersection happens, the player is boxed in—and that's the containment effect you wanted."
Finally, she pointed to the orange ghost. "This one's trait is sentry duty. It stays near its spawn point with a detection radius. When the player enters that radius, the orange ghost calculates the shortest path to chase them. If the player leaves the radius, it stops and returns to patrolling until the player reappears."
Evelyn put down the pen and looked at him. "Because their chasing styles are different, we can't just call it a 'common pattern.' Only if two ghosts behave in exactly the same way can we reuse that code."
Ethan nodded, finally catching on. "In other words," he said slowly, "if the behaviors are identical—then it's common code."
"Bingo!" Evelyn grinned and snapped her fingers.
"So…" she tilted her head, her eyes playful, "…what do you think are the common patterns?"
Now that she'd explained so clearly, Ethan found it much easier to describe what he had in mind.
Although he had only played Pac-Man in his previous life and never tried to make it, Ethan still found it fairly easy to identify the common patterns of the four ghosts — such as escaping and being caught.
First: Escape. This occurs when the player eats one of the glowing power pellets in the four corners of the map, giving the ghosts a temporary debuff.
When the player becomes invincible, the ghosts enter a state of fear and avoidance — because now, the player can kill them. They turn blue, slow down, and run away. That is one common pattern shared by all four ghosts.
Second: Being caught. This refers to the ghosts' "death state" after being eaten while the player is in their invincible state. In Pac-Man, ghosts can resurrect after death, but they must first return to the central lair to regenerate.
This process — the "return to base" behavior — is also a common pattern for all four ghosts.
To be honest, Ethan had never written such a detailed breakdown before.
Most of his earlier ideas had been more abstract. But under Evelyn's questioning, he recalled each common pattern one by one — and Evelyn quickly jotted everything down.
Meanwhile, she kept talking as she wrote:
"If we break it down, escape mode means all four ghosts detect when any one of the four power pellets disappears from the map — then they turn around and run away.
Being caught means the ghost overlaps with the player's coordinates during its escape state. This has to be distinguished from when a ghost captures the player, since both events rely on coordinate detection and can't be allowed to conflict.
So… maybe we add a time check? For example, for a certain amount of time after a power pellet disappears, any overlap between player and ghost will count as the ghost being eaten."
Watching his sister furiously scribbling notes, Ethan felt a mix of admiration and pressure.
When he first decided to make Pac-Man, he had never imagined that it would be this complicated.
"Write the judgment separately…?" he muttered.
"This is going to be a lot of work."
But at the same time, his curiosity was piqued.
"Evelyn," he called.
"Mm?" she replied without looking up.
"Can I ask you something?"
"Go on."
"I want to know… why did you choose time-based detection to decide whether a ghost is caught?" Ethan asked thoughtfully.
"In my idea, when the player eats a power pellet, the ghosts get a negative status effect — and they also change appearance. So why not just check for the appearance change? If the player collides with a ghost that's turned blue, it dies. Wouldn't that work?"
"Technically, yes," Evelyn nodded, understanding what he meant.
"But that approach creates a timing problem."
She set down her pen and explained carefully: "Suppose the player collides with a ghost right at the exact frame when its debuff ends. At that moment, one part of the code will check and see that the ghost has no debuff, while another part — running at the same time — will still register the collision as if the ghost were blue.
"So which is it? Did the player eat the ghost, or did the ghost kill the player? The machine can't decide."
She shook her head. "That kind of ambiguous, frame-perfect situation can cause bugs. If we use time as the primary anchor point, the code only needs to check a single variable — the countdown timer — and it becomes much more reliable."
"I see," Ethan said, finally understanding.
"And this way, we write less code, right?"
"Exactly." Evelyn nodded.
"After all, our memory is limited. If we can make it work in 4K, we shouldn't waste space and push it to 8K."
A little more — and that meant an increase of over thirty dollars in cost.
Good guy!Does this even count as a cost? Ethan was shocked.
But Evelyn's calm confidence reassured him. After the two of them finished discussing, they spent that entire night analyzing the AI behavior of the four ghosts.
The next day, Evelyn stayed home and began trying to write the code.
To be honest, if this had been any other game company attempting a project like Pac-Man — one that required writing such complex code — progress would have been very slow.
After all, the market penetration of personal computers was still extremely low.
Even if a commercial company wanted to switch from circuit-board-based arcades to CPU-driven arcades, they would first have to purchase personal computers, then recruit engineers with programming skills.
And during that process, they would still face a host of issues — from joystick-computer quirks like those of the Altair, to CPU compatibility headaches.
But for Ethan and Evelyn? None of those problems existed.
The personal computer Evelyn was using was an Apple I, hand-built by Steve Wozniak himself and gifted to Ethan.
Not only that — the MOS 6502 CPU was their own product.
When the very people who designed the CPU and the computer could be called directly, Ethan couldn't imagine anyone in the world being able to stop him from making Pac-Man a reality.
Especially when he picked up the phone, called Chuck Peddle, and asked about the MOS 6502's assembly language — and within an hour, Chuck faxed over all 151 opcodes and 56 instructions.
Even though Evelyn had never touched a MOS 6502 before, with the instruction set in hand, she could get up to speed quickly.
And when Ethan called Steve Wozniak to request a disk interface for the Apple I, Woz had assembled all the external components and delivered them in under three hours.
Evelyn no longer had to worry about losing data. Of course, those calls piqued some curiosity.
Chuck Peddle asked if Ethan had any new ideas. Ethan just smiled and said yes — and promised to send him a copy once it was finished.
Wozniak, however, was more persistent. He insisted on seeing Ethan's "inspiration."
Although sharing it technically violated trade-secret best practices, Ethan agreed.
After reading it, Wozniak nearly jumped out of his chair.
"Oh! Shit Oh! My! God! Is this your inspiration?
This design makes me want to play right now!
How about letting me join your game production?
I don't want money — I just want to make it!
You can put me in charge of anything — ghost pathfinding, basic panel design, map levels — whatever you need! Seriously! I'm really good at coding!"
This unexpected offer made Ethan ecstatic — and Evelyn was equally delighted to have someone share the workload.
And so, on the very first day of production, the Pac-Man development team grew from two people to three.
But that same day, Wozniak — noticed a problem almost immediately after jumping in.
"Ethan, Evelyn… did you miss something?"
He pointed at the design. "In your setup, the four ghosts all start from the small room in the center of the map — just like the player. But out of the four ghosts, only Red, Pink, and Blue chase the player. Orange is just a zone sentry.
So, at the start of the game, when the player leaves the center, the first three ghosts rush out to chase him… but Orange just sits there on standby.
Wouldn't that make it way too easy for the player to dodge him?"
"My suggestion is this — if possible, have it come out of the haunted house and move along the maze walls at fixed intervals.
For example, when the difficulty is low, let it patrol for thirty seconds, then rest for thirty seconds.
When the difficulty increases, we can change it to patrolling for twenty seconds, resting for ten seconds."
Steve Wozniak leaned over the blueprint and grinned.
"We can make it an aimless wanderer. But once the player enters its range — boom — it becomes aggressive and hunts them down. Wouldn't that make it feel more alive?"
This suggestion stunned Ethan on the spot. Although he wasn't sure if the little orange ghost in Pac-Man was designed this way in his previous life… did it even matter? Because Wozniak's idea sounded so much fun!
"Very good! It feels so oppressive!"
Ethan patted Steve Wozniak's shoulder and said, "I'll leave this part to you!"
After all, it was free labor — why wouldn't he make full use of it?
If a technical genius was willing to take on more work, there was no reason to be polite!
