Finite State Machine

My monthly middle school library code club met this week on April Fools Day.  I thought it would be fun to make a joke or prank project but I wanted to give some boundaries to the students, too. I was a little bit worried that we might end up with some inappropriate projects.

I kept thinking about one project that a middle school student made during the Winter Carnival coding sessions.  In addition to his animation, he had a simple button on the screen that said: “Don’t press”. Of course, users are going to press it.  Pressing it made a really annoying and alarming sound. I thought this type of project would make a great April Fools project for my group.

When I started to make my own version of the “Do Not Press” project,

I realized that I wanted different things to happen: first one thing would happen, then something else, and so on. Each time you pressed the button something new would happen. I would need a way to check how many times the button had been pressed and use that to decide what would happen. I needed a finite state machine (at least a very simple one).

Screen Shot 2019-04-03 at 9.58.31 PM

A finite state machine, FSM, is a basic computer science concept for controlling the logic of a program. The concepts center around keeping track of the state and what it takes to move between different states. This example is the simplest form of FSM. Now I had a lesson to teach the students and a fun prank project for them to make, too.

Using a single variable to keep track of the state of the project can come in handy for many types of projects. I had a couple of the coders in my mind who would find learning this concept useful in the programming they like to do.

The coders did find the project fun.  A few of them expanded on my starter project and a few them took the concept and used it in their own original way.

I only wish I had not made the final state check “if state > 3” but “if state = 4” in my example.  That would have made it easier for the coders to add on more states.

Advertisements

Timing & Video Sensing

Last week at Creative Coders Club we played with video sensing in Scratch 3.0. It was a ton of fun.

I originally wanted to teach the students some new coding techniques to add to their skill set and thought about introducing using timing and timers.  Adding the wait time block to music or animation can produce powerful effects.  Also, adding a count down timer in a game can make it more thrilling.  I remember having a Getting Unstuck challenge in this theme of using time-related sensing blocks. Here are the examples I presented to the students:

Screen Shot 2019-02-14 at 7.22.42 PM

Learning project from YoungHacks which shows a bunch of uses of timing blocks

Reaction Timer

Allenqin22’s project uses Cloud variables – another thing I need to introduce to my coders.

 

I also thought this reaction timer example would interest the middle schoolers.

 

 

While I was looking for examples, I found this featured project, called Excuse Generator, which the students did enjoy looking at. It was not related to any ideas I was presenting, but it was such a cool project by a new Scratcher I had to share!

Screen Shot 2019-02-14 at 7.15.42 PM

Scratcher Rose-Pearl’s Excuse Generator

The biggest hit turned out to be the video sensing extension.  I knew it would be a great fit for this group when I found the Scratch Team’s Save the Minifigs project. This group would love creating something like that.   My co-leader Kathy agreed.  She found and printed the Scratch video sensing cards for the group.  Since we use Chromebooks, we had easy access to webcams.

We had some technical trouble with the Wifi, not related to Scratch and students had to work in pairs while we worked on getting more computers up and running. In the end, the students didn’t feel like they had enough time to work on this topic so we will revisit video sensing next month.

Here’s what they were able to accomplish.

Screen Shot 2019-02-14 at 7.44.21 PM

Catness – pet the cat and get some strange effects.

(I was going to add more pictures but who wants to see my face multiple times? Just go to the studio link above and check them out.)

One funny note: As I was circulating around to help students, I would inadvertently cross through the webcam’s view of someone’s project and cause all sorts of havoc.  I would also misinterpret someone waving as someone needing help and zip around – through the webcam’s view of others, only to find they were just testing video sensing.  We meet in a library conference room with windows to the main area. I imagined we looked strange with all the arm-waving going on.

I can’t wait to continue with this next month.

New Year, New Scratch

Creative Coders Club on Monday was one of our best sessions ever.  The kids were really creative and funny and fun to work with.  The kids that came were all returnees and familiar with Scratch.  It was their first time working with Scratch 3.0 and despite a few grumblings about where familiar tools went, they were able to create some creative projects.  For such young people, they really seem upset about the changes to their coding environment.  I’m sure they will get used to the new version and not look back.

When I was looking for a project this month I noticed the tutorial from Cartoon Network on Animating an Adventure Game.  I knew the Creative Coders had been wanting to make an adventure-type game.  I added this option to our January studio and went through the tutorial myself so I could field any issues.  It has some fun character Sprites but turns out to be a simple “collect the gems” game. I felt it was a nice option for the club.

I also looked at the Scratch Design Studio for January.  I’ve been looking at the prompts each month since the Scratch Conference in August, hoping to find one that would work for this club.  The current theme is the Year 3000.  I felt it would really bring out their imagination and creativity.

I started out our meeting with a “Happy New Year” and a question for them. Did things seem different now that it was 2019 or did things just seem the same?  I told them that when I was their age, computers weren’t for kids and that 500 years ago books weren’t for kids either.  Then we brainstormed about what the year 3000 would be like.  That was the first hook.

Then I read them the Scratch Design Studio description.  I really liked some of the questions it asks, like what will food be? like or how will we dance?  It sparks the imagination. They shared their ideas and I had a difficult time getting them to not share all at once.

Next, I showed them the project I made about the year 3000.

screen shot 2019-01-08 at 9.18.15 pm

My sample Year 3000 project

The other hook was the text-to-speech extension in Scratch 3.0.  screen shot 2019-01-08 at 9.29.24 pmI had read that some of the tools from Scratch 2.0 – like music and pen blocks – had been moved into the extensions section.  When I went looking, I found the text-to-speech extension.  It is easy to implement and works great.

 

I knew it would be a hit with the Creative Coders, and I was right.  (My only worry would be about the appropriateness of the middle school students – and I let them know, a few times, what my expectations were).

Everyone incorporated text-to-speech in their project and everyone used it appropriately. Whew.

There is not much time in an hour to imagine and create a project but the kids managed to work hard and when I told them they had only 10 minutes to get something ready to share, a few of them revised their big ideas into something manageable.  Two (of ten) said they would finish later.

In the last ten minutes, I showcased the projects they made and added to our January 2019 studio.  We laughed and enjoyed each other’s creativity and imagination.

screen shot 2019-01-08 at 9.43.33 pm

The very funny “So boring” Year 3000.

screen shot 2019-01-08 at 9.47.53 pm

Another very funny text-to-speech Year 3000 project.

I highly recommend trying out the text-to-speech extension blocks and the different voices.  It is a little tricky to have the “text-to-speech” and “say” blocks sync up (like closed-captioning) but is worth it to be able to see and hear the project.

I hope some of them submit their projects to the Scratch Design Studio and I hope next months SDS theme is just as fun.

Happy New Year and kudos to the Scratch team for a great new version!

Summer Creative Coding Club

This July I’ve been leading a 4-week coding club at the public library for middle school age students.  It is a 1.5-hour session for up to 12 students. Kathy, the children’s librarian, is my co-leader. She sets up the library space, takes care of the sign-up list, and prints project resources we use, in addition to supporting the students during the sessions.  We worked together during the school year, co-leading Creative Coding Club, which met once a month, and because of its success, we are planning to offer it again this fall.

OLYMPUS DIGITAL CAMERA

We have this great space at the public library (although the projector doesn’t have the greatest quality display).

In early June we decided which projects to present during the 4 summer sessions:

1) RockBand/Pong  (both good intro to Scratch or refresher projects)
2) Chatbot  (one of my favorites. We have done this one before but it is very open-ended and worth repeating)
3) Flappy Parrot (a favorite of my 4th-grade code club and one I haven’t done in the library setting)
4) Makey-Makey (piano and cardboard- a great way to end)

Session #1

About a week before our first session World Cup soccer was making news headlines which got me thinking about all the sports-themed Scratch projects my students have made. So I went looking and found a Code Club resource with a soccer theme which Kathy printed. (our Creative Coders is a registered Code Club).  Kathy also had the Scratch Music cards available as well.

I created a class studio Summer #1 and added a remix of the Code Club resources for Beat the Goalie.  It has the assets (Sprites and background) ready to add code blocks following the guide.  I wanted to add an example of a music project, too, so I made this one and coded up the baseball theme “Charge”.

Screen Shot 2018-07-22 at 10.00.09 AM

My example music project

I liked the idea of giving the students two options each week. We have both returning Creative Coders and new-to-Scratch coders (plus a long wait list) for our sessions. To start with two projects of varying complexity will provide students with choice.  We hoped this would promote more creativity in their projects.  Plus, the session is longer and there could be time to try both.

For a first meet up, things went well.  There are always technical challenges just getting students on the library Chromebooks and into the Scratch class accounts.  It was also a challenge at the end to get them to stop and share their projects with everyone.  But overall they were engaged, creative and supportive of each other.

Screen Shot 2018-07-22 at 10.24.24 AM

The studio filled up with an even mix of music and soccer projects.  Since it was a bit chaotic at the end during the time we wanted everyone to check out each other’s projects, I took some time at the beginning of the session #2 to share the projects from session #1. They seem to enjoy seeing their project displayed on the screen (and me struggle to play their game).

Session #2 

Along with Chatbot, I introduced the Pen blocks and added a couple of examples from Scratch Started Project resources in the Summer #2 studio – this gave them a second choice of projects, which worked well during session #1.

Screen Shot 2018-07-22 at 10.43.02 AM.pngStudents are starting to take advantage of the class session studio to look at the examples, remix the resource projects and share their final projects for the group. I finally feel like I am putting some of the features of the Scratch teacher/class account to good use.  Both projects were hits with the students.  Kathy noted it was exciting to see them working so intently on their projects and then be so proud of what they created!  It is why I keep doing this.

Session #3

Coming up! I received a ‘final notice’ email (and saw on Twitter) about Code Club’s Moonhack 2018 project, so I’ve added it as our second option for session #3, although we’ll be coding a few days after the anniversary event.  This will be a new project for me, so it should be fun.

New Code Club Starts

I am collaborating with the children’s librarian in my city to run a monthly code club for kids 8-12.  Our first meeting was last Monday.  We had six kids show up.  I knew three of them from two years ago when they were in my after-school 4th grade Code Club.  It was great to see them again.  The other three were mostly new to Scratch.  One of the coder’s grandmother stayed for the session and we set her up to play and learn Scratch, too, and she jumped right in a made a Chatbot project.

Screen Shot 2017-10-08 at 6.10.14 PM

I knew we were going to be using the library’s Chromebooks, so I set up a teacher account and a class along with some student accounts.  I figured a few of the coders might have a Scratch account already.  One said he did but didn’t remember it.  They all ended up using one of the class accounts.   That made it easy for sharing their projects at the end of the session.

Chatbot is one of my favorite projects from Code Club World.  It requires only one Sprite and Stage, is interactive, and the projects can become very creative very quickly.   It introduces the conditional block “if then, else”, a powerful, useful coding block for decision making.  It also introduces the ask-answer block pair as a quick way to introduce interactivity. The expert coders sort of remembered Chatbot but were very happy to revisit it.

By the end of the session, everyone was successful in setting up a Chatbot and coding an “if then, else” block at the least.  Some added more complexity with movements and costume changes. It was fun to see the different, creative takes on Chatbot.  The coders shared their projects, even though some were not complete and we played them all through.  I put them in our October project studio and liked them all.

Screen Shot 2017-10-08 at 6.42.18 PM.png

I thought the English/Spanish Chatbot project was a great idea – it could be a cool way to show what you’ve learned from Spanish class.

We asked the club members what types of projects they wanted to work on in future meetings.  I heard ideas ranging from Ghost Busters, Pong, anything with horses, to a platform game. Good ideas!  We are hoping more kids sign up and we can grow the club a bit.

It was great to be back working with Scratchers.  My after-school Code Club starts up next week. More new Scratchers.