Kids, Code, and Computer Science Learn How to Code on Your Smartphone
t f i G 8 1 0 2 ! e e h r e T H s I e d G ui
z! i h w Gee s, k n a Th
! z n a e b
October 2018
$6.00 $6.00 USD
How Does Your GPS App Find the Shortest Route?
beanz magazine October 2018 : Volume 6 Issue 2 Issue 38 (online) & 23 (print) ISSN: 2573-3966 (online) ISSN: 2573-3958 (print) beanz Magazine© is published bi-monthly, six times a year, online at http://beanzmag.com and in print. A print + online magazine subscription includes online access to all articles, with links to let you explore topics in more detail. SUBSCRIBE: visit http://beanzmag. com/subscribe or email us for checks/ invoices. We’re also available through EBSCO, Discount Magazine, WT Cox, Magazine PTP, and many other subscription services. ONLINE MAGAZINE ACCESS: send your email address to hello@beanzmag.com and we’ll set you up. Published by Owl Hill Media, LLC 378 Eastwood Rd, Woodmere, NY 11598 Email: hello@beanzmag.com Phone: (646) 553-3390
Happy Autumn! One part of publishing this magazine that I really enjoy is trying out the code projects while editing articles. There’s a fun article this month where you control a turtle with your cursor keys. Except my turtle kept running away! Only when I had written up an email to the writer to report my runaway turtle problem did I realize it was a GUI error, as in Gross User Incompetence (not Graphical User Interface, a computing term). I had forgotten to use the arrow keys! In this issue, there’s also a new bash scripting project (command line interfaces always scare me, the idea of typing commands instead of dragging and dropping), as well as a bunch of fashion tech projects you might want to investigate. Plus a peek at Scratch 3 coming soon, ideas about how to extend Minecraft, using books to create secret codes, and a TIC-80 game project. Don’t forget to check out our annual list of STEAM gift ideas for the upcoming holidays. There’s also a neat profile of Meriame Berboucha, who writes about her adventures in science. She’s a great role model for people who like computing, science, and writing. Last but not least, this issue also includes one of my favorite puzzles: it’s about a goat, a wolf, a cabbage, and a river crossing. See if you can figure out a solution. Hope you enjoy this issue and find lots of neat things to explore!
POSTMASTER: Send address changes to Owl Hill Media, LLC, 378 Eastwood Rd, Woodmere, NY 11598. Periodicals postage paid at Woodmere, NY and other mailing offices Copyright Owl Hill Media, LLC with all rights reserved except as noted. Flickr images are copyright their creators, as noted with each story both online and in print. Publisher/Editor/Webmaster: Tim Slavin Staff Writers: Amy S. Hansen, Simon Batt, Patricia Foster, Bonnie Roskes, Clarissa Littler, Jennifer Newell, Les Pounder, Paul Seal, Erin Winnick, Tim Slavin Contributors: David Dodge, Jay Silver, Jeremy Kubica, Colleen Graves, Daniel Fenjves, Ali Hagen, Emeline Swanson, Jean-Francois Nguyen, Madeleine Slavin, Tim McGuigan Back Office Magic: Wendy Garrison Copy Editors: Derek Lanuto Art Director: Kelley Lanuto Webmistress: Patricia Foster COVER IMAGE: TULLIO SABA, FLICKR
Tim Slavin Publisher beanz Magazine
beanz magazine (as Kids, Code, and Computer Science magazine, our earlier title) is a winner of Parents’ Choice, Tillywig,
Our Mission
and Academics’ Choice awards: https://beanzmag.com/awards
beanz magazine is a bi-monthly online and print magazine about learning to code, computer science, and how we use technology in our daily lives. The magazine includes hard-to-find information, for example, a list of 40+ programming languages for education, coding schools, summer tech camps, and more. While the magazine is written to help kids ages 8 and older learn about programming and computer science, many readers and subscribers are parents, teachers, and librarians who use the articles to learn alongside their young kids, students, or library patrons. The magazine strives to provide easy to understand how-to information, with a bit of quirky fun. Subscribers support the magazine. There is no advertising to distract readers. The magazine explores these topics: Basics of programming and where to learn more, Problem solving and collaboration, Mathematical foundations of computing and computer science, Computational thinking, Recognizing and selecting computer devices, Community, global, and ethical impacts of technology.
contents
advanced
beginner
intermediate
October 2018
2 22 4 6 8 10 11 12
Puzzles It’s Only Logical!
Notebook Cover Story Code on the Go! Languages Write This Down: Old Is Good! Robots Robot Extensions Secret Codes Book Ciphers Concepts Cover Story Dijkstra’s Algorithm Projects Let’s Talk About Event Handling
9
Best Practices Wondering What Your Browser Says About You?
Projects TIC-80 II: Starting a Platformer
13 14 16 17 18 20
Make It Fashion Meets Tech Coding Fun With Bash Scripts Scratch Scratch 3 Is Almost Here! Minecraft What’s Next? Profile Meet Meriame Berboucha Best Practices Coding Mistakes
23 The
beanz
STEAM Gift Guide 2018
Cover Story
29
Parents and Teachers The Fortnite Dilemma
Projects
2
r e : I m I r o 0 f t 8 a l TIC ting a P r a t S
BY CLARISSA LITTLER
command line and ESC again to get into game creation mode.
In the last issue, we had an introduction to TIC-80, the opensource fantasy computer perfect for making retro games. In this issue, we’ll be giving a more practical hands-on tutorial for starting a simple platformer game in TIC-80. As a refresher, you can get TIC80 from their website: https://tic. computer/create. Download TIC-80 and load it for the first time. You’ll see this command line:
To start writing a game, hit the ESC key and you’ll be taken into game creation mode:
You’re now looking at the code for the sample program. Hit ESC again to go back to the command line. If you type run and hit enter you’ll run the sample program. It’s a demo of a sprite blinking and you can move the sprite around with the arrow keys. Hit ESC to go back to the
map. You actually need to hit the little triangle in the upper righthand corner of the screen or hit the Shift key.
Create a Sprite
First, click on the sprite editor tab, which is the little tab in the top left that looks like a Pac-Man ghost. We’re going to make a sprite for our character and sprites for the environment. A not-immediatelyobvious thing about TIC-80 is that the way you draw backgrounds and the way you make sprites that move is by making them on this screen. The maps by default use the very first sprite slot, sprite #000, for their background. That’s why it’s completely black right now and the sample program starts its sprites over to the right. To draw the sprites, click on a square and start drawing in the rectangle on the left-hand side. Pick your colors with the palette below the drawing space. You’ll need to make: • Something to use as the ground. I actually used a “top of the ground” and “underground” sprite type. You could also make a different one specifically for platforms • Sprites for your player character. You could have just one or you could have a left facing one and a right facing one. You could also create a little walking loop! Mine only has two frames, to start. Create a Map
Once you’ve made your ground and player, it’s time to make the map. Another thing that’s unfortunately not obvious is how you select a sprite to paint on the
Go ahead and paint your terrain. Before we move on to sound effects, let’s look at the world map:
If you press tab on the map screen you’ll see the world map where all the screens for your game are stored. You can switch between them in this view by using your mouse. You can edit the other screens as well. There’s a lot more room for a game than in Scratch, because you can scroll between these screens smoothly rather than have them be backgrounds you flip between. Create a Sound Effect
Now, let’s make a little jumping sound effect in our sound editor. There’s a speaker icon and a
musical note icon next to each other at the upper left of the screen. Click on the speaker icon. You’ll see something like:
function TIC() cls(0) map(0,0) if btn(2) then x=x-1 end if btn(3) then x=x+1 end if mget(x//8,(y+6)//8) == 2 or (mget(x//8,(y+6)//8) == 1) then vy = 0 else vy = vy +1 end
Try selecting any waveform that isn’t just the straight line and clicking on a key on the piano or hitting the spacebar. You should hear that sound effect. If you hit tab you can edit the waveform, which is the “shape” of the sound. There’s a good video tutorial linked in the online version of this article that explains how the shape of the sounds relate to what you hear. Try editing the wave form, then hit space to test out how it sounds. You can also change other things about the sound including the volume and its relative pitch. I think this is the kind of thing that makes the most sense if you just play around with it and test out how the sounds work. When you’ve got something that sounds “jump” like, you’re ready to move onto the code. Let’s Code!
Let’s modify the code of the sample program just a little bit to add a notion of gravity, draw the map, give our sprite the ability to jump, and make sure our character doesn’t fall through the floor! Here’s what your code should look like and then we’ll cover what the different parts Toggle mean. Sprite t=0 Editor x=96 y=0 vy=0
if btn(0) and mget(x//8,(y+6)//8) == 2 then vy=-8 sfx(0,”C#4”,20) end y = y + vy spr(3+t%60//30,x,y,0,1) t=t+1 end For the purposes of this code, I assume your ground sprites are in slots 1 and 2 and your player character sprites are in slots 3 and 4. Also in TIC-80, unlike Scratch, the y-variable gets bigger as your character falls down the screen and shrinks as you jump up the screen. This Lua code first sets up the initial variables: the x and y position, the number of “ticks” that have passed to run the idle animation loop, and the y speed. Next, it erases the screen with cls(0) so we’re ready to draw the next frame. Then, we draw our background to the screen by calling map(0).
We then check if we’re touching the ground using the mget function. mget gives us the ID number of the sprite that’s in the square. This is the main way in TIC-80 to test if you’re touching the ground or an enemy or a projectile: you ask TIC-80 what sprite is in that spot. If we are touching the ground we set our vy to 0 since we shouldn’t fall any further. If we aren’t touching the ground, we increase the rate at which we’re falling by 1. Next, we check if the up arrow is pressed and if we’re standing on the ground, and we then jump by making vy negative (negative because up the screen means smaller y!) and playing a sound effect. Playing a sound effect just involves calling the sfx function with the ID of the waveform we want, the note we want written as a string of “note#octave”, and how many “ticks” of the clock it should play. Ticks in TIC-80 are 1/60th of a second each. Finally, we change the y position by the value of vy and draw the sprite to the screen. That’s our intro walkthrough. In upcoming issues we’ll learn about adding enemies, projectiles, and moving between rooms. b
Save Sound Effects SFX
Toggle Select Sprite Panel
TIC-80 Game Creation Mode Buttons
3
Notebook
4
BY PATRICIA FOSTER
Anika Cheerla and her team from MathAndCoding (http://www. mathandcoding.org/) are on a mission to teach everyone how to code, from kids to skeptical adults. Since 2014, they’ve given workshops in public libraries and community centers across the San Francisco Bay Area, including lessons in Java, Arduino fundamentals, and robotics. As a new initiative, Cheerla developed an iOS app to teach people how to program in Python. The app starts at square one, covering concepts such as variables and value assignment, then guiding users all the way through loops and functions. The app splits its material into small,
quick lessons that are easy to finish on the bus or while waiting for class to start. It also offers quizzes to review concepts and drill down into the details of the language.
Although lessons have an interactive element, writing and running Python code requires upgrading to a paid version of the app (currently $4.99 USD). Instead, most quizzes have a multiple
choice or a “fill in the blank” format.
There’s a lot to love about Coding Is Good. All of its lessons are illustrated by real-life examples crafted to be accessible to both kids and adults: calculating the profits of a lemonade stand, checking bank balances, computing grade scores. The quiz questions are also quite thorough. Even a seasoned programmer
n o e d o
TIM GOUW, UNSPLASH
C
might forget whether or not it’s possible to assign a value to the “int” keyword in Python! The best feature, however, is probably the instant feedback. After every question, the app gives the user a detailed explanation of why they chose correctly or incorrectly. This is a huge asset in helping students remember what they’ve learned, and one of the features that makes the app stand out. On the downside, lessons don’t include diagrams or pictures for visual learners. While explanations are concise and well thought-out, the lack of images somewhat limits the potential audience.
Coding Is Good offers the flexibility of being able to practice anywhere, anytime. Brief lessons make for perfect on-the-go learning. Consistent feedback helps the information stick and concepts become less intimidating. Overall, the easy-to-understand lessons, interactive recaps, and numerous quizzes make Coding Is Good a great app for people who are new to programming or those who want to touch up on the basics. b
t
! o G he
5
To download the app on iOS, check out: https://itunes.apple.com/us/app/ coding-is-good/id1354430214. You can learn more about Cheerla, MathAndCoding, and the team’s other initiatives here: http://www.mathandcoding.org/ our-story.html.
Languages
6
BY CLARISSA LITTLER
Write This Down: Programming languages are cool. There are so many and they are mostly different from one another. In past issues you’ve learned about languages that treat pictures as programs, or are designed to run on mobile devices, or do computing fast, and others. Here’s a programming language completely unlike everything else we’ve seen. It’s old but still influential today: the lambda calculus. It was invented by Alonzo Church, a mathematician, in the 1930s. You may not have heard of Church, but you’ve probably heard of one of the students that worked for him: Alan Turing! There’s a neat connection here between Turing’s work and Church’s lambda calculus. Turing came up with what we now call “Turing machines” as a way of figuring out what you could do with a machine that calculates.
That may be surprising, but even though computers didn’t yet exist, the idea of a machine that could do math had been around since the early 1800s. Ada Lovelace wrote the first algorithm for a hypothetical computer called the Analytical Engine. Church tried to answer the question of the limits of computers by inventing a symbolic system, the lambda calculus, for doing calculations. It’s a kind of “algebra” of computation, where each expression you write down in the lambda calculus executes to perform a complex calculation. So, it’s a language that can be executed to calculate a number. It’s a programming language that was meant to be calculated by hand instead of by a computer! Here’s how you write the numbers 0 through 3 in the lambda calculus: 0 =λ s. λ z. z 1 =λ s. λ z. sz 2 =λ s. λ z. s (s z)
3 =λ s.λ z. s (s (s z)) Here’s an if-else statement in the lambda calculus: if = λ b. λ t. λ. b t f And here’s how you write a while-loop, called the Y-combinator: Y = λ f. (λx. f (x x)) (λx. f (x x)) Now, you’re probably looking at those and thinking “How are these numbers or ifstatements or loops?” The key to the lambda calculus is that it’s super-minimalist. Everything is a function in the lambda calculus. An anonymous, unnamed, function. This means you’re going to have to think really differently about what things like numbers mean. If you’ve tried Python or JavaScript, you may have seen anonymous functions before. In Python, they look like lambda x: x * 3. In JavaScript they look like function(x) {return x * 3};. Notice the literal word lambda in the Python example? That’s a reference to the lambda calculus! JavaScript and Python have other programming constructs and data in their programming language. The lambda calculus consists of only its anonymous functions. Numbers? Anonymous functions. Booleans? Anonymous functions. While-loops? Anonymous functions! Everything is a function. We can break the syntax of the lambda calculus into three pieces: • defining functions • applying functions • using variables Defining functions looks like λ x. l where by the lambda symbol,
Old Is Good! λ, signifies “Hey, we’re starting to define a function”, by x we mean any letter, which is going to be the argument to the function, and the l means the body of the function. Applying a function just means you write two (or more) things next to each other. So up above we have a part of a function that reads as λ x. f (x x) The body of this function reads as “apply f to the result of applying x to x”. Finally, you use a variable just by writing the variable. In our previous example, x is a use of the variable x we’ve set aside in the declaration λ x. . . . We’ve described how you write down lambda calculus programs, but how do you run them? If the only things in the language are functions, then the only thing you could possibly do with these functions is call them! The fact that everything is a function in the lambda calculus can make it look more complicated than it is. Instead, let’s consider the following JavaScript expression: (function(x) {return 2*x;})(10) What happens when this code is run? It runs the body of the function with the argument x replaced by 10 everywhere. In this case, the function returns 20. Applying functions in the lambda calculus works exactly the same way. You just set an argument and substitute it into the body of the function. Curious to learn more? The online version of this article includes a weird edge case and other interesting things about lambda calculus. b
7
Robots
8
BY JENNIFER NEWELL
Robot Extensions
Color Blender With a Switch, Inside
*More information on breadboards can be found in the December 2015 issue of beanz.
In August we explored three low-cost motors commonly used in entry-level robotics projects. However, each of our three bots had to be disconnected from the power source to turn off. That’s ok for our first projects, but there’s a better way to turn the power on and off. Adding a switch or button to the circuit inside our robot does this. A switch can be pressed or flipped to either connect or disconnect the wires, which in turn either allows or blocks the flow of current (electricity). For example, instead of connecting the color-blending bot with alligator clips and disconnecting the clips to make the hobby motor stop spinning, we could give the motor a stand and add a switch that we flip to turn the motor on and off. The same goes for our tree house elevator. In our first iteration we had to either remove the batteries or disconnect the circuit in order to make the elevator stop. For our second iteration we attached the same stepper motor to a cardboard-box tower, and added a switch to turn the motor on and off. Now the elevator stops at the push of a button!
Color Blender Without a Switch Adding a switch to a circuit introduces some complexity. Most switches need to be soldered to the wires in the circuit. This requires a soldering iron, patience, and most likely adult supervision. Soldering is a great skill to start practicing, but if that’s not an option, it’s easy to find switches that fit into breadboards.* Consider what type of switch makes the most sense for a given project. Options include pushbutton switches, toggle switches, slide switches, rotary switches, and rocker switches. In addition to the style of switch, some switches are normally open (NO), while others are normally closed (NC). By adding a NO switch to a circuit, the load (in our case the motor) will be off until we push the button or flip the switch. However, if we would prefer the load to be on unless someone holds a button down, we would use a NC circuit instead. Be sure you know whether you have a NO or NC switch before soldering it into your circuit! If you have ever made a simple circuit, take it one step further by adding a switch. No switches or buttons at home? No soldering iron? No problem. Creative folks have shared ways to make simple switches with household materials (paperclips, brads, ...) online. Controlling the flow of electricity through any circuit gets you one step closer to building your own robot! b
Wondering What Your Browser Says About You?
Your web browser gives off a lot of data as you browse the internet. However, it can be difficult to find out exactly what data websites can get from your browser. Panopticlick is a free online test service that shows you how much data can be collected quietly and invisibly as you surf around online. It’s provided by the Electronic Frontier Foundation, an organization that advocates for privacy online. Like people, web browsers have fingerprints that can be used to identify you and track where you go online. Go to https:// pantopticlick.eff.org with your favorite web browser, click the Test Me button, and see how your browser performs. Better yet, test Google Chrome, Firefox, Opera, and other browsers. And don’t forget testing on your mobile devices. Mozilla, the creators of the Firefox web browser, also offers Firefox Focus, a phone and tablet app with a web browser that scores the best for privacy (test for yourself with the URL above). The Panopticlick test results also include lots of links to learn more about about web browser software and online tracking. It’s a useful tool to protect yourself. b
?
Color Blender With a Switch, Outside ROB SCHRECK, UNSPLASH
9
Best Practices
BY TIM SLAVIN
Book Ciphers Are you a bit of a bookworm? Do you have any friends who also enjoy reading? If you noticed that you both own the same books, you’ve already got the basics for making a book cipher! Book ciphers are special codes which are created by referencing the words and/or letters in it to make your own sentences. People reading your code will only see numbers, but you and your code recipient will know the truth! There are a few different ways to make a book cipher, but in order for it to work, you and your recipient must have the exact same book. Make sure that both books are the same edition, as different editions may have different page numbers and word placement. Word Ciphers
One of the simpler variants of the book cipher is a code that points to individual words within the book. Let’s say you want to send the word “cat”. You take the book you’re using for
REINIS IVANOVS, FLICKR
Benedict Arnold and John André
your cipher, and find an instance of the word “cat” in it. Let’s say you find the word “cat” on page 64, line 5, the 8th word on the line. To represent the word “cat” you write it as (64, 5, 8), which tells your recipient to go to that page, line, and word. Letter Ciphers
Another way to do a book cipher is to use the starting letter of words in the book to represent each letter in your secret message. To start, you and your recipient decide on a page to use as reference; perhaps you can write the page number at the top of your code so your reader doesn’t get lost. Then, you find a word that starts with the letter you want to use, and write down what number word it is on the page. For example, if you want the letter “E”, and the word “Elephant” is the 12th word on the page, you write the number 12. You may want to separate words with a comma to tell your recipient where to put spaces in their letters. If you want to make your code extra strong, you can use different
words that begin with the same letter in your code. For example, while “Elephant” is the 12th word, you may also find “Eagle” as the 26th word, and can use either to represent an E. The benefit of this is that it makes it harder to crack; if you simply use the same number for each letter every time, it becomes a simple substitution code (which we’ve covered before!) and is very easy to crack. Time for you to try it! Find out what the message is in this short passage, using the numbers provided: 1 9, 7 12 6 20 29
“Harold could not believe his eyes. The man in front of him, who Harold thought was the villain, was really his own father all along. He could not even imagine why he would join the evil side.” Book ciphers are a lot of fun, but they’ve played an important role in history as well! Book ciphers were used during the American Revolution to help encrypt messages. Two spies called John André and Benedict Arnold used a copy of William Blackstone’s Commentaries on the Laws of England to perform the word cipher. When you try a book cipher, you’re using a code that spies once really used! b
BLAUVELT, CHARLES F., 1824-1900, ARTIST - LIBRARY OF CONGRESS, WIKIMEDIA COMMONS
Secret Codes
BY SIMON BATT
Answer to Puzzle: Hi There
10
BY PATRICIA FOSTER
Cover Story
Ever wondered how your GPS calculates the shortest route to your destination? The complex algorithms of Google Maps, like most pathfinding applications, are based on the famous Dijkstra’s algorithm, invented in 1959 by Dutch scientist and programmer Edsger W. Dijkstra. Although powerful, the logic behind this clever algorithm is deceptively simple! In order to run Dijkstra’s algorithm, our problem needs to be converted into a format that the software program can understand. Specifically, we need to create a weighted graph. In math terms, a graph is a collection of “nodes” connected by “edges”. In a GPS, our edges are roads: paths that lead from one place to another. A node could be a destination (a house, a park, a mall) or it could be anywhere that two edges meet, such as traffic intersections. Using these simple rules, we can represent a city as hundreds of tiny dots (nodes) connected by a web of thin lines (edges). Each edge has a weight. In our example, this is the time required to travel from one end of the edge to the other, and it depends on many factors including the length of the road, the speed limit, the number of potholes, the presence of construction, etc. Sometimes the shortest path isn’t always the fastest! In real-life applications, like Google Maps, the information used to determine the weight of an edge is collected in advance from third party providers or customers’ mobile data. However, that only creates an estimate for a single stretch of road. If we want to know how long it’ll take to get across the city, we need to run Dijkstra!
Here’s an example of a simple graph with weights:
11
AARON PARECKI, FLICKR
Let’s say that we start at node A and go to node E. In a nutshell, Dijkstra’s algorithm explores all possible paths in a clever, nonrandom fashion, and records distances as it goes. Initially it doesn’t know how long it takes to get to any node, so we say that they’re all “infinitely” far; except our starting node, A, which has a distance of 0. Imagine that you have a fleet of drones stationed at A. You begin by sending groups out to nodes B, C, and D. Once arrived, the drones check if the total distance travelled (the sum of all the edge weights they’ve flown over) is less than our current estimate for that node. Since all nodes start at “infinity”, the first drone fleet to arrive always sets a new record, but this could be broken by subsequent groups of drones. The online version of this article describes how this algorithm works in more detail. Plus you can try to solve a problem using the algorithm to find the most efficient route. b
Concepts
Dijkstra’s Algorithm
ERIC FISCHER, FLICKR
Above: Detail of image of 3000 journeys recorded in geotags, routed along the density of the endpoints of those journeys using Dijkstra’s algorithm Below: Another visual depiction of Dijkstra’s algorithm
BY PATRICIA FOSTER
Projects
12
Let’s Talk About Event Handling
In all games, the player makes choices. These choices require an input mechanism. Whether you use a video game controller, a touch screen, or a keyboard, the game’s software needs to detect user input events and respond to them appropriately. In software, we call this event handling. Though user-generated events are fundamental to all games, the code associated with them can be a bit tricky. But fear not! We’re here to demystify the process, using a short Python program with a Turtle sprite that responds to key presses. To start, navigate to www.repl.it and select ‘Python with Turtle’ from the ‘Select your Language’ box. SETUP
Add the following code to the left-hand editor: from turtle import Turtle, Screen playground = Screen() thomas = Turtle() thomas.shape(‘turtle’) thomas.penup() This code creates all the basic pieces we need to build our program. We import our libraries, define our key objects, and adjust our sprite so that Thomas looks like a turtle. Some functions are accessed from libraries, like the “shape” and “penup” functions from our code above. Other functions we define ourselves. In this program, we’re going to create a “travel” function that describes how Thomas moves on the playground. Add the following code to the left-hand editor in repl.it: # Make Thomas move around the screen
def travel(): thomas.forward(1) playground.ontimer(travel, 10) The “def” keyword tells the program that you’re “defining” a function. In this case, our function is called “travel” and has no parameters. Every line included in the function must start with a tab and is executed every time the function is called. The first line uses the Turtle library’s “forward” function to make Thomas move forward one pixel. The second line is a bit tricky, because it involves our first event. User-generated events include button presses, key presses, mouse clicks, or even voice commands and motion detection. Some events like timers can happen without user input. The exact terminology varies from language to language, but the principle stays the same: some piece of code, somewhere, has to constantly “listen” for things like key presses and mouse clicks. The “playground” is our listener object. The “ontimer” function registers the event handler (the travel function, passed as the first parameter) to be executed whenever T milliseconds have elapsed. The value of T is specified with the second parameter: in this case, 10. This naturally creates a nice little loop. We start our program by calling the travel function. Thomas moves. The “ontimer” event is set with a countdown of 10 seconds. When time’s up, the event handler—travel()—is triggered and starts the loop all over again.
Result: Thomas continues to move forward in a single direction unless a key is pressed. Add the following code to your repl.it editor: playground.onkey(lambda: thomas. setheading(90), ‘Up’) playground.onkey(lambda: thomas. setheading(180), ‘Left’) playground.onkey(lambda: thomas. setheading(0), ‘Right’) playground.onkey(lambda: thomas. setheading(270), ‘Down’) Four separate event handlers are defined and registered with “onkey” function. The second parameter indicates which key triggers the event handler. In this example we specify the four arrow keys, but we could easily have used ‘w’, ‘a’, ‘d’, and ’s’. The code in the second half of these lines spins Thomas around to face a new direction: up (90 degrees), left (180 degrees), etc. We’re missing two lines of code. Add these at the bottom of your program: playground.listen() travel() The “listen” function makes the playground start detecting events. The first call to the “travel” function gets Thomas moving, and from there, the main loop takes over and the program runs smoothly. Remember to press the arrow keys —up, down, left, right—or else your turtle will run off the page! Check the online article for more details. But this code should work if you copy and paste it into the repl.it website. b
FUNCTIONS
Every function ends with two angled brackets: ( and ). For example: sort() or penup(). A function is essentially a series of predefined miniactions rolled into one big action. Imagine making a pizza. First, the chef rolls out the dough, then he adds sauce, then cheese, and puts it in the oven. When ordering a pizza, you assume the chef knows the steps. You don’t list them out when placing your order. The same idea applies to functions. When you call a function, you assume that it’ll accomplish its task as efficiently as possible— whether it’s sorting a list or drawing some pictures onscreen—no details needed. Sometimes, the user has an element of choice in a function call. For example, you can pick the size of your pizza and decide what kind of toppings it should have. In programming terms, this means passing variables (toppings, size) to the function (chef) who manipulates this information in predefined ways to create the output you expect (a large pepperoni pizza). These special variables are known as parameters, and they’re located between the opening and closing brackets of a function. Not all functions have parameters, but when they do, they have to be given in a specific format and in a specific order. When the chef asks for the size of your pizza, you can’t answer “onion”. You have to choose between small, medium, and large. b
Do you like tech? Do you like fashion? Did you know you can combine the two to create some stellar electronic styles? There are some amazing kits out there you can use to bring some technology and light into your closet. Let’s dive into some projects ranging from beginner to advanced. Perhaps you can ask for these this holiday season and dive into some Do-It-Yourself fun. Beginner: TechnoChic kits
From bowties to flowers, TechnoChic has you covered! Their kits come with all the materials you need to make either 10 light-up paper bow ties or 10 blinking flowers. You will get the chance to learn about LEDs and circuits and make some awesome fashion accessories. They are fun and quick 5 to 10 minute projects and a great starting place to dive in. Keep an eye out because they might also have an amazing unicorn headband set coming soon as well! Bowties ($24.99 set of 10), Flowers ($24.99 set of 10) ThinkGeek Space Skirts
Show off the beauty of space with these light up skirts from ThinkGeek. The skirts aren’t actually sold as kits, but there is definitely some assembly required! The stars skirt comes with over 250 lights, while the galaxy one comes with a more subtle 60 lights. The lights come on a large strand that you get to string up and attach to the underside of the skirt. It is definitely a fun beginner project. Twinkling Stars Skirt $29.99-$39.99, Twinkling Milky Way Skirt $39.99-$59.99 Intermediate: Adafruit Patch kit
Up your fashion tech skills by bringing some conductive thread into the mix. This is no normal sewing thread. This can actually carry an electric charge! That way you can carry electricity from your battery to different areas throughout the animal badge that will bring some light to your style. Adafruit offers both fox and bear badge kits, so pick your favorite animal and get sewing. Fox Badge Kit $14.95, Bear Badge Kit $14.95 Advanced
Want to bring your own unique wearable tech idea to life? Then you might want to go for StitchKit, a project kit that is built to help you make technology equipped clothing. While it doesn’t have as much guidance as the other projects, the sky is the limit on what you can make. It comes with LED lights, sensors, microcontrollers for programming your fashion, and more. The kit was created alongside MakeFashion, an awesome group that brings circuits, engineering, and lights onto the fashion runway at a yearly competition in Canada. StitchKit on IndieGogo b IMAGE: THINKGEEK.COM, TWINKLING MILKY WAY SKIRT
PSSSSSSSSST! These make great gifts! And for more gift ideas, check out the Gift Guide in this issue!
13
Make It
Fashion Meets Tech
BY ERIN WINICK
BY CLARISSA LITTLER
Fun With B
Coding
14
So far in this series we’ve spent some time talking about how to use the command line to do things like how to chain commands together and do basic file system tasks. Now we’re ready to talk about writing programs for the command line! If you have a Mac, look for the Terminal application. If you have Windows, look for the Powershell application and then read the online version of this article for a link to set up bash on Windows. First, let’s throw out a couple of definitions that are relevant. The program that you’re interacting with when you’re on the command line is a shell. The shell is what interprets
the commands you type and turns them into commands the operating system understands. There are quite a few shells that exist. The one that is used by default on Linux and OSX is bash. So bash stands for “Bourne Again SHell”. It’s named this because it’s a revamp of an even older shell program called the “Bourne Shell” that dates back to the 1970s. By comparison, bash is a spry 29 years old. A cool thing about shells like bash is that they have their own programming language built in. For example, here’s a tiny little script to play entire directories of music from the Raspberry Pi I have hooked up to some speakers:
#!/bin/bash dirName=$1 for song in “$dirName”/*.mp3 do omxplayer “$song” done This is small and simple, but all the elements of bash scripting are here: variables, loops, command line arguments, and calling other programs. You might be able to sound out this example. You’re creating a variable that stores the directory name. Then for every song, which is a file in the directory that ends in .mp3, run the program omxplayer—which is the main music and video program for the Raspberry Pi—on that song to play it.
GABRIEL BEAUDRY, UNSPLASH
ash Scripts
Now, let’s cover those topics by going through a few examples you can try out for yourself. The very first thing we’ll cover is reading in command line arguments. By “command line arguments” I mean something like the file and directory names in mv fatdog.mp3 dogthemedsongs/. The command is mv and fatdog. mp3 and dogthemedsongs/. are both arguments. If you’re writing a bash script you can read the command line arguments as $1, $2, $3, etc. for the first, second, third, … argument. To test this, let’s do a bash script version of “Hello World”. We’ll use the nano editor and type a few commands:
nano hello.sh In the nano editor, type this text: #!/bin/bash echo “Hello” $1 Next, press the Control key and type X to exit nano. Type Y and press enter to save the hello.sh file. Now we need to make the file executable by the bash command line software, to tell the operating system “yes, I want to run this as a program”: chmod +x hello.sh And, finally, let’s feed our little program a word: ./hello.sh world Your command line software should output “Hello world” If you try this, what happens?
./hello.sh fred In the hello.sh file, $1 is the value we pass into the script. The value is added to “Hello” with a space between that word and the $1. Now, what the heck is this #!/bin/ bash business that’s at the top of the script? That makes sure that your operating system knows to treat this program as a bash script and feed the text of the code into the bash program to run it. Below that, we use the echo command which prints whatever string you give it. In our hello world program, we give it “Hello” and the first command line argument. Check out the online version of this article for more! See link, back cover. b
15
Scratch
16
3 h c t a r Sc t s o m l A Is ! e r He
BY CLARISSA LITTLER
go to atch r c S fo on it.edu For in scratch.m :// https
B
JASON LEUNG, UNSPLASH
A
If you’ve used Scratch at all recently, you’ve probably noticed the call to try out Scratch version 3, which is currently in beta until the start of 2019. Beta means the code is not completely finished but it’s good enough to try out. Scratch 3 is currently available at: https://beta.scratch. mit.edu/. You may have two thoughts in succession after you start the Scratch 3 beta: 1. “So they flipped the stage and the code parts of the screen. Huh.” 2. “Wait that loaded super fast!” So, yes, the flipping of the screen is the most immediately obvious thing you’ll notice in comparison to Scratch 2. I haven’t read an explanation of why they made this choice. My theory? It’s to use Scratch 3 on tablet computers for primarily right-handed people. Other than being slightly more cramped, it’s almost identical! This is the same reason Scratch 3 loads so quickly: Scratch 3 is an ordinary web page. The old current version of Scratch is an Adobe Flash program, which is why it ran slowly, crashed often, and couldn’t be used on a tablet. A Some more things have changed, at least as of the beta. One is managing sprites. Gone is the expandable little i button you needed to click on to get at things like name, direction, etc. Instead the information is just right there, always visible, just beneath the stage. You can change the name, the direction the sprite is facing, its current position, its visibility, or even the size. I love that last addition. B To change the sprite rotation style, a pop-out menu now appears when you click inside the Direction bubble. C The menu for adding new sprites has also changed. It’s a pop up that expands when you hover over the icons in the lower right-hand corner. D The interface to draw sprites or costumes seems mostly the same, with a little touch up that makes it more readable and a little more intuitive. So go ahead and try out the beta at beta.scratch.mit.edu. You can’t save your work yet, but try it out. If you run into bugs or if you’re missing something they changed just report it by clicking on the big “give feedback” button. And did I mention it’s faster? b
C
D
? t x e N s ’ t a Wh
the k out , chec e r r e o v For m ck co he ba t n o link issue. of this
If you want more to explore in Minecraft, there’s no need to wait for the developers’ updates. Try a mod instead, which is a user-created ‘bolt-on’ to your game that enhances it. Here are a few great mods:
Biomes O’Plenty
In Minecraft some areas are swampy, while others are more mountainous. These are different ‘biomes’, and Minecraft comes with a collection of them. Biomes O’Plenty adds even more biomes to the world for you to explore. Over 50 new biomes are added, including glaciers, volcanic islands, and bamboo forests. This is a great way to add a little more spice to your world without adding any complicated mechanics.
Tropical Islands Biome
Galacticraft
Galacticraft brings space adventures to your Minecraft game by giving you the ability to build your very own spaceship. This is quite a complicated mod, as you’ll need to learn about making an Lavender Fields Biome oxygen-supplied base on the moon, but is one of the absolute best mods for space-faring adventurers. CandyCraft
For something a little more fun, try CandyCraft. This introduces its own ‘candy dimension’ which is full of sweet treats. It also adds some new sugary items you can make, such as a jelly trampoline, a honey lamp, and glass made from caramel. Don’t be fooled by its cute exterior, however; the candy dimension has its fair share of aggressive beetles, bees, and jellies for you to fight! Twilight Forest
Build the special Twilight Forest portal, then throw a diamond within it to open it up. Inside, you’ll find a world dominated by trees and foliage, with plenty of abandoned castles and structures to explore. With hydras and giant snakes lurking, you should keep your sword close by!
CandyCraft
The Betweenlands
If you’re looking for a challenge, try the Betweenlands, where even the world itself is against you! The atmosphere is toxic to outsiders, and any food taken into it will rot instantly. Torches and regular tools don’t work. To survive, you’ll need to learn the basics of the Betweenlands and use the resources you find in it to your advantage. You’ll find a lot of ruins to explore, new gems to find, and over 300 new kinds of blocks in order to create your own features. You may even catch an aurora in the sky during your travels! b
For info on Minecraft go to https://minecraft.net
Minecraft
17
BY SIMON BATT
Profile
18
BY ERIN WINICK
Meet Meriame Berboucha Project: The Plant Protector Berboucha Is Making Science Communication a Priority.
19
ALL IMAGES FROM MERIAMEBERBOUCHA.WEEBLY.COM
A career in Science Communication can start at any age. For some it starts after years of experience in the field. For Meriame Berboucha, it started while she was an undergraduate in college. Berboucha is currently a masters student at Imperial College in London, but started her science communication blog as an undergrad studying physics. She was inspired to start it after she was a part of an Institute of Physics (IOP) science communication competition. “Since then, I’ve wanted to share what it’s like to be a woman in physics and share snippets of my life as a physicist in order to inspire other women to get into the field. Physics is for both guys and girls,” Berboucha said. Berboucha has moved beyond her blog. She is now a contributor to Forbes. Writing five articles a month, thousands see her coverage of science and technology. Although the transition was not easy, she has enjoyed the challenge. “When I started writing for Forbes I had to learn how to write like a journalist, which is completely different than writing a personal blog,” Berboucha said.
“I had to concentrate on the facts rather than opinions and feelings, so it was cool to write about science for the sake of science. It was a nice change. I loved reading other articles so that I could learn about the best ways of writing science articles.” Science Communication is more than writing though, and Berboucha has embraced it in all its forms. She’s a radio producer for the Science Mixtape show (which airs every Saturday morning from 10–11 am on Soho Radio). Science Mixtape is all about interviewing different scientists every week to learn more about their work, the scientist as a person, and even their musical tastes. “I think it’s a great way to get an insight into a particular field of science. I find it fascinating to meet a different kind of scientist or mathematician every week and to learn about their cool bits of science.” Where did all of this scientific curiosity originate from? Well, Berboucha grew up in an environment that encouraged problem solving. Her father was a handyman who let her help take apart electrical appliances. Her mother had a physics background and is a physics technician at a
school, giving her a female role model in her field. However, when she was in school, she did start to run into a bit of social resistance. “I only noticed that there were stereotypes when I got into school and my friends would say things like ‘why are you taking physics, you’re clever you should do something like medicine’. But I stuck to what I wanted to do. I’m so glad I didn’t let comments like those change my mind about doing a physics degree. And now, I’m graduating.” As she continues on her scientific journey, she is excited to keep sharing it through Instagram, Twitter, writing and more. She has been inspired by the women in science and their experiences, and hopes to inspire others. “I think science communication is vital in getting the younger generation interested in science,” Berboucha said. “I remember at school when I was younger I used to think that physicists were guys with glasses who just solved equations all day. But now I’m training to be a physicist and I’ll be working with the HUGE x-ray free electron laser at SLAC for my masters project next year. It’s super exciting and I cannot wait.” b
Best Practices
20
s e k a t s i M g n i d o C
BY PATRICIA FOSTER
Problem #2: Exception Handling
Problem #1: Naming Conventions
Appearances can be deceiving. Just because a block of code looks good doesn’t mean it’s error free. It could be inefficient, or confusing to read, or it could leave the door wide open for malicious hacking attacks. A good programmer has to be vigilant against coding mistakes! Since the best way to learn is by example, we’ll start by diving into the nitty-gritty of a small 50-line Python script that acts as a simple “proof-reader”. The full script, and instructions on how to set up your Python environment, are in the online version of this article. The program first downloads a list of English-language words from the Internet and stores them in a list, creating a simple dictionary. Next, it prompts the user to enter the name of a text file. The program then reads though this file and puts the new words in a different list. Finally, the program works through the user’s words one by one to see if they’re in the dictionary. If not, it highlights the offending mistakes in red and displays the text back to the user. Take a peek at the full code online and see if you can spot where it goes wrong, or where potential problems might crop up. Don’t be intimidated if there are lines you don’t instantly understand! If a function is unfamiliar, pop it into a Google search engine and look for an explanation. You can also try removing lines to see how their absence changes the program.
Variable names should be descriptive. If your data structure is a list of words, then “words” is a decent name choice, although “words_list” might be even better since it tells us about the structure and the content of the variable. This is extra important in Python, which isn’t a typed language with data and variables clearly identified as specific types. However, even with that slight words_list improvement, we still get code like this:
for i in range(len(words_list3)): if words_list3[i] not in words_list: words_list2[i] = colored(words_ list2[i], “red”) Convoluted enough to confuse experienced programmers! When you have many similar variables, it’s a good idea to make their names extremely distinct, even if means using long awkward names. Consider: for i in range(len(sanitized_user_ words)): if sanitized_user_words[i] not in dictionary_words: original_user_words[i] = colored(original_user_words[i], “red”) Much more intuitive! Even though list interaction and indexing is tricky to read, we can tell the program is checking our sanitized words against the dictionary words and, if there’s a mistake, it updates the user’s original words to a red-colored version of themselves.
Whenever you open a file or connect to a website there’s always a chance something will go wrong. The file could be corrupted, or your internet connection could unexpectedly break. In these scenarios the program crashes without explanation, leaving the user annoyed and confused. In programming, risky operations should always be enclosed in try and except clauses. The “try” block contains the risky code, and if an exception (error) occurs during runtime, the program switches over to the code in the “except” block. If everything goes hunky-dory, the “except” block is ignored. Typically, the code in the “except block” is used to clean up the program—close files, databases, and network connections—and print a userfriendly message that explains the error or the crash. More advanced programs might attempt to diagnose and fix the error. The modified code looks like this: try: dict_file = urllib2.urlopen(dict_ filepath).read() except: print(“An error occurred while trying to import dictionary words.”) sys.exit(0) Writing good code is an art as well as a science. If all these “best practices” seem overwhelming, just remember: if your code works, then you’ve already done the hard part! The rest is just polish. b
21
, takes g mis er in d o c c k ov e bac about h e t r n o o For m e link out th . e check in z maga of this
OOP S! . ad . . My b CHARLES DELUVIO, UNSPLASH
Puzzles
22
It’s Only Logical! BY TIM SLAVIN
Logic puzzles help develop reasoning skills useful for programming, computer science, and anything you might do. They also have another advantage: they’re free. Many logic puzzles also date back thousands of years. Here is a classic river crossing puzzle.
The Puzzle
You stand on the bank of a river with a wolf, a goat, and cabbage. You can carry only one across the river at a time. The wolf will eat the goat if left alone. And the goat will eat your cabbage if left alone. How do you get the wolf, goat, and cabbage across the river? The Solution
This ancient puzzle appears in many cultures and dates from at least a thousand years ago. Most people assume you will cross the river with one item — the wolf or goat or cabbage — then return empty handed to get the second then third item. If you do this, however, at some point the goat will eat the cabbage or the wolf will eat the goat. It’s also important to note the wolf will not eat the cabbage. Therefore, the goat must be carried across first. Don’t believe me? Pull out a piece of paper and write down what happens if you take across the wolf, goat, and cabbage in different orders. The solution is to return with one item, in this order: 1. Cross the river with the goat. 2. Return empty handed to the wolf and cabbage. 3. Cross the river with the cabbage. 4. Bring the goat back with you to get the wolf. Leave the goat on shore. 5. Cross the river with the wolf and leave it with the cabbage. 6. Return empty handed to the goat. 7. Cross the river again with the goat. This version of the puzzle is from Alcuin who published a small book of puzzles around 800 AD. Other variations include a fox, a goose, and a bag of beans, as well as other combinations. Check out the link on the back cover of this issue for links to other sites with logic puzzles you can try to solve. If you try to find more of these puzzles online, they can be hard to find. They can called logic puzzles, deductive reasoning puzzles, brain busters, and several other terms. b PHOTOS, TOP: TRISTAN SCHMURR, FLICKR; CENTER: ANDRIL ZYMOHLIAD, FLICKR; BOTTOM: ANGELL WILLIAMS, FLICKER
beanz STEAM Gift Guide 2018
https:// beanz.com// steam-tools This resource lists all kinds of STEAM tools for kids,organized by grade level.
EMILIANO FELICISSIMO, FLICKR
23
24
STEAM Books
The Big Book of Maker Space Projects
Lauren Ipsum
Hands-on, lowcost projects for all ages. Projects are classroom tested. They include wishlists on their book site to make it easy to find what you need. Recyclable hacks, e-textiles, musical instruments, paper and sewing circuits, much more. https://colleengraves. org/bigmakerbook/
So You Want to Be a Coder? Lift-the-Flap Computers and Coding Over 100 flaps to learn how computers and programming works. Great for all ages (because most people don’t know much about computers). https://usborne.com/browse-books/ catalogue/product/1/9570/lift-theflap-computers-and-coding/
What programmers need to know and what do they do all day. Link is to a review we did with book links and more. https:// www.kidscodecs. com/want-to-be-acoder/
No Starch Press re-issued Lauren Ipsum, which explains CS concepts in a fun and often wacky way similar to Alice in Wonderland. Re-read the text and realize you’ve learned a key concept in CS and computing! https://nostarch.com/laurenipsum
Python Tricks: The Book This book provides lots of code snippets and insights into the Python language in a constructive DIY way. It’s not a beginner’s book. But it does help Python coders dive deep into the language with easy to understand and recreate projects. https://www.amazon.com/PythonTricks-Buffet-Awesome-Features/ dp/1775093301
Scratch Coding Cards While not technically a book, this set of 75 cards has a number of projects, from beginner to advanced, that teach all parts of Scratch. Ages 8+ https://nostarch.com/scratchcards
Robots
Sphero Bolt The newest amazing robot ball from Sphero. It includes a digital display you can easily code, plus it works with other Sphero Bolts. Their robots are easy to use, and offer a good path for kids who want to evolve from drag and drop programming to actual coding. You’ll need a phone or tablet to connect to your Sphero and direct it. http://sphero.com
Dash and Dot These cute, round robots from the Wonder Workshop are for elementary school age kids. The Dash and Dot robots can be programmed with Blockly, a fairly easy language. With Blockly you create a step. A combination of steps determines how the robot will move, when it will move, and what it will do. https://www.makewonder.com/dot_creativity_kit/
LEGO Mindstorms Take the LEGO concept, add icon-based programming, wheels, legs, and other mobile pieces, and you have LEGO Mindstorms. You can build simple or more complicated robots to perform tasks. They respond to touch and are controlled by a remote control. Mindstorms also includes an active online community with lots of ideas to try. http://mindstorms.lego.com
Cubetto This robot requires no computer screen, only play. Program Cubetto with touch, pressing down block shapes in order to tell the robot what to do. You don’t need to know a language to make the robot move. Geared towards young kids.
Code-a-pillar This Fisher-Price learning toy is in the shape of a caterpillar. Kids experiment as they develop problem solving, planning, and critical thinking skills. Change its segments to make the caterpillar go different places. http://bit.ly/2cAbAjf
Ozobot Two small robots, Evo and Bit, provide a deceptive amount of learning opportunities, creativity, and fun. http://ozobot.com/
Sphero Bolt
Apps
Electronics Kits
Bitsbox
Today’s electronic kits often don’t require soldering and other semirisky skills. Kids and adults can snap together kits, then tinker with hardware and software. Kits range in complexity from snap together to basic boards with lots of online tutorials. They make fun holiday gifts for older kids.
Kids learn to code by making games on the Bitsbox.com website, and then play them on their phone or tablet. The games are quite clever with fun, bright graphics. And Bitsbox it’s easy for kids to adapt the code once they figure out the game, while learning and becoming comfortable with code. A new box of games arrives each month. Ages 5+. http://bitsbox.com
Codea If you are selfsufficient, don’t mind looking up help, and like to take things apart, Codea is an iPad app to create games. Adapt existing code or create from scratch. The app has lots of game functionality with few limits on what you can create. Ages 10+. https://codea.io/
Hopscotch This iPhone and iPad app uses blocks you drag and drop to create effects. It has a strong community of kids who often come up with creative ways to have fun. Ages 5+ http://gethopscotch.com
Tynker Many US kids are familiar with Tynker from their classrooms. Tynker is a block language, meaning you drag and drop blocks and configure them. It’s easy and fun to move blocks around, find sprite images, and make the blocks do things. Ages 5+ https://www.tynker.com/
Move the Turtle
Piper Follow real engineering blueprints to build your own computer, and then use Pipercraft, a Minecraft mod, to configure it. You also can build gadgets with electronic boards. Steve Wozniak, co-founder of Apple, apparently loves Piper. Includes wood case. https://playpiper.com/
Kano This is a very simple snap together computer kit. The brains are powered by a Raspberry Pi and Kano includes an excellent operating system designed for kids. Also includes an online community to share ideas. https://kano.me
Jewelbots Create friendship bracelets with functionality kids can code. http://jewelbots.com/
Tech Will Save Us
Little kids can move a “turtle” around the screen by setting direction and the number of steps in order to create artwork and solve problems. Teaches basic coding ideas and prepares kids for block languages like Scratch, Hopscotch, and Tynker. http://movetheturtle.com
Coding Is Good, Swiftie, Touch Lua, Python 3.4 Learn how to code with Swift (Swiftie), Lua (Touch Lua), and Python (Python for iOS and Coding Is Good). SoloLearn has a number of apps and languages. Find them in the App Store and Google Play. Another option: find Python projects in books or online with the Repl.it website.
Run Marco! A coding adventure game in English and 26 other languages. Kids use conditional logic and critical thinking skills to help Marco get through his adventures. https://allcancode.com/runmarco
The Foos This iPhone and iPad app helps kids ages 5-10+ work through levels where they can play and learn basic programming and computer science skills. https://thefoos.com/
Move the Turtle
Tech Will Save Us Educational tech toys that are kits kids can build to mix building, craft, science, tech, coding, and fun. Their Mover Kit is like a DIY Jewelbots. https://techwillsaveus.com
Redfern They sell their Crumble board with robot kits with motors, LEDs, and sensors. All programmable with a Scratch-like drag and drop language. https://redfernelectronics.co.uk/
25
26
Little Robot Friends
littleBits
These cute little robots respond to light, touch, voice, and infrared inputs. They also blink, beep, and buzz. Plus coding! http://littlerobotfriends.com/
Easy snap-together electronic pieces make a large number of different kits, and make it fun to invent things. http://littlebits.cc/
TinkerCrate
Piper
A monthly STEAM project arrives in the mail with materials, blueprints, and many ideas for learning and fun activities. http://www. kiwicrate.com/ tinker
Secret Codes Kits and Books Scientific Explorer Secret Codes Decoder Kit
little Bits
Telegraph Kit: The Science Cube We covered Morse Code in an earlier issue, so why not let the kids make their own machine? Definitely a cool gift idea for anyone who wants something physical to engineer. https://www.amazon.com/ Telegraph-Kit-The-Science-Cube/dp/ B0082CRY7A
Secret Decoder Deluxe Activity Set: ON the GO A little less focused on established codes, but has three workbooks which kids can delve into and crack the mystery as they go! https://www.melissaanddoug.com/ secret-decoder-deluxe-activity-set--on-the-go/5238.html
Cracking Codes with Python This book combines two fun experiences: Python, which is easy to code, and secret codes. All kinds of ciphers are covered with details about how to use Python to break them. A fun, engrossing source book for someone interested in solving puzzles with code. https://nostarch.com/crackingcodes
Scientific Explorer Secret Codes Decoder Kit This kit has fun tools such as invisible ink, while also containing info cards about some ciphers and codes, including Pigpen (which we covered in an earlier issue). https://www. alexbrands.com/product/sciencelearning/science-learning-sciencekits/fun-lab-secret-codes/
Top Secret: A Handbook of Codes, Ciphers, and Secret Writing This takes a slight turn away from the ‘fun kits’, but it does cover a lot of the codes used throughout history, and gives some test codes to break. https://www.publishersweekly. com/978-0-7636-0971-9
Secret Decoder Deluxe Activity Set
27
Board Games Some of the best ways to learn about programming are through board and card games. You don’t need electricity or a computer, and they’re fun for little kids, bigger kids, and families. And don’t forget chess, Go, backgammon, and other traditional games which are fun and teach problem solving and strategy skills.
Robot Turtles Robot Turtles is a great board game with an online community where you can create your own game boards. These games sometimes let you replace the object you direct with a favorite person, adding another level of fun and engagement. http://thinkfun.com/robotturtles/
Code Master
Code Monkey Island Programming, mysteries, and fun for kids ages 8 and older. If played as a family, it’s likely younger kids will understand the game too. Use cards to move a monkey around the island as kids learn strategic thinking, logic, and how to adapt. http://codemonkeyplanet.com/
Code Master This single player game, from the makers of Robot Turtles, has 60 levels you work through to learn programming logic. Only one path leads to the crystal and wins the game. http://thinkfun.com/codemaster
Giggle Chips A set of creative game cards created by a mom and her young, doodling daughter that teach computer science concepts in a fun, visual way. http://gigglechips.bigcartel.com/
Bits and Bytes This card game teaches basic computing skills: logic, problem solving, and critical thinking. The game is absorbing and flexible. No need for a computer. http://bitsandbytes.cards/
littlecodr This deceptively simple card game for kids 4-8 lets them lay out a series of steps for others to follow. When they master the basic game, they can add more advanced cards. http://littlecodr.com/
Notable Women in Computing Card Deck
Robot Turtles Board Game
A traditional 52-card deck featuring women who have contributed to technology can be used to play any classic card game. The makers also offer cards with women from the Middle East and Africa, and posters for both sets. Download the poster and cards to print locally! http://notabletechnicalwomen.org/
CodingFarmer Players make their way to a farmhouse, navigating tractors past obstacles, recharging at windmills, and relaxing at rest stops. Game can be played with instructions in English or Java code. http://bit.ly/2cMghWd
CodingIsGood Two-player card game for kids 10 years and up. Basic, Intermediate, and Advanced cards let kids challenge each other in their knowledge of Python, an accessible programming language. http://bit.ly/1YhWVKo
28
Virtual Reality Virtual reality kits vary only in quality of the experience—the ability to trick your eyes and ears into believing the digital world around you is real. For headsets connected to computers, virtual reality also requires the latest video cards and processors to stream data to the headset without interruption. Where to begin if you want to try VR out? Google Cardboard is the least expensive place to start. All you need is their viewer and a phone to create a headset. More expensive headsets connect to smartphones, Playstation, computers, and other platforms. Vive, for example, is a headset that uses base stations to fix your position once connected to your computer. If you choose one of the high end virtual reality kits, be aware of exclusive software, DRM (digital rights management), and other things that will limit your ability to try out software. For example, software built solely for one virtual reality platform means other platforms can’t use it. Open platforms can use software from anywhere as long as it conforms to basic standards.
MAURICIO PESCE, FLICKR
Google Cardboard For $20-$30 USD you can buy a cardboard headset then slide in a modern smartphone and use VR apps. While not as immersive as the HTC Vive, the experience is as amazing as more expensive options. https://vr.google.com/cardboard/
Vive
HTC Vive
While this is the most elaborate VR setup, the use of base stations to fix your position places you accurately in a VR world. At the least, definitely find a Microsoft store with an HTC Vive setup and try it out. It’s amazing. Oculus Rift is worth a look, but may offer content that only works on a Rift. https://www.vive.com https://www.microsoft.com/en-us/store/locations/htcvive/
Playstation VR The Playstation platform has added virtual reality to its games. You need a Playstation 4, but if yours is an older model or you don’t have one and want to buy, the VR version of the platform could be lots of fun. https://www.playstation.com/en-us/explore/playstation-vr/
Samsung Gear VR A combination headset with smartphone, like the Google Cardboard, the Samsung Gear VR headset experience is more immersive. A controller also adds to the experience. http://www.samsung.com/global/galaxy/gear-vr/ b
Samsung Gear VR
Lately, one question keeps popping up in my inbox from parents and friends alike. If you are a CS teacher or a concerned parent of a gamer, you too may be wondering: What should I do about Fortnite? Last June was the first time I was approached by a parent who had an urgent concern about her 12-year old boy and Fortnite. According to her, the school year was a constant battle between her son, whose only desire was to play the popular cooperative multiplayer game, and herself. She wished to set reasonable limits. How should she handle his obsession with online gaming? As a parent and educator, I understood her frustration. Middle school is a crucial developmental stage, and many kids think, talk, and practically breathe online gaming. My response to her and a few others recently is two-fold. I believe gaming in and of itself isn’t the destructive force some have made it out to be, and gaming can be a great motivator for learning Computer Science and game design. A recent study by Dr. Andrew Przybylski from Oxford University has shown that there is a psycho-social benefit to moderate game play (an hour or two per day). While that benefit is reduced for gamers who play three hours or more, the fact remains that gaming in moderation can aid a young person’s sense of identity and well-being. Some research might even explain why gaming can be a powerful motivator. It provides kids a few things
of gaming and game design. Far from an unattainable skill, game design gives kids the ability to create and bring their internal imagined characters, maps, and quests to life. From learning the basics of Redstone in Minecraft to manipulating sprite actions in Scratch, there are many ways to begin an education in game design. Starting with Scratch or WoofJS, and then working up to Unity or Godot is one proven path. One outstanding resource that dropped last spring was a game design addition to Harvard’s computing course CS50. While this was built for college freshmen, many of the challenges in the course are attainable for enterprising middle and high school students. The course is free to audit and it would be a great way for parents and children to work together on learning new skills. Finally, as relatedness is one of the driving factors of motivation, I also urge parents to play games with their children. The old saying “if you can’t beat them, join them” rings true in this case. Learning how their children interact with a game and other gamers is quite an eye opener for many parents. MIMI THIAN, UNSPLASH More importantly, working through challenges together is an exercise that can build trust and acceptance. Gaming truly is part of identity for many young people, and guiding them towards good choices is a great way to foster the parentchild relationship. b
they desperately need at that age: competence, relatedness, and autonomy. In their theory on selfdetermination, University of Rochester psychologists Edward Deci and Richard Ryan state that competence, relatedness, and autonomy are innate psychological needs young people need to mature into healthy adults. An activity that provides these needs is very attractive to a developing child—especially at an age when social acceptance plays such an important role. I have seen that gaming fills a niche in some students’ developmental needs that other activities fail to provide. Gaming talk has also become de rigueur in middle school hallways, and showing skill in competitive environments can have social rewards as well. All of that being said, I constantly try to steer kids and parents away from being merely end users of technology. Gaming is a prime example of end-user technology, but it can also be be great way to motivate students towards the creative end of the sandbox. I encourage my students to not only play games, but also to be a student
29
Parents and Teachers
The Fortnite Dilemma
BY TIM MCGUIGAN
“Any sufficiently advanced technology is indistinguishable from magic.” —Arthur C. Clarke Thank you for reading this issue of beanz ! Check out the links below to read stories from this issue online with links to learn more. TIC-80 II: Starting a Platformer http://beanzmag.com/ tic-80-intro
Dijkstra’s Algorithm http://beanzmag.com/ dijkstra-algorithm
Meet Meriame Berboucha http://beanzmag.com/ meriame-berboucha
Code on the Go! http://beanzmag.com/ coding-is-good-review
Let’s Talk About Event Handling http://beanzmag.com/ remote-control-turtle
Coding Mistakes http://beanzmag.com/ coding-mistakes
Write This Down: Old Is Good! http://beanzmag.com/ lambda-calculus
Fashion Meets Tech http://beanzmag.com/ fashion-tech-kits
It’s Only Logical! http://beanzmag.com/ logic-puzzles-wolf-goatcabbage
Fun With Bash Scripts http://beanzmag.com/ bash-cli-scripts
STEAM Gift Guide 2018 http://beanzmag.com/ steam-gift-guide-2018
Scratch 3 Is Almost Here! http://beanzmag.com/ scratch-3-preview
The Fortnite Dilemma http://beanzmag.com/ parent-teacher-fortnite
Robot Extensions http://beanzmag.com/ robot-switches Wondering What Your Browser Says About You? http://beanzmag.com/ panopticlick-security Book Ciphers http://beanzmag.com/ book-ciphers
What Next? http://beanzmag.com/ minecraft-mods
ribe!
Subsc
http://beanzmag.com/subscribe