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

Snack Discussion

I’ve started my eleventh 4th-grade after school Code Club session. We’ve met three times and things are going well, but I’ve neglected to blog.  I’m using the same club format and the same projects I’ve blogged about before, so there was really not much to write about.  After this week’s session, though, I found I have something to share.

Screen Shot 2019-03-16 at 9.24.16 AM

Week 2 project: Maze game by a 4th-grade code club member

Code Club starts right after school – literally, the last bell rings and the students walk from their classroom to the computer lab. We start by circling up the chairs and having a meeting time where I take attendance, talk about what project we are going to do, and have a snack. (Snacks are provided by members who volunteer to bring something to share with everyone.)

Since we can’t eat while coding on the computers (school policy and good rule in general), I use this beginning time to talk about computer science, my coding objective for the day, etc.  This group is a very easy-to-manage and attentive group so I have made an effort to start a snack discussion to fill this time. Their thoughts and ideas are helping me craft the club to fit their needs.

IMG_0744

This first day I asked them what their favorite computer/video game was. Their favorite games ranged from themed games like Harry Potter to popular MMO games like battle royale type games.   No real surprise there.

The second week I asked them what types of games or projects they wanted to learn to make. I wrote down their list of ideas.  There weren’t many surprises, but I do have a number of girls who want to make a virtual pet style game, so I’ve added that to the learning projects I will present to them.

This week I asked them what they thought was the hardest part of coding. This was exciting because many of them felt comfortable enough to share their concerns.  I listened and affirmed that all of these were difficult parts.

I have a volunteer, who is a middle school math teacher, and she shared her concern that the hardest part for her was when a student asked for help but only said, “this isn’t working”.  It is true, that it is difficult to figure out what is not working in code at first glance. It would be helpful for the students to explain what they were hoping would happen and what was actually happening in their code.

Some of the other parts they thought difficult were:

  1. finding the code blocks they were looking for.  (I have to remember that they are very new to Scratch.)
  2. using the costume editor. (Another student gave some tips on this – like switching out of vector mode to draw. I thought it was great that they are helping each other.)
  3. coming up with the design of the project they want to make. (I affirmed this was a difficult part. A good design plan makes the rest of the project go smoothly. For some games, the design phase takes 50% of the total time from start to finish.  I also told them that when designing their game, they would fill out a Game Design Document to help them make those design decisions.)
  4. finishing the project/ getting the project to match their expectations. (Wow, these are insightful kids.  Yes, I told them that I and the volunteers would help them manage their project.  First by making sure it was a project that could be done and second, by helping make a plan for them to get it done in time.)

The snack discussion has become a favorite part of Code Club for me.  I hope I can come up with more good prompts.  Maybe I’ll ask about getting unstuck next.

I am also enjoying teaching them to code and playing some of their creative projects, too.  Here are a few screenshots.

Screen Shot 2019-03-16 at 9.23.56 AM

Week 3 project: Quiz-type Chatbot by 4th-grade Code Club Member

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.

Workshop Reflections

I’ve been reflecting on my #ScratchMIT2018 conference Saturday workshop.  I had a lot of information and student work to share and I did that. It was a nice size group of educators from around the world. The people who attended were great and some were definitely excited about it.

I spent more time talking about my design review process than I expected. When we finally broke into groups, people seemed engaged when they were looking at my students’ work and thinking about how to support them.

This was my first time presenting a workshop at such a big conference and I learned a lot. One thing I could improve is my facilitation of the discussion. I need to prepare better follow-up questions and do less talking.

I made four different packets of student work to share. Different groups looked at different packets which I thought would facilitate more varied conversations but I was the only one who knew all the work and that hindered the whole group discussion.  I should have at least brought up the finished project under discussion on the screen so that the rest of the group could have a frame of reference.

One project that we discussed was Penguin Trivia. It was noted that its design document matches the executed project well.

Screen Shot 2018-01-07 at 5.08.50 PM

I could have followed up with what “supports would you put in place for this student?” Since her communication and time management skills seem strong, she could have used more support on game flow code examples and more time testing and debugging. (Although this is always true)

Another example project that was brought up was Thee Annoying’s Return. In this example, we thought the student could improve how he communicated his project.Screen Shot 2018-07-30 at 5.41.08 PM

Someone noted that he says there are no rules, but clearly, there are. So what clarifying questions should we ask during design review so we know he has thought carefully about his game?

The design document serves as a way for students to think deeply about their project before embarking on its creation. The thing with creative adventures is that plans change. That’s okay. The design document is a guide. There were some helpful suggestions about how to refer the student back to the guide during the creating process as a self-check-in. Older students may be able to reflect on their progress and assess the status of their project themselves.

Some other great ideas came up during the discussion.  One was having a peer review in the middle of the process as a way for students to support students.

Another idea was to have a checklist of things that should be in the project.  I’m not sure if this would be a general or project specific checklist, but it would aid in assessment, either way.

One problem we weren’t able to solve was having the time to meet with each student/group when the numbers are large or the time is short. I generally rally some additional help on Design Review Day so I know everyone’s project gets at least a quick approval so they can get started. I do check in with students each week to see where they are, where they are going, where they are stuck, etc.  There are a lot of pieces to project management, but the benefits of letting students pursue these passion projects are huge.

Overall, I am happy with how it went and I’d enjoy running it again.

Create Your Own World

I don’t usually blog in the summer, but I’m running a weekly summer code club at the library in July and I’m being a bit reflective about the monthly one that I helped lead this last year.

Earlier in the year, I introduced a new (to me, too) project to the Lebanon Library Creative Coders. We decided to take two of our monthly meetings, February and March, to work on the Create Your Own World project from Code Club World.  I knew this middle school age group would enjoy creating a platform game. One of them even continued to work on it for a third month and was able to add a lot of detail like hit points, inventory list, and bad guys.

 

Screen Shot 2018-06-29 at 8.05.47 AM

World detailed with inventory, hp, weapon and bad guys.

The first meeting we focused on setting up the player movement.  We remixed Code Club Rik’s Resources for this project so we could jump right in with the coding.  When I was prepping for our meeting, I went ahead and changed the character from a square to an overhead view of a guy walking.  One of my original groups of students created Showcase projects called Tomb of Terror and Shadow Swamp with Hatty McWalker.  That’s who I was thinking of with this guy.

Screen Shot 2018-06-29 at 7.49.15 AM

Overhead view of my player.  I added a costume with the mirror image and a “next costume” block in my code to make him look like he is walking.

The Creative Coders were certainly creative with the movement options.  I’m used to using arrow keys for movement, but these middle schoolers liked ASWD and this creative ghoulish option with side arrows for turning and up for forward:

 

I’m finding it useful to look at the code more closely.  There are some interesting, creative coding going on and I’m seeing some misconceptions that will help me help them debug their code.

Screen Shot 2018-06-29 at 7.27.01 AM

Well coded ASWD movement and wall checking

I’ve seen this forever-forever coding before. Something is not working like they expect and they try to solve it with nested forever loops.

Screen Shot 2018-06-29 at 7.27.37 AM

Nested infinite (practically) loops didn’t fix the problem – switching to the “play sound until done” block did.

Or they are checking for an event and forget to put in the forever loop:

Screen Shot 2018-06-29 at 7.55.25 AM

One time event checking?

This wall checking code has been separated from the key-press event giving no response.

Screen Shot 2018-06-29 at 8.02.31 AM

If touching wall move in all directions at once.

A couple of the coders explored more blocks where you can define your own.  This led to a teaching moment for me to explain how these function blocks worked.  It turned out less useful than my right-click to duplicate code suggestion.

 

 

All in all, they impressed me. In the moment I’m not always sure what is going on with everyone and even at the end when we stop to share what we’ve accomplished I don’t always know how they did.

Some of them didn’t want to continue what they had started the month before, but they were self-motivated and independent enough to work on their own projects.

I love that this crew is supportive of each other and willing to share their ideas and compliments.

Screen Shot 2018-06-29 at 7.23.54 AM

I appreciate good, supportive commenting

Some of the same students have signed up for the summer session. I’m looking forward to it.

Make It Your Own

My 10th after school Code Club started at the end of February.  This is a small group of 10 4th grade students, which is nice for a change. It is great to have three girls in the club, too. A couple of the students were in Code Club in 3rd grade and a couple students also come to the monthly Library Code Club.

For our first project, I presented an old Code Club project “Felix and Hebert” which I did not find on the Code Club World site when I went to link to it. It is a simple chase game where one Sprite is controlled by the mouse, the other chases after it. The project gets you a simple game with very little coding. It is a nice way to introduce Sprites and Events and I saw some creative projects.

For our second meeting, we started with an Etch-a-sketch project with the option to add a maze game to it.  Some students stayed with the Etch-a-sketch project, just having fun messing around with drawing on the screen. It was a nice twist to start with the Pen blocks and directional controls, then add the wall color sensing code for a maze game. I feel these two projects transition nicely into each other instead of doing one project or the other.

Screen Shot 2018-03-10 at 8.35.37 PM

This student just enjoyed making a drawing program.

Screen Shot 2018-03-10 at 8.36.10 PM

Etch-a-Sketch code

Another student changed the arrow keys commands to generate interesting curve drawings. The up arrow moves the Sprite forward as normal but the left and right keys turn the Sprite.  Hold two keys at once for drawing curves.

Screen Shot 2018-03-10 at 8.32.59 PM

Up arrow for moving forward, Left and right for changing direction. Plus the trail of the chaser bot.

 

Screen Shot 2018-03-10 at 8.32.28 PM

It was very cool to see curves drawn instead of the usual straight lines and square corners of the Etch-a-Sketch. Some of the other students wanted to copy this movement style.  I was proud to see the students share their code ideas.  Later I saw one student sharing a way to make your own code blocks. He thought this code was how he made the Sprite stop moving.

When I looked closer, I noticed he didn’t have any blocks under the define hat.  He was sharing his code but it wasn’t code that was affecting anything.  I am impressed that he choose to design his own code block when he couldn’t find the block he wanted, even if he doesn’t yet understand how to do that.

Next week we are going to try the Chatbot project and I’ll have to explain how the “Make your own blocks” work.  I have been wanting to show students how those work, now I have a good excuse.

Screen Shot 2018-03-10 at 8.37.18 PM

In this project, you can teleport to the rainbow.

 

Screen Shot 2018-03-10 at 8.37.11 PM

Touch yellow to be teleported to the rainbow. Touch black to return.

This is a creative and adventurous group.  Should be a fun 10 weeks.

We Love Winter

It was another snow day today which reminds me of a recent project made by a 2nd-grade class. They missed Hour of Code Week activities so their teacher asked me to do a coding project with them.

Screen Shot 2018-02-07 at 7.25.49 PM

Over the course of three 25 minute computer lab times, the 2nd graders created these winter themed projects.  They include 3-4 clickable sprites and one sprite that introduces the project and gives directions.

Screen Shot 2018-02-07 at 7.30.31 PM

This was a true first project for these students.  I introduced all the different aspects of Scratch: Stage, Sprites, Code blocks, events, etc.  We started with making the Sprites ‘clickable’ – meaning they would do something when we clicked on them.  We did a few different Sprites do different things.  There was some confusion around having the Sprite “say” hello.  The students expected to hear “hello” spoken, not written on the screen. I guess I need to be more precise when describing that action.

We did add a Sprite that plays a Sound when clicked, and one that turns, one that changes color.  And one that glides.  I decided that the glide block would work better in our interactive project than a move block that might eventually move off the stage.

Screen Shot 2018-02-07 at 8.22.06 PM

The last Sprite we added was one that would introduce the project and “say” the directions.

Screen Shot 2018-02-07 at 8.25.27 PM

I thought they did a great job on their first project.