Explorers – Week 5 – Guessing Game

Hi everyone,

Well! didn’t we have a very studious bunch of Ninjas last week, all very focused on our new game. Last Saturday we did a slightly different game to usual., There was no movement, no sensing when something happened. It was a Maths Game, a guessing game where the computer picks a random number and we had to guess the number.

We had to first make sure that a random number was picked using an Operator. Previously we have used a Variable to store a Score or Lives, but this time it was storing the random number and our guesses. Leaving them on screen as we were testing allowed us to understand more about the variable and what it does…it also made the testing a little easier.

Depending how any guesses we were given we repeated our code that number of times. As well as having to make decisions, i.e If_then, we also had to do a comparison before making the decision, to determine whether the guess was correct, too low or too high.

5guesess

I hope you all enjoyed the difference this week and we are going try something else different next week. We  (You)  are going to create a Animated Halloween Scene. Get your Thinking Hats On!

Here are this weeks notes in PDF: CDA-S6-Week_05-GuessNumbers.pdf

Creators – Being Random

Screen Shot 2017-10-17 at 00.56.49

This week we mainly looked at three things:

  • How data is organised on your computer
  • Creating functions
  • Using randomness to make things interesting

Data Organisation

Most of us had heard of a hard-disk before. This is a stack of metal disks inside your computer. Each metal disk has a special coating made of millions of tiny magnets (like you might find stuck to the fridge) that can be turned on and off.11644419853_9499fa0faa_b

We saw that able to turn something on and off, like a switch, was enough to count from zero to one, but the more switches we added, the higher we could count. Two switches can count from zero to three:

Switch 1          | Switch 2          | Total (Add)
[Off = 0, On = 1] | [Off = 0, On = 2] |
------------------+-------------------+-----------
Off = 0           | Off = 0           | 0
On  = 1           | Off = 0           | 1
Off = 0           | On  = 2           | 2
On  = 1           | On  = 2           | 3

With enough of these tiny switches, we can store anything we need. Each of these tiny switches is also known as a ‘bit’ and a 1 terabyte hard disk has a billion of them!

We also saw that the files on your disk are arranged with folders (also known as directories). Folders can contain both files and more folders. This allow us to keep our hard disk organised; without them all our files would be in the same place which would be difficult once we had more than a few. The location of a file is called its “path”. Looking at the highlighted file on the desktop of my Mac we can see the full path would be:

Screen Shot 2017-10-16 at 22.19.59

/Users/kierancoughlan/Desktop/Ball and Bat Sounds.m4a

 

This means that, reading backwards, the file called ‘Bat and Ball Sounds.m4a’ is in a folder called ‘Desktop’ which is itself inside a folder called ‘kierancoughlan’ which is, at the highest level, inside a folder called ‘Users’.

Functions

A function is a collection of commands that do a job together. We’ve already encountered them, even if you hadn’t especially noticed:

  • Our P5 template already contains two functions called start() and draw()
  • All of the P5 commands we have used, such as createCanvas() and rect() are functions themselves

We could add all our code to start() and draw(), in fact, that’s what we’ve done before this week. That’s fine starting out, but it does mean, once there are a lot of commands in those functions, that our code is gets harder to read and understand. Breaking out a few commands into a new function and giving it a name that describes what it is doing, really helps.

Once we’ve written a function, it can be called as many times, and from as many places, we as need.

Functions can do one other thing too: they can give back a value to the place where they were called from. For this we use the special word return. For example, let’s see what a function to pick the largest of two numbers, we’ll call it Max(), might look like:

function start(){
    let a = 4;
    let b = 10;
    let c = Max(a, b);
}

function Max(n1, n2){
    if (n1 > n2)
        return n1;
    else
        return n2;
}

We give Max() the two numbers we are comparing. If the first one is bigger than the second, it gives back the first. Otherwise, if gives back the second. Note too that the names of the variables in Max() are different to those in start(), and that’s not a problem.

Random

Finally, we looked at the P5 function random(). We used it two different ways:

random(); // gives a number between 0...1
random(n); // gives a number between 0...n (where n is a number!)

In the first form, we used it to pick a random colour. In the second, we used it to pick a random position for our squares.

Files

As usual, all the code is on the creators github repository. Head there and download it!! The files for this week contain both the script we wrote (sketch.js) and a longer version that I wrote (sketch2.js). Feel free to take a look at both!

Bodgers – Making Movies

There was great excitement at this weeks session as the Pioneers teams opened their gifts from the Raspberry Pi Foundation. Each team member received a Raspberry Pi USB wristband, a Pioneers Lanyard, stickers and some sweets. Each team also got a copy of the Makers Guide to the Zombie Apocalypse and some zombie make-up.

We also got to see what was in our “Mystery Box” and I’m sure we are going to get great use out of it in future projects.

We then talked about the videos we’ll need a part of our entry and we had a look at a video from Pioneers on we need to put in our videos.

Then the teams spent some time planning out what they are going to do for their films.

Next week we are going to get back to working on our our projects.

See you then.

Declan, Dave and Alaidh

Hackers – 3D Modelling with SketchUp

roompic

At this week’s session, Kevin introduced everybody to SketchUp, a free 3D modelling program. Models built with SketchUp can be exported to a format suitable for input into Repetier Host, to prepare them for 3D printing.

Incidentally, other options for 3D modelling include Blender (which some may have used previously for modelling) and TinkerCAD (which is web-based so does not require installation).

Here are some notes on getting started with SketchUp – they are taken from an NUI Galway summer camp I was involved in organising a couple of years ago: sketchupnotes

By the way, the picture above is a SketchUp model I built previously of a room.

Important: to export SketchUp models to Repetier, you first need to install the SketchUp STL Extension. Instructions:

  • n the SketchUp main menu, select Window – Extension Warehouse.
  • Search for SketchUp STL (see below), then go through the steps of downloading and installing.
  • Note that you may need to create a Trimble account (Trimble is the company that develops SketchUp).
  • You may see a warning that it is not marked as compatible with your version of SketchUp, but just press OK.
  • After installing the SketchUp STL extension, you will have a new menu item: File – Export STL.

sketchupstlextension

Bodgers – Making Headway

This week our teams started coding their their projects for the Pioneers challenge.

The Zombie Trolls and the Zombie Herders started by playing audio for their Raspberry Pi projects using Pygame.

The green fingers spent the session trying out sensors for their Arduino based project like this DHT11 temperature and humidity sensor. They also got a soil moisture sensor and a float switch working.

We also got some great news from Twitter before the session.mystery win

Here is a picture of the mystery box.

mystery box

I don’t know what the mystery is, it looks like a cardboard box to me 🙂

See you all next saturday.

Declan, Dave and Alaidh.

Explorers Week 4 – Help Bo Peep find her sheep

Hi everyone,

Great week again with huge crowds but thanks to our new room layout and a couple of Health and Safety issues sorted, I think it was a more comfortable and safe environment for everyone. Thank you to Niamh, Sarah, Roisin , Alan and Pete you came early and helped sort out the new layout.

This week, I helped Bo Peep found her sheep! Some of you did the same and some used ideas like Minecraft Steve finding Iron Ore and Diamonds, Knights finding dragons or a Princess finding flowers.

Before we even started our game this week we talked a little bit about File Management and about the importance of keeping your files somewhere you can access them quickly and giving them a meaningful name.

So to this end, we all created a folder where we will be keeping our files in the future and within that we had a sub folder for this weeks files.

We started our game by drawing our background on our stage:

Rather than use the sprites from the Scratch Library, we searched the internet using a image search for our Sprites.

This week, we decided to move our main sprite using the arrow keys. For this we had to learn a small bit about the X and Y axis and I gave you a little tip on how to remember which is which!

Hope you all enjoyed this week, next week we have a very small bit to finish off for this game and then we will start a new game!

Here are the notes for this weeks session in PDF CDA-S6-Week_04-BoBeep

Martha

 

Explorers Week 3 – Improving last Weeks Game!

Hi everyone,

Can you believe the crowds we had again last week, another record 251 Ninjas and Parents attended Coderdojo Athenry last week.

We were adding to and improving our game from last week. We added a sprite that would catch the fish and decided what could or would happen when this occurred.

We discussed how to make a game more fun we have to add some complexity to it….we need to make it harder to play!! so to this end we used some code from our operator palette to add some randomness.

I also introduced Variables and how we can use them to keep track of things like Score or Lives.

I am attaching the notes from last week as PDF CDA-S6-Week_03-FirstGame_Part2

See you all this Saturday again. We will be starting a new game and Ill need your help.

Martha

Bodgers – Getting Started On Our Projects

Hi again Bodgers

We started today’s session by looking at 3-D Modeling using FreeCAD. FreeCAD allows us to build complex 3-D designs using primitive shapes like cubes and cylinders. You can download FreeCAD from here and the video below will help you get started.

Our teams have finished deciding what they are going to work on for the Raspberry Pi Pioneers Challenge and they also have picked team names.

IMG_20170930_134236

The Zombie Herders

IMG_20170930_132720

Green Fingers

IMG_20170930_133533

The Zombie Trolls

Don’t forget our Twitter @CDA_Bodgers and check out the #MakeYourIdeas hashtag for more information.

See you next week.