Chapter Twelve

Problem was, our coding skills, even as a group, were pretty limited.

Alex started brainstorming ideas with us, but his girlfriend called, so he left soon after to talk to her on the phone. We hadn’t gotten very far.

“Okay, so it’s a good idea,” Sophia said, biting into a cookie. “But how can we use coding to catch the note-leaver?”

“I used coding to talk to Erin,” I said, considering the problem. “I’m sure we can come up with something.”

Erin put her hair in a bun and tucked loose strands behind her ears. “Maybe we could create a program using what we know—input/output, conditionals, loops, and variables.”

“We could try, but how would that help us find the note-leaver?” I said.

Erin thought about it. “Hmm . . . I don’t know.”

“This is going to sound ridiculous,” Maya said, “but so far, we haven’t actually programmed anything on a computer. I mean, Lucy e-mailed Erin coding stuff, but that’s different. How does actual coding even work? Don’t we need some kind of special program?”

“I was wondering about that, too!” Sophia said.

“Can I see?” Erin pointed at my laptop. I handed it over to her and we all huddled around.

She went online and typed in a link. A big square with a black outline showed up on my computer screen.

“What’s that?” Sophia asked.

“It’s a website my dad and I use to write code,” Erin answered. “We can type in the code here, and then copy and paste the link into a browser, and it’ll play whatever program we coded.”

Maya leaned in. “But it doesn’t look like anything—it’s just a box. How does it work?”

“It’s a simple text editor,” Erin said. “You can’t use regular word processors for coding because they have formatting options, like changing fonts and stuff, that would get in the way of the code.”

We all looked at her, confused. Erin started to type code, and the text and brackets appeared in a typewritten-looking font. “See? In a program like this, it’s easier to see how your code lines up. Nothing gets in the way, so you can tell it exactly what you want it to do.”

“So if we write code for a program here,” I reasoned, trying to make sense of what she was saying, “we can make it, like, come alive?”

Erin laughed. “I’m not sure ‘come alive’ is the right way to put it, but yeah, if we code a game here, we could play it online. Or have someone else play it. We could even password protect it.”

I thought about that for a second. “Okay, but even if we figure out how to code something, how are we going to get the coder to run it, if we don’t know who that is?”

“Hmm . . . ,” Erin said, her fingers grazing the keyboard. It was so quiet, I swore I could hear the others thinking.

Alex stuck his head in. “So how’s it going, chicas? Catch a coder yet?”

“Ugh, we don’t know what to do,” I told him, flopping back on my bed with a thud.

I think he could sense our frustration. “Maybe I can help. What coding stuff have you guys learned so far?”

“We know about input/output and conditionals,” I said.

“And variables,” Maya added.

“And loops,” Sophia chimed in.

Alex thought for a moment. “You could make a questions game,” he suggested. “Ask things that only the person who left the notes might know.”

That sounded good! “Whoever left the notes must have gone to the school playground recently,” I said, feeling a bubble of excitement building inside. “They must have been there before me to set up the envelope under the bench.”

“And whoever it was sent Lucy to the sports fields on Wednesday,” Sophia said. “They might have even known I’d be there.”

“And they knew what variables were missing from my dress,” Maya added.

“And all the notes were on my locker, so it has to be someone who has access to the middle school,” I said.

It felt like we were off to a good start.

“But even if we can code a game, how are we going to get people to play it? And who would we ask?” I wondered. “Alex, without you and Erin, we honestly don’t have any other suspects.”

Alex thought about that.

“Whoever is leaving the notes obviously knows a bit about coding. Where would there be kids who might know about variables, loops, and conditionals?”

“It can’t be coding club, since we haven’t learned any of that there yet,” I said, racking my brain for who else in school might already know about coding.

“Wait a minute,” Erin said, an idea forming. “Maybe there’s someone else in coding club like me—someone who already knows coding, but didn’t let it on at the first session.”

“That is possible,” Maya said, sitting up straighter. “And everyone saw how frustrated you were at coding club on Monday, Lucy, so someone from the club could be leaving you the notes.”

“Good thinking!” Alex said. “Start with the kids in the club. I promise you that if you write this game, Mrs. Clark will be so impressed, she’ll let everyone play it.” He winked. “Believe me. She loves it when students show off their skills.” He would know.

“But what if it’s not someone in the club—” I started.

“Don’t worry about that, Lu,” Alex said. “With an ‘if’ statement, you can always have an ‘else.’” He put it into code-speak. “If this game works, then you’ve solved the mystery; else, we think of something different to try.”

We all laughed. We had a plan!

Maya, Sophia, Erin, and I made a list of ten questions that only the mystery coder would answer yes to, and Alex showed us how to use the coding concepts we’d learned to write the code.

We started with conditionals—if something happens, then the computer does something. Alex suggested that we outline our program on paper first in a format called pseudocode—he said it was a detailed description of what a computer program has to do, but told in normal language instead of programming language.

Erin had an idea. “If you were at the school playground,” she suggested, “we could say ‘Press the letter Y.’ Then the key the user types could be stored as a variable. Right, Alex?”

“Exactly!” he said.

Alex helped us design an animation that would knock the player out of the program if they didn’t answer yes, since we’d know that wasn’t the person we were looking for. Maya drew five pictures of a rocket exploding, and Alex showed us how to use a loop to cycle through the pictures. We then used another loop to make our own GIF! This game was shaping up to be really cool.

When we finished the first question, the pseudocode looked like this:

question_1 = “Were you at the school playground on Tuesday?”;

show (question_1);

while (questions_left) {

if (key_pressed_is_y) {

show_next_question ( );

}

else {

show_the_rocket_loop ( );

end_the_program ( );

}

}

We came up with more questions, and then typed them up. I couldn’t believe that all those brackets and formatting that had seemed so strange to me were actually making sense! We figured out that if-then statements sometimes had “else” options where something “else” happened if the condition wasn’t true. The rocket was part of an “else.” So if the player pressed any key other than the letter Y, the rocket GIF we made appeared.

It took the five of us most of the day to code the game. By the time we finished, we were exhausted. I just hoped our plan was going to work the way we thought it would!