title: What is the coolest thing you can do in <10 lines of simple code? Help me inspire beginners!
body: <p>I'm looking for the coolest thing you can do in a few lines of simple code.  I'm sure you can write a <a href="http://mcfunley.com/cs/blogs/dan/archive/2007/12/25/1532.aspx" rel="nofollow noreferrer">Mandelbrot set in Haskell in 15 lines</a> but it's difficult to follow. </p>
  
  <p><strong>My goal is to inspire students that programming is cool</strong>. </p>
  
  <p>We <em>know</em> that programming is cool because you can create anything you imagine - it's the ultimate creative outlet.  I want to inspire these beginners and get them over as many early-learning humps as I can.</p>
  
  <p>Now, my reasons are selfish.  I'm teaching an <em>Intro to Computing</em> course to a group of 60 half-engineering, half business majors; all freshmen.  They are the students who came from underprivileged High schools.  From my past experience, the group is generally split as follows: a few <a href="http://www.google.com/#hl=en&amp;safe=off&amp;q=Rockstar+Programmers&amp;fp=WnpED7D_IvM" rel="nofollow noreferrer">rock-stars</a>, some who try very hard and <em>kind of</em> get it, the few who try very hard and <em>barely</em> get it, and the few who don't care.  I want to reach as many of these groups as effectively as I can. Here's an example of how I'd use a computer program to teach:</p>
  
  <blockquote>
    <p>Here's an example of what I'm looking
    for:  a 1-line VBS script to get your
    computer to talk to you:</p>
  
  <pre><code>CreateObject("sapi.spvoice").Speak InputBox("Enter your text","Talk it")
  </code></pre>
    
    <p>I could use this to demonstrate order
    of operations.  I'd show the code, let
    them play with it, then explain that
    There's a lot going on in that line,
    but the computer can make sense of it,
    because it knows the rules.  Then I'd
    show them something like this:</p>
  
  <pre><code>4(5*5) / 10 + 9(.25 + .75)
  </code></pre>
    
    <p>And you can see that first I need to
    do is (5*5).  Then I can multiply for
    4.  And now I've created the Object.  Dividing by 10 is the same as calling
    Speak - I can't Speak before I have an
    object, and I can't divide before I
    have 100.  Then on the other side I
    first create an InputBox with some
    instructions for how to display it. 
    When I hit enter on the input box it
    evaluates or "returns" whatever I
    entered.  (Hint: 'oooooo' makes a
    funny sound)  So when I say Speak, the
    right side is what to Speak.  And I
    get that from the InputBox.</p>
    
    <p>So when you do several things on a
    line, like:</p>
  
  <pre><code>x = 14 + y;
  </code></pre>
    
    <p>You need to be aware of the order of
    things.  First we add 14 and y.  Then
    we put the result (what it evaluates
    to, or returns) into x.</p>
  </blockquote>
  
  <p>That's my goal, to have a bunch of these cool examples to demonstrate and teach the class while they have fun.  I tried this example on my roommate and while I may not use this as the first lesson, she liked it and learned something.</p>
  
  <p>Some cool <a href="http://reference.wolfram.com/legacy/v5/Tour/WritingProgramsInMathematica.html" rel="nofollow noreferrer">mathematica programs that make beautiful graphs or shapes</a> that are easy to understand would be good ideas and I'm going to look into those.  Here are some <a href="http://www.25lines.com/" rel="nofollow noreferrer">complicated actionscript examples</a> but that's a bit too advanced and I can't teach flash.  What other ideas do you have?</p>