01 October 2013


The scene:  The SCSon and I are at his electronics group meeting.  He has set up his Raspberry Pi and typing random linux commands into the terminal.

One of the "commands" he entered was "bacon".  As expected (at least to me) it responded "unrecognised command"

So I ask "What should a "bacon" command do?"

"Why it should Make Bacon" he says as if it should be obvious.  "And then print out this squigley character"  [long explaination of how it's called  a "tilde" along with the mathematic meaning while another member explains the VHDL meaning omitted].
No matter, to him it's a squigley line that looks like cooked bacon.  Fair enough.

Ok... so let's write a command that makes bacon.  And we proceed to do so.

Here is the code we came up with:
#include stdio.h  (need to figure out how to make the angle brackets appear through the html)
        int  i, bacon;
    printf ("How much bacon do you want? ");
    scanf ("%d", &bacon);
    printf ("Making Bacon! ");
    for (i = 0; i < bacon; i++)
        printf ("~");
And in the process, we got into a little programming.  He also learned that the "and" character is called an "Ampersand".  I put off the "take the address of" talk for another day.  Same same for the "seg fault" error we got missing the operator.

He also got some exposure to the C compiler and the linux rename command ("mv").

He had fun exploring how much bacon it would produce.  One million strips worked, but a billion crashed the terminal window.  That led into a discussion about numeric representation. Discussions on the trip home got into binary representations of a character, the ASCII code and UNICODE. 

Somehow a side discussion erupted on the subject of "conservation of angular momentum" (the physics behind an ice skater spinning "slowly" and accelerates as she pulls in her limbs).

These are things not taught in school these days.  So I'm glad for this group that piques his interest into asking questions.

I wouldn't trade my Tuesday nights for the world!

No comments: