The Friendship Code #1

Home > Other > The Friendship Code #1 > Page 8
The Friendship Code #1 Page 8

by Stacia Deutsch


  “Yeah, what’s going on?” Maya asked.

  Finally, I couldn’t hold it in anymore.

  “Okay, so you guys know how Erin should be in coding club with us, right?” I said, trying to contain my excitement.

  “Well, yeah, but she wants to do theater,” Sophia said, reminding me of the obvious.

  I looked down at my laptop and smiled mischievously.

  “Wait, you aren’t going to ruin that for her, are you, Lucy?” Maya sat up, concerned.

  “Of course not!” I said. “I have an idea for how she can act and code, if she wants to.” I turned my laptop toward them.

  “I sent Erin three e-mails this morning.” I showed them the first one:

  if (you_want_to_act) {

  talk_to_Anjali ( );

  }

  “Love it,” Maya said. “You used a conditional statement! But what does talking to Anjali have to do with anything?”

  I smiled. I was proud of what I’d done. I only hoped it worked.

  “Anjali isn’t in theater club,” I explained. “She’s in film club. She told me that they’re writing their own film, and they plan to submit it to student film festivals. Thing is, they need an actress who can sing.” I let that sink in.

  I could see a light in Sophia’s eyes. She knew where I was heading.

  “Here’s the best part: Film club meets at the same time as coding club on Mondays, but they’re using that time for production meetings. Anjali told me that the other night. They’ll film on other days.”

  I paused to let that sink in, too.

  “So . . . Erin could act for film club all week and code on Mondays!”

  “Wow . . . that actually could work!” Sophia said.

  Maya patted me on the back. “Good going, Lucy.”

  “Thanks! But there’s one other thing—Anjali said Erin would have to audition,” I added.

  “You said she was good at voices. Is she good at singing, too?” Maya asked.

  I was feeling pretty genius about it all. “I did a little research last night. Remember how Erin mentioned she was in the talent show at her old school?” I showed them the video of her performance. “Her mom uploaded it!” I grinned. “Sometimes it pays to have an embarrassing mom.”

  “Wow. Erin can dance, too,” Sophia said. “I bet she’ll get the role in the film, for sure.”

  “If she wants it, I think she’ll be amazing,” I said. “Now we just have to see if she followed the directions I sent.”

  Sophia was already looking at my second e-mail on the screen. “Oh, you’re so funny. You created a loop!”

  I’d written:

  while (songs_left_to_sing) {

  write_code ( );

  }

  “I wanted to let her know she could sing and code,” I said.

  Maya smiled at me. “This is brilliant.”

  “But she hasn’t responded yet,” I said. “I thought that by now she’d have e-mailed back.”

  Sophia leaned in, “What was your third e-mail?”

  I smiled. This was the most important one.

  string friend_name_1 = “Maya”;

  string friend_name_2 = “Sophia”;

  string friend_name_3 = “Lucy”;

  string friend_name_4 = “ ”;

  “Wait.” Sophia reread the e-mail on my computer. “Hang on, something isn’t right.”

  “What?” I read the e-mail a few times. “I did the string variable correctly, didn’t I? The variable is the friend and the types are our names.”

  “That all looks right,” Sophia said. “But, Lucy, you never pressed send!”

  “Oh no!” I was feeling so clever, and then I forgot to do the last, most important, thing.

  I hit send.

  Then we stared at my inbox.

  One minute passed. Then two. (Or at least it felt that way.) Finally, an e-mail came back.

  It read:

  string friend_name_3 = “Erin”;

  “Oh my god, it worked!” I exclaimed.

  “Awesome!” Sophia said, giving me a high five. Maya joined in, too.

  We’d convinced Erin to stay in coding club and gotten her a gig for acting!

  I texted her to tell her we were all hanging out at my place, and to come over. A few seconds later, I got a text back.

  on my way

  When Erin arrived, Alex answered the door and brought her upstairs.

  I was grateful to see him wearing shorts and a clean T-shirt.

  We all crowded around Erin. “I’m so happy you’re here!” I gushed, giving her a big hug. She nearly dropped the tray of homemade cookies she’d brought.

  “Middle-school girls are weird . . . ,” Alex muttered as he headed to the hall.

  “No. Wait.” I broke away from the others, and grabbed his arm. “Alex, stay.”

  “Oh right, you wanted my help. As long as no one starts hugging me,” Alex said. “And I want a cookie,” he added.

  “Deal. So I’ve been getting these weird notes at school,” I started telling him. I was willing to believe, at this point, that they weren’t from him. We told him about each note.

  “Wait a minute—you thought I was the one leaving you these notes all this time?” he said, genuinely surprised.

  “Well, yeah . . .”

  “And after wrongly accusing me, you want me to help you?”

  I could tell he wasn’t going to relent easily. “C’mon, Alex. We know what the coding stuff means now; we just want to figure out who wrote them.”

  Alex thought about it for a minute. I could tell he was intrigued. Finally, he suggested, “Why not use coding to catch the coder?”

  I looked at the others, a smile forming. It actually wasn’t a bad idea.

  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!

  Chapter Thirteen

  On Monday afternoon, it was finally time for our second coding club meeting. I couldn’t believe only a week had passed since our first one—so much had happened.

  On my way to Mrs. Clark’s classroom, my phone vibrated. It was Anjali.

  Erin ROCKED her audition today!!! THANK YOU

  I grinned. The plan had worked!

  I swung open the door to Mrs. Clark’s classroom. Sophia, Maya, and Erin were already there, waiting for me at the back. We’d planned to meet early so we could talk to Mrs. Clark about the game before everyone in the club arrived. I went over to them and put my backpack down. We walked up to Mrs. Clark, who was sitting at her desk.

  “Hi, Mrs. Clark,” we said.

  “Hi, girls,” she said, glancing up from her computer. “Early for coding club?”

  “Yup, and we have a surprise,” I told her. Maya, Erin, Sophia, and I looked at one another excitedly.

  “Oh really?” Mrs. Clark said, peering at us over her reading glasses. “What is it?”

  “Well, we made a coding game, and we wanted to show it to you. Actually, we’re hoping everyone in the club could play it,” I explained. I hoped Alex was right and that she’d let us show it to the group.

  “A coding game?” she said, taking her glasses off and setting them on her desk. “Wait a second—Lucy, didn’t you complain that the club was moving too slowly last week?”

  “Well . . . um,” I stammered. “We figured out some things on our own.” Maya, Erin, Sophia, and I exchanged conspiring looks.

  “Did you now?” Mrs. Clark said. I could tell she was intrigued. “So tell me, how did you make this game?”

  “We learned a few coding things this week,” I said. I didn’t want to give away what we were doing until we caught the mystery coder. “So we used what we knew. Alex helped us a bit, but not a lot,” I added.

  She nodded. “Okay, can I take a look?”

  We’d put the game on Alex’s website and had password-protected it, so I gave Mrs. Clark the link and password, and she opened it up on her computer.

  “I see . . . ,” she said, smiling. “It’s a question and answer game. Clever!”

 
; She agreed to have the club try it out. I crossed my fingers that this was going to work.

  By then, all the coding club kids had arrived.

  “Okay, everyone!” Mrs. Clark said, clapping her hands to quiet everyone down. “We have something special today—a game!”

  There was some cheering in the room. Mrs. Clark gave everyone the website and password and told them to give it a go. “And be honest when answering the questions, or the game won’t work,” she added.

  My heart was racing as kids started playing the game. We could tell that some people were getting knocked out by rocket fire pretty quickly.

  Bradley was the first to go. “Aw, man,” he moaned as his computer screen faded to black.

  Sammy Cooper got pretty far, but he got knocked out, too.

  When no one made it past seven questions, I figured the note-leaver wasn’t anyone from coding club, after all.

  “We need an else plan . . . ,” I whispered to Erin.

  As we started shuffling to our table at the back of the room, Mrs. Clark spoke up. “Can I try your game?” she said. “I see that you started with a conditional, used variables, and ended by looping a death-by-rocket animation. Good work.”

  It wasn’t going to help us find the note-leaving culprit, but I didn’t mind Mrs. Clark playing the game—I was proud for her to see how much we’d learned.

  Mrs. Clark started the game on her computer. We stayed at the front of the room to see how she’d do.

  She started by pressing Y. Yes, she’d been in the school playground on Monday.

  Yes, she recently used a large yellow envelope.

  Yes, she had a black scarf.

  Yes, she knew what input/output meant.

  Yes, she knew how to write a conditional.

  Yes, she knew about loops.

  Yes, she knew where Dress to Impress was located.

  Yes, she had been there recently.

  Yes, she had seen Maya’s half-finished dress.

  Yes, she understood string variables.

  I couldn’t believe what was happening. When Mrs. Clark finished the game, there was a looping popper GIF with exploding streamers that Alex and Erin had coded. The streamers kept falling until she pressed the escape key to end the game.

 

‹ Prev