Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Wednesday, January 26, 2022

Girl Scout Senior/Ambassador Programming Robots Badge: Play Tic-Tac-Toe with a Computer


Computers playing games is the theme used to introduce Girl Scouts to the Ambassador Programming Robots badge, and it's a pretty brilliant theme! There are all kinds of great pop culture references to game-playing computers, and kids have all kinds of experiences playing against computers in all kinds of games. 

The first thing we did for this Journey is, obviously, watch Wargames! Happily, it's currently free with ads on YouTube:


I LOVE Wargames as the ultimate computer hacker, retro, semi-apocalyptic vision of what living with all-powerful computers can be and the importance of careful programming. 

It also has the ultimate pro tip for how to butter your corn on the cob. Watch for it, and thank me later.

Deep Blue and Watson are real examples of computers learning how to play games, and fortunately, there are also tons of easily available videos covering the process of creating, programming, testing, and troubleshooting the computers. Here are two of the several that we watched:


 

There's so much more to get into, though, if your kids are interested. You can replay those literal chess games, following the algorithms or going off on your own, or talk about Jeopardy game theory--all of that is not just super interesting, but increases a kid's appreciation of all the variables that go into creating a computer program that can not only mimic game play, but win it!

After all that, what better way to model this process of teaching a computer how to play a game than by playing that Wargames gold standard, Tic-Tac-Toe?

First, the kids and I all played a few (million) games of Tic-Tac-Toe, because Tic-Tac-Toe is never not fun.

Next, I reviewed the concept of the algorithm, and then modeled playing Tic-Tac-Toe while following a set algorithm... a program, doncha know?

Then, I challenged each of the kids to create an algorithm for winning a game of Tic-Tac-Toe. The rules are to create a step-by-step program that they must follow exactly when playing an opponent, but they may use "OR" and "IF...THEN" commands. 

And then... we played! 


Yes, Will's algorithm is written in red Sharpie on her arm. No, I don't know why.


We tried some various permutations of a computer playing against a person, two computers playing each other, playing X vs. O, etc.:



Syd's algorithm gave her a sneaky advantage, as she insisted that in order to correctly follow the program, the computer MUST play X:


Gives one a bit of a hometown advantage, I do believe!

The ultimate lesson, of course, is the same one that Joshua learned during Wargames--you can't really bank on winning Tic-Tac-Toe. Especially if you're the human playing against the algorithm, you can use your own creativity and spontaneity against the program. 

If you want to write a program, then, you need to write it with these caveats in mind: 1) A computer can only do what you've programmed it to do, and 2) humans don't have programming, so they can do literally ANYTHING.

If you want to offer another type of model to help kids develop a more nuanced definition of programming, you can also show them mathematical map coloring. A strategy is just another term for "algorithm," so kids could also develop their strategy for four-color map coloring, then test it, problem-solve it, give it to another kid to beta test, etc.

P.S. If you want to sneak in some high school English credit, have your kid read Ender's Game and write a paper comparing it to Wargames. They both came out at about the same time, with a historical background of the Cold War. They're both about gamifying war by manipulating beings who do not have the lived experience to throw off these manipulations, and they both question how the use of technology affects culpability. Powerful stuff, and issues that it's really good for teenagers to explore.

P.P.S. I'm overly attached to my Craft Knife Facebook page, and I post there way too often. Come find me!

Friday, July 16, 2021

We Have a Raspberry Pi

 

If your kid isn't tooling around with Raspberry Pi, are you even a homeschooler?

We finally joined the world of homeschoolers who tool around with Raspberry Pi thanks to this Kano computer kit:


We've actually had it for ages, with Syd, especially, eager to unbox it and play, but dang, did her public school schedule leave zero time for any extracurricular educational fun! This summer, though, I've been taking both kids through the Girl Scout CSA Think Like a Programmer Journey--Syd needs a Journey under her belt so she can start thinking about Gold, and Will, as usual, wants to Summit at the Ambassador level. Even though the Think Like a Programmer Journey is more about learning and utilizing the logical, step-by-step, user-centered problem-solving sequence that programmers use than about actual, literal computer programming, you know I had to sneak in the actual, literal computer programming.

Starting with putting together your own computer!


The manual is super cute and perfectly suited to walking even young kids through assembling the computer parts while explaining what each part is, what it does, and how it works with the other parts:



And when you're finished, you hook it up to the TV, which the kids thought was exceptionally fun and charming:

The little games and apps that are already installed on the Kano are below the kids' interest and experience level, unfortunately, although they did play around with them a bit. What we're most looking forward, to, though, is playing around more with that Raspberry Pi! I have requested just about every iteration of Raspberry Pi for Dummy Idiot Kids books for us from the library, and I hope that soon the Raspberry Pi programming experimentation will commence!

Tuesday, January 29, 2019

Robotics and Programming with LittleBits: How To Build a Circuit

I think that we're all liking this Topics in STEM unit even more than we did the last one!

This semester, we're studying Robotics and Programming. The spine for this unit is the Girl Scout Robotics badges for Cadettes and Seniors, and the Cadette/Senior/Ambassador Think Like a Programmer Journey. Our main manipulatives are LittleBits, Ozobot BIT, and Sphero, although we're bringing lots of other tech into the unit, as well.

Our adventures with LittleBits began with Step 2 of the Girl Scout Cadette Programming Robots badge. We needed to learn about sensors and circuits, and LittleBits has a lot of both!

Y'all are going to be so jealous, but our local university's library has a HUUUUUUUUGE set of LittleBits, which we checked out for free. This is the girls organizing the collection so we can see what we've got to work with:


Basically, LittleBits has everything you could ever dream of wanting, all nice and organized by color. Blue is a power source, pink is a sensor or other type of input, orange is a wire or a logic gate, and green is an output. Here's just a partial list of what we've got to play with from each category:

BLUE

  • AC adaptor
  • battery pack
  • micro sd adaptor
  • midi adaptor
  • stereo cables
  • USB adaptor


PINK

  • bend sensor
  • button
  • dimmer
  • keyboard
  • light sensor
  • microphone
  • motion trigger
  • mp3 player
  • oscillator
  • pressure sensor
  • remote trigger
  • sequencer
  • slide switch
  • temperature sensor
  • toggle


ORANGE

  • Arduino
  • cloudBit
  • double AND gate
  • double OR gate
  • invertor
  • Makey Makey
  • MIDI
  • NAND gate
  • NOR gate
  • wireless receiver
  • wireless transmitter
  • XOR gate


GREEN

  • buzzer
  • DC motor
  • fan
  • infrared LED
  • LED
  • number display
  • RGB LED
  • rope light
  • servo motor
  • synth speaker
  • UV LED
  • vibration motor

And that's, like, not even all the set includes, just all I felt like writing down. Imagine everything that you can do with that set-up!

After we organized the LittleBits, our next activity was simply learning how to assemble a circuit. And assembling a circuit couldn't be easier. At the most basic, you need a blue bit for power and a green bit for output. Get a little more complicated, and it's blue + a pink bit for input + green. More complicated yet is blue + pink + an orange bit for logic or wiring + green.

I set the girls to play, with the proviso that they had to write down all of their successful circuits, because writing something down is what makes it science!


If we didn't know what something was, there's a set of Module Cards, as well, with a ton of info about each bit. Otherwise, it was really fun to experiment:


I cannot overestimate the benefit of open-ended exploration in learning how something works. Tinkering is essential to the human brain. Sure, I could have lectured the kids about circuits (which I did, a little), shown them a Powerpoint of examples of circuits, maybe had them build a single model circuit by following my step-by-step directions, and that would have been fun and educational, but this?

This is so much more. This is figuring stuff out, and troubleshooting, and building on what you already know, and wondering why something doesn't work and adding more details to what does work and then taking it all apart and trying something new:


And apparently the goal of both children was to build the most obnoxious circuit possible:





I also really enjoyed watching each child's own method of troubleshooting. Syd gives it a funny look, thumps on it a little, tries different outlets, then reads the Module Card to see what she might have missed:



Will thumps quite a bit more aggressively...



I think what she was trying to do was connect a sound sensor input to a buzzer output, so that the buzzer would then provide the necessary input to keep itself running. It doesn't exactly POWER itself, but it's definitely not a bad start!

Here's some more fun troubleshooting, this time with Makey Makey!



I love to watch them so focused and content:



They figured out how to get the number display output to work, but they're still puzzling over how the input affects which number is displayed.
On another series of days, we learned about logic gates by modeling them with the LittleBits. Can the kids build a working AND gate?

They can!



I can't totally tell from the video, but I think this might be an XOR gate that Syd is testing:




You guys, this was SUCH a fun project. You can do SO MUCH with these things! We're moving on to cobbling together some DIY circuits (because even though LittleBits are awesome, they're also awfully... clean. I need my kids to know how to muscle together a circuit made out of nothing but a coin battery, a twinkle light, and some aluminum foil) and then some working models of various systems (Matt is already on tap to help the kids build a functioning hydraulic arm and hand out of corrugated cardboard, syringes, colored water, and plastic tubing), but later the kids will be building actual, working robots and/or programmed circuits to accomplish amazing things, and my hope is that they'll have the knowledge and confidence, now, to make them more sophisticated with our library-issue tech toys!