Monday, January 28, 2019

Extruding Code from Tests

As you may or may not know, I've been working on a game. I've also been experimenting with writing all my code in test files and extracting it.

I think I'm getting it down.

Recently, I built a lobby for my game. It's an in-memory lobby for letting people start a game on their device but it's the first step.

I started a little bit before the below video but this is where it really started getting good.


Sunday, January 27, 2019

Good Advice

Fred woke without opening his eyes. He'd become a very light sleeper in recent weeks, which enabled him to avoid letting on that he was awake.

Casually, he rolled over and slid his hand under his pillow, feeling for the artifact of his other recently-developed affectation.

A brief panic flashed through Fred's mind when he couldn't find it. When the lights flicked on, his blood ran cold.

"It only works if you sleep with your hand on it," said Kramer.

Fred opened his eyes and looked in the direction of the sound.

Kramer sat in the chair across the hotel room. The lower part of his left leg was balanced casually on his right knee. In Kramer's right hand was a gun Fred didn't recognize. Kramer's left hand held Fred's "pillow pistol".

Neither weapon was pointed in any particular direction. Instead, both of Kramer's hands hung a little slack, pointing the ends of the barrels at the floor and letting them drift lazily.

"It's not a bad idea, Fred," said Kramer, "but the execution is all wrong. A gun under your pillow only works if you can go from asleep to awake and drawn in a single fluid motion."

"I'll try to remember that," said Fred.

"If I'd been here to hurt you, your little 'roll and reach' maneuver would have forced my hand."

Kramer gestured in the general direction of Fred with his left hand, being careful to keep the piece aimed at nothing in the process.

"It's a good thing I'm not," he added.

"How do you keep getting past security?" asked Fred. "Those are federal agents in the next room."

Kramer smirked. "I have to admit," he said, "it's getting harder. Those guys are going to have some nasty headaches in a few minutes."

Fred shook his head. Without thinking he reached up to rub the sleep out of his eyes, then he froze, peeking at Kramer without moving anything but his eyes.

Kramer chuckled. "It's okay. I'm not startled by sudden movements or anything."

"What do you want?" asked Fred, as he tried to rub the blur of midnight from his eyes.

"Samantha knows something," said Kramer. "I think you know it, too. I want to know it, as well."

"I bet you do," said Fred. "I don't think you're going to hurt me to get it, though."

"Oh?"

"Well, you saved me from that guy?"

"Did I?"

Kramer tapped his right index finger against the trigger guard of his pistol. After a long while, he said, "Let me give you some advice." Then there was another long pause.

"Well?" asked Fred.

Kramer pursed his lips and nodded. "Stop making assumptions," he said.

"I don't get it."

"If you don't really know but you can only really imagine one answer, it's probably not the one."

"You're saying...you didn't save me?"

"I'm not saying that."

"You're saying you did save me?"

"I'm not saying that."

"You're saying I don't really know what you're after?"

"That's right."

"Why would you tell me that, if you're not trying to help?"

"That's the question. Assuming someone is helping because they did something helpful may seem reasonable but it is an assumption."

"So what do you want?"

"I think Mike is working for someone. Someone you probably wouldn't like very much, if you found out who it was. I want to know what Samantha knows - what I think you know, too - before Mike can find out and deliver it to his handler."

"So you are on my side?"

"Maybe I'm not and I want you to think I am. Maybe I am and I just want you to think differently."

"Your friends will be waking up, soon, and I'm sure they'll have plenty of questions for you when they do." Kramer stood and began to walk toward the door.

Ask Kramer grasped the handle of the door leading to the hallway, Fred asked, "What if I don't help at all? I mean, anyone...either way."

Kramer paused with one foot out the door. For a moment, he seemed frozen...like a robot whose processors were all simultaneously in deadlock. He looked down and smiled. Then gently placed Fred's Glock on the TV stand, just within his reach.

"Then get used to keeping your hand on the gun under your pillow every night for the rest of your life," he said.

Just before the door closed, obscuring Kramer from view, he added "However long that may be..."