<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HardLikeSoftware &#187; Play</title>
	<atom:link href="http://hardlikesoftware.com/weblog/category/play/feed/" rel="self" type="application/rss+xml" />
	<link>http://hardlikesoftware.com/weblog</link>
	<description>The writings of John Snyders, mostly about software.</description>
	<lastBuildDate>Wed, 14 Sep 2011 04:57:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Video editing with PiTiVi</title>
		<link>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/</link>
		<comments>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 03:14:19 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[K'NEX]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=130</guid>
		<description><![CDATA[For my last video project I used Blender. It is a very capable video editor but it has a steep learning curve and is complex. I wanted something easier that I could show the kids how to use. They have had some exposure to iMovie at school. Ubuntu 10.04 (Lucid) comes with a few more [...]]]></description>
			<content:encoded><![CDATA[<p>For my last <a href="http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/">video project</a> I used Blender. It is a very capable video editor but it has a steep learning curve and is complex. I wanted something easier that I could show the kids how to use. They have had some exposure to iMovie at school. Ubuntu 10.04 (Lucid) comes with a few more video editing options than past releases. I decided to give <a href="http://www.pitivi.org/">PiTiVi</a> a try. </p>
<p>Over all PiTiVi is fairly good for such a young product. It has lots of potential to be both powerful and easy to use. The documentation is good, straight forward, and easy to understand. It does leave out some background or supplemental information which I had to figure out on my own. This is not a tutorial, just some information that may be useful to others trying it out.</p>
<p>The video project I choose is a marble timer built with K&#8217;NEX that my daughter Isabella and I made for a school project of hers last year. The video was shot with a Flip HD camera. </p>
<p><iframe width="560" height="345" src="http://www.youtube.com/embed/XlWqW96L1Hc?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>I installed the latest PiTiVi version. There really is good reason to use a newer version than the one that comes with the Lucid software sources. There are many improvements and new features. The PiTiVi download page gives instructions on how install from the Ubuntu PPA (Personal Package Archive). I used version 0.14.0-2. </p>
<p>The Flip takes nice video but the HD resolution (1280&#215;720) can make it difficult to work with on underpowered computers. I have an old Z61m ThinkPad with a 64MB ATI Mobility Radeon x1300 video card. It has no problem playing back HD video but it could not handle editing.</p>
<p>The PiTiVi documentation talks about friendly video formats. It says frame-independent compression formats such as MJPEG will perform better. I figured editing may work better if I convert my Flip video, which uses a H.264 / AVC codec to MJPEG or even uncompressed. I tried both. The uncompressed AVI files were huge and didn&#8217;t perform any better so I stuck with MJPEG. It took me a while to figure out how to convert the files. Since PiTiVi is based on GStreamer I decided to try using it. There may be other tools for this. I had to learn a lot about Gstreamer and its command line program gst-launch.  The command line I finally figured out is this (just change the src and sink file names):</p>
<p><code><br />
gst-launch filesrc location=VID00001.MP4 ! decodebin name=demux demux. ! queue ! ffmpegcolorspace ! jpegenc ! mux. demux. ! queue ! mux. avimux name=mux ! filesink location=vid0001.avi<br />
</code></p>
<p>The performance was better with these files. If there was only one clip I could scrub and play back with no problem but as soon as I added another clip the video was choppy. I could have tried reducing the resolution of the video but I really wanted the result to be in HD otherwise what is the point of taking video in HD in the first place. I decided since my video would be fairly simple and short that I could manage to edit it with choppy video.  I could advance a frame at a time to check fades and transitions. Audio playback was in real time.</p>
<p>The titles were made with GIMP. When added as a clip they are automatically turned into video.</p>
<p>The most complicated thing about my video is the timer overlay. To do this I created a solid green frame using GIMP brought it into a new PiTiVi project added it as a clip and made it 30.5 seconds long. Then I rendered this to MJPEG. This gave me a green screen video 30 and a half seconds long. Then I used the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-plugin-pango.html">pango</a> timeoverlay plugin in the following command to add the timer.</p>
<p><code><br />
gst-launch filesrc location=green.avi ! decodebin ! timeoverlay halign=right valign=bottom xpad=100 ypad=50 font-desc="serif bold 20px" ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=timer.avi<br />
</code></p>
<p>I added the resulting timer.avi file as a clip above the marble track video and used the alpha filter effect so that the green was transparent. This gives a counting timer overlaid on the marble video. All that remained was to start it when the marbles started and trim it when the last marble hit the table.</p>
<p>PiTiVI has plenty of effects. The one I wanted to use was Bulge. I would have used it on the main title screen but I wanted it to move across the screen. The effects will be much better once they can be animated over time with the key frames. Also if the pango plugin was available in the effect library perhaps I wouldn&#8217;t have needed to use a command line.</p>
<p>One problem the video has that I couldn&#8217;t find a way to fix is an audio glitch at the beginning and end of each voice over. The voice over quality in general is not that good probably due to a cheap microphone. The voice was recorded separate from the video. I used Audacity to cleanup the audio some.</p>
<p>I tried rendering in a few different formats. 1) MP4, FFmpeg PEG-4 part 2, ACC. This produced a very small file (16MB) and rendered quickly but the video quality was very poor. 2) Ogg, Theora, Vorbis. This produced very good quality video. Render time was about 20min. The file size is 187MB. 3) AVI, FFmpeg motion jpeg, ACC. The video quality was not very good the file was large (127MB) but the render time was very fast (~7min). 4) WebM, On2 VP8, Vorbis. The video quality was very good, the file was small (22MB) but it took about 44 min to render. Uploading the WebM format to youtube didn&#8217;t work so I uploaded the Ogg format. There are many other rendering options but these are the only ones I have tried so far. The audio glitch was present in all rendering formats.</p>
<p>My wish list for PiViTi:</p>
<p>The documentation should include more information on preferred video formats for editing and how to use external tools to do the conversion. Even better would be built-in tools do do the conversion.</p>
<p>The documentation should give advice on different rendering combinations. There are many containers each with different options for video and audio codecs. It would be nice to have a simplified dialog that  chooses a recommended output format based on high level choices such as what do you plan to do with the video (burn to DVD, upload to YouTube etc.) and other choices like do you prefer open standards.</p>
<p>The render dialog should remember the last folder I rendered into.</p>
<p>Here is a direct link to the <a href="http://www.youtube.com/watch?v=XlWqW96L1Hc">video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lego Climbing Robot</title>
		<link>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/</link>
		<comments>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:11:19 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[K'NEX]]></category>
		<category><![CDATA[Lego]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/</guid>
		<description><![CDATA[Way back in January I watched a Google tech talk video Lego Engineering: from kindergarten to college. The talk stresses the importance of teaching engineering in schools. A few days later at breakfast I started talking with my oldest daughter, Alexandria, about engineering and what it is that engineers do. I said that engineers use [...]]]></description>
			<content:encoded><![CDATA[<p>Way back in January I watched a Google tech talk video <a href="http://www.youtube.com/watch?v=EG-izyXfFHI">Lego Engineering: from kindergarten to college</a>. The talk stresses the importance of teaching engineering in schools. A few days later at breakfast I started talking with my oldest daughter, Alexandria, about engineering and what it is that engineers do. I said that engineers use what they know about science and how things work to find solutions to challenges. I threw out a challenge as an example: Build the tallest possible tower that fits in our house and then build a robot to climb it. It was just an example but she got really excited about the idea. &#8220;Can we build it. Can we. Can we.&#8221; she said. I said &#8220;sure&#8221;.</p>
<p>In March I posted a <a href="/weblog/2009/03/28/lego-robot-preview/">preview</a> of the robot with a picture and promises of more details to come. Its taken me way to long to finally write it up. The robot has been done since May and has made a dozen or so ascents. Making the video is what caused the delay. </p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/-WfDdsEpBX0&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-WfDdsEpBX0&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Here is what I remember of the process.<br />
<span id="more-81"></span><br />
I asked Alexandria what the tower should be made of and where is the tallest place in the house. Wood and <a href="http://en.wikipedia.org/wiki/K%27NEX">K&#8217;NEX</a> were the candidate tower materials. We had just gotten some K&#8217;NEX for Christmas so that seemed like the more interesting choice. We measured a few places in the house and found that the tallest possible place was the stairs that went from the basement to the second floor but in at least one spot it would be too narrow for a robot. The second tallest place has a ceiling fan in the way. That left the play room which has a sloped ceiling just over 11ft at its highest. We have a large Lego collection including the <a href="http://en.wikipedia.org/wiki/Lego_Mindstorms">RCX</a> so it was clear that the robot would be made out of Legos.</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/tower01.jpg' alt='Tower01' style="float:right;padding-left:1em;" /></p>
<p>One weekend morning Alexandria and I set out to build the tower. We were both new to K&#8217;NEX so we started by just playing around with different ways of connecting them. We each came up with a tower design. Alexandria&#8217;s was stronger (and looked cooler) but used more pieces. We decided to go with her design after removing some parts to conserve materials without reducing the strength. In the end we ran out of some parts so we switched to a simpler design that used parts that we still had plenty of for the top of the tower. The total height of the tower is 10ft 9in (3.28 meters). The tower has a ladder built into one of its faces for the future robot to climb.</p>
<p>Later, my other daughter, Isabella, helped build the tower base out of wood. She cut strips of wood and screwed them to a piece of scrap plywood to hold the tower steady as the robot climbed. There are no guy wires or anything else holding the tower steady.</p>
<p>With the tower complete it was time to work on the robot. I knew that this would be much more challenging than the tower but I still wanted to involve the kids as much as possible. We talked about how design ideas can come from watching other things work including nature. We acted out how people climb ladders and modeled the motion of a simple arm with Legos. I played a little with a motorized elbow and shoulder but quickly realized that it would end up being too heavy, not strong enough and use more motors than the Lego RCX can control (it has a maximum of three outputs). </p>
<p>I switched to a design that used rack gears to move an arm up and down. A quick test showed that driving the rack gear directly from the motor would not have enough power to lift the robot. Gear reduction would be needed. This was a good opportunity to demonstrate to the kids how you can trade speed for power with different size gears. </p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/motor01.JPG' alt='Climber V1 Motor' style="float:left;padding-right:1em;" /></p>
<p>The robot has two climbing arms. The left and right sides are mirror images so Alexandria and I built one side each in parallel. At this point we had a good motorized climbing mechanism with switches so that the robot controller would know when the arms were at their farthest extent either up or down. It used two motors and two switches. The arms had enough reach for the  ladder rung spacing but how it would grab and release was still an unsolved problem and turned out to be one of the hardest.</p>
<p>I used a section of the tower ladder for testing out various designs for how the robot arms would grab and release. The general principals were fairly simple. It needed a pivot and a curved or angled piece to move the hook out of the way as the arm moved up past the next rung. It would then need to snap back into place so the hook could engage the rung as the arm moved down. Selecting just the right combination of pieces that would work with the K&#8217;NEX ladder design was very challenging. I worked on this many nights without finding a solution that I thought would be robust enough. </p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/claw01.JPG' alt='Climber V1 claw' style="float:right;padding-left:1em;" /></p>
<p>I stopped working on it for a while and it might have become another uncompleted project if Alexandria hadn&#8217;t reminded us to get back to work on it. I finally came up with a design for the grabbing hook. The blue curved part and the pivot point near the rack gear allows the hook to move out of the way as it slides past the ladder rungs. Then a rubber band snaps the hook back into place. The black piece sticking up contacts a switch on the down stroke.</p>
<p>Deciding where to place the RCX programmable brick was a challenge. Putting it on top of the motors would move the center of mass too far way from the ladder, which would make it difficult for the hooks to grab on. This lead to the hinged design that allowed the robot to drive up to the tower then fold flat and hang down as the robot climbed. </p>
<p>Here is the first version of the climbing robot:</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/climberv1.JPG' alt='Climber V1' style="float:left;padding-right:1em;" /></p>
<p>With the mechanics working it was time to start programming. I like to use the text based <a href="http://en.wikipedia.org/wiki/Not_Quite_C">NQC</a> language for programming the RCX rather than the Lego Mindstorms picture based language. It is also easier to setup and use on Linux.</p>
<p>To get the kids involved we did the exercise described in the Lego Engineering video. We built a simple car and measured how far it went when the motor was turned on for one second. Then we placed a Lego minifig 4 feet from the starting line. The challenge was to figure out how long to run the motor so that the car would come as close as possible to the minifig without running it over. We had a lot of fun doing this. However, I bet it wasn&#8217;t so fun for the minfigs that got run over.</p>
<p>The program moves each climbing arm independently. There are two switches for the arms: one detects when either of the arms is all the way down and the other detects when either arm is all the way up. Because the switches are shared by both arms the program must keep track of which direction the arms are moving. If both arms are ever both up or both down there will be problems. The program counts each arm stroke and displays the count on the RCX display. It also makes a beep sound on each stroke. This beep turned out to be helpful during video editing. At start up it goes through a test cycle to make sure each arm can move all the way up and down. If something goes wrong during the startup tests it will play an alert sound and end &mdash; better to find a problem before it starts to climb.</p>
<p>While testing it became clear that more gear reduction was needed. As soon as the batteries lost more than one tenth of a volt the robot would start having trouble climbing. I added a battery voltage test at startup so it won&#8217;t climb if the battery is low. </p>
<p>Using what was learned I redesigned the robot. The gear ratio was 8 to 40 before and I added another 8 to 40. This gave a great deal of torque (and also means the robot climbs much slower). I found that if the switch or program was even a little delayed at turning off the motor it would rip the robot apart. So I did more redesign to make the switch contacts more robust and the overall structure stronger. </p>
<p>The original challenge had nothing to say about how the robot would get down or if it even would. There were plenty of details to work out just to get it to climb up but the getting down problem was in the back of my mind the whole time. While working on the hooks the general idea came to me that rubber bands would be used to pull the hooks away from the rungs while the arm moved down. The tricky part is that the same rubber bands would have to be slack on the way up. I came up with a passive mechanical design where a bar across the top of the tower would trip a lever as the robot climbed past it. This would tension the rubber bands. The lever is designed with another rubber band so that it snaps into either the up or down position and won&#8217;t stay in between. This mechanism was in the first version of the robot but it was never tested (since the robot had trouble getting to the top). This too was improved in the second version.</p>
<p>Here is what the second version of the robot looks like:</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/03/lcr001.JPG' alt='Lego Climbing Robot 01' style="float:left;padding-right:1em;" /></p>
<p>The climbing direction lever can be seen in the climb-up position. You can also tell that the motor was reversed and the extra gears added to the outside. This allowed for the extra gears to fit in a very small space. Climbing down requires a different algorithm than climbing up. A switch is used to detect when the lever is in the down position. Even with the switch I consider it a passive design because no motor is used to change the mechanical configuration. When the robot reaches the bottom the folding action causes the lever to move part way up (releasing the switch). This is how the program detects when it is all the way down. When testing the robot would sometimes stop halfway down. The reason was that any small movement of the lever could release pressure on the switch. Given the sensitivity of the switch and the delicate balance of the rubber bands the problem was best solved in software. The program requires that the switch be off for two full cycles before ending. This is why it keeps climbing for a moment when it is at the bottom.</p>
<p>This project marks the first time that I used Lego modeling software. While redesigning between the first and second versions I wanted to remember the way it was in case I needed to go back. I had wanted to try modeling software for a while. On my previous <a href="/weblog/2007/03/07/lego-marble-machine/">Lego video</a> I got some requests for how it was made. This time I have a model to share (see below for the link). The software I used is <a href="http://www.lm-software.com/mlcad/">MLCAD</a> (under <a href="http://en.wikipedia.org/wiki/Wine_(software)">Wine</a>), and LDView. This <a href="http://www.ldraw.org/GetStarted-Linux.html">site</a> is required reading for getting this stuff running on Linux. I installed LeoCAD also but in the end preferred MLCAD. I even installed Lego Digital Designer (again using Wine) but this official program does not have very many parts and is not as powerful as the others (it looks and feels like a toy). Note: I had to turn off Compiz for LDView to work (Ubuntu 8.04).</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/cockpit.jpg' alt='cockpit.jpg'  style="float:right;padding-left:1em;" /></p>
<p>Isabella and I built the cockpit together and Isabella made the minifig pilots. </p>
<p>The robot had one more problem. At the very end when the wheels would first touch the ground the robot would fall over backwards. The reason was that the car wouldn&#8217;t fold back up. I tried adjusting the car so that it stayed partially folded (like a hockey stick rather than a straight line) but this moved the center of mass so that the hooks wouldn&#8217;t grab reliably. It took me a long time to figure out a solution. After considering all kinds of ideas that would require an extra motor the simple solution can be seen in the last picture. To wheels sticking out the back of the cockpit would hit the ground first and start the car folding.</p>
<p>So now its May and the robot is done. It&#8217;s final weight is 900 grams (32 ounces). It climbs up and down flawlessly. A number of visitors get to see it but the project was always intended to include a video to share on YouTube. Here again the project stalls until November.</p>
<p>The last time I edited a video was back when I was running Windows 2000. I used Adobe Premiere 6 and After Effects. Linux doesn&#8217;t have as many video editing options as Windows. One program that I saw mentioned a number of times is Cinelerra. Unfortunately it consistently crashed after a few seconds of playing any video I loaded from my Camera. (The camera is a SANYO xacti.) I also found the Cinelerra documentation to be very poor. While looking for another program I found a forum where people were voting for their favorite Linux video editor program. Someone asked why <a href="http://www.blender.org/">Blender</a> wasn&#8217;t on the list. The response: its a 3D modeling program. There were a number of follow ups explaining that while it is a 3D modeling program it also includes a very good video editor. There was something about the responses that made me want to try it. Blender is open source and cross platform, which is great. The documentation is good and the community seems very active. There are many tutorials. The down side is that it has a steep learning curve. When you first start it up it is difficult to even find the video editor. Because of the quality documentation and tutorials I kept at it. It took several hours to get used to the program but the whole time I had the feeling that the effort was worth it &#8211; that knowing this software would be useful. I&#8217;m very happy with Blender. I found that it can do all the things that I had previously done with the Adobe products.</p>
<p>I shot a bunch of views of the robot and the tower. Then two complete runs up and down the tower. Each run was a continuous shot. I did two runs so that I could cut between them to get views from different angles. The beep the robot makes at the end of each stroke, while not intended for this purpose, helped me to sync cuts between the two shots.</p>
<p>The music for the video is from the Nine Inch Nails album <a href="http://ghosts.nin.com/">Ghosts I-IV</a>, which has a Creative Commons license. (How cool is that?) </p>
<p>The model is available as a zipped LDraw format (.mpd) file <a href="/projects/lego/climber_v2.mpd.zip">here</a>. The model isn&#8217;t 100% identical to the final robot. In some cases the part library didn&#8217;t have the exact part I used. Some details such as the rubber band connectors were left off. You can compare with the video and pictures above. The model is organized into sub models and includes some steps. It is provided as-is with no warranty. It was never tested by building the robot from scratch. The NQC program <a href="/projects/lego/climber3.nqc.zip">source</a> is also provided as-is with no warranty.  Here is a direct link to the YouTube video <a href="http://www.youtube.com/watch?v=-WfDdsEpBX0">&#8220;Lego Robot Climbs K&#8217;NEX Tower&#8221;</a></p>
<p>We hope you enjoy the video.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Scratch</title>
		<link>http://hardlikesoftware.com/weblog/2007/09/29/scratch/</link>
		<comments>http://hardlikesoftware.com/weblog/2007/09/29/scratch/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 01:26:59 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[Play]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/2007/09/29/scratch/</guid>
		<description><![CDATA[I don&#8217;t expect my kids to become programmers like their dad. I wouldn&#8217;t wish it for them unless it is what they want for themselves. Still, I think there is value in getting exposure to programming for a number of reasons &#8211; thinking logically, planning, designing, applying math, understanding how things work and fostering creativity [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t expect my kids to become programmers like their dad. I wouldn&#8217;t wish it for them unless it is what they want for themselves. Still, I think there is value in getting exposure to programming for a number of reasons &#8211; thinking logically, planning, designing, applying math, understanding how things work and fostering creativity to name a few.</p>
<p>The question is when and how to introduce kids to programming. <a href="http://scratch.mit.edu/">Scratch</a> may be the answer to how and right about now the answer to when. Scratch is a new language from the <a href="http://llk.media.mit.edu/">Lifelong Kindergarten</a> group at the MIT Media Lab designed to make it fun and easy for kids 8 and up to create programs. My kids and I found Scratch instantly compelling. Everything about Scratch, from the friendly looking cartoon cat that starts out in each new project, to the building block style programming, to the sharing of projects on the Scratch web site has been designed for and appeals to the youngest possible audience. </p>
<p>My kids are at the young end of the target age range for Scratch so I don&#8217;t expect too much programming from them at this point. The important thing is that they are really excited to use the program. They create projects to collect, edit and arrange pictures. They are interested in seeing and trying the projects that other people have created. It provides a context for me to talk to them about things like the X, Y coordinate system in terms of the number line they already know and what it is used for in moving things around on the screen.</p>
<p>Just the other night I was sitting with my youngest and she had chosen a cartoon girl sprite and a bedroom background. Then she asked &#8220;can we make her jump up and down on the bed&#8221;. I said &#8220;sure&#8221; and in a few minutes I showed her how. A block to move up. Click, a block to move down. Put them in a repeat loop, click. How many times do you want her to Jump? Twenty, OK. Oops, too fast. Click, add a wait block. Done. Then I introduced her to variables so she could control how many times the girl jumped.</p>
<p>The Scratch web site provides a social network where people (I say people because it is not just kids playing with Scratch) can share their projects and ideas. Any uploaded project can be downloaded by anyone so they can open it up and learn how it works or simply just play with it. This really fosters learning and building on the ideas of others. You will see some comments complain of copying or ripping off ideas but overall the site promotes an attitude of sharing. Knowledge and ideas are not a scarce resource to be horded and protected they are abundant and should be shared. Many people share projects that demonstrate a particular technique and encourage others to use it in their own projects. </p>
<p>I am very impressed with the projects on the Scratch web site. There are over 32,000 projects as of this writing, which is impressive since the program only came out in May of 2007. Some projects are artistic perhaps using color cycling or other graphic effects to make their pictures come to life. Some are animated stories. Some are musical. Some interactive. There are plenty of video game style projects ranging from imitations of classics like Pac-Man or Donkey Kong to original ideas. There are projects exploring science and math and many show a great deal of sophistication.  </p>
<p>The usability of the development environment is superb. It is well organized and intuitive. It is also visually attractive. What I find most impressive, for such a new product, is that it is rock solid. I used it a number of hours over the course of a week often leaving it running for days without a single crash, glitch or loss of data.</p>
<p>Programming is done by putting together statement blocks such as <img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2007/09/move_steps.png' alt='Scratch Move Block' /> and control blocks such as <img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2007/09/repeatuntil.png' alt='Scratch Repeat Block' />.  As far as I can tell it is not possible to get an error message no matter how you put the blocks together. It may not do what you want but it will not complain that you did something wrong. Feedback is immediate. Just double click a block to see what it will do. Another great feature is that you can change your program while it is running.</p>
<p>Scratch is implemented in <a href="http://www.squeak.org/">squeak</a>. When the projects are uploaded to the web site they run as a Java applet. I have noticed some differences between the behavior of my project when run in Scratch and as an applet but the differences are minor. Probably just display glitches in the Java graphics routines.</p>
<p>How about the Scratch language itself? Well from an experienced programmer&#8217;s point of view the language is extremely limited. For example, variables can only hold numbers, there are no string manipulation operations, and there are no arrays or collection data types. Not surprisingly the programs are event driven. Groups of statement or control blocks are run when the start flag is pressed, a key is pressed, when a sprite is clicked or when a message is received. Messages are broadcast and all handlers act on the message. You can define as many messages as you like. Messages cannot have arguments which is one of the most limiting things. The message handlers are the closest thing to a subroutine but because there is no argument passing all information flows through global variables. I would say that it is a strongly typed language in the sense that the round edges of a numeric value will not fit where the sharp edges of a Boolean expression are expected. Variables must be declared.</p>
<p>Simple things like prompting for a name and then outputting <code>"Hello " + name</code> is very difficult due to lack of input/output and string manipulation primitives. However things that would be complex in other environments like hit tests between two moving sprites are trivial. I had to remind myself that I am not their target audience and everything left out was probably left out for a good reason &#8211; usability.</p>
<p>I am not a big fan of graphical programming languages. I quickly got tired of the <a href="http://mindstorms.lego.com/eng/products/ris/index.asp">Lego Mindstorms</a> block programming language and switched to <a href="http://bricxcc.sourceforge.net/nqc/">NQC</a>. I found the Mindstorms programming environment to be slow, noisy, and inefficient.  All of the graphical programming languages I have ever tried I found to be far inferior to text. Scratch is no exception but it is the best interface I have see yet. I also think it is just the right thing for young kids. Having visual blocks to move around really maps well to the physical world they are used to manipulating. </p>
<p>I do hope the language gets extended. I would like to see advanced users be able to explore programming concepts such as recursion.</p>
<p>Like I said, its not just my kids that find Scratch compelling. I wanted to play with it as well. I rationalized that by learning it I would be better able to help explain it to my kids but I like creating things no matter what the medium.</p>
<p>My first project is <a href='http://scratch.mit.edu/projects/jsnyders/39620'>Addition Tutor</a>. It is an interactive program to learn and practice addition of up to 3 digit numbers. I decided on this project because of the challenge of inputing and displaying numbers in Scratch and because it is something that I&#8217;m teaching my kids now.</p>
<p><a href='http://scratch.mit.edu/projects/jsnyders/39620'><img src='http://scratch.mit.edu/static/projects/jsnyders/39620_med.png' width='425' height='319' alt='Scratch Project'></a></p>
<p>Scratch is not the first programming language with kids in mind. Way back when there was Logo and more recently <a href="http://www.kidsprogramminglanguage.com/">KPL</a>. I took a quick look at KPL and it looks like visual basic to me. Unlike Scratch there was nothing enticing me to try it out. The first thing you may ask about a language is what can I do with it. What better way to answer that question than with a web site with thousands of examples all of which you can download and try.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2007/09/29/scratch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Lego Marble Machine</title>
		<link>http://hardlikesoftware.com/weblog/2007/03/07/lego-marble-machine/</link>
		<comments>http://hardlikesoftware.com/weblog/2007/03/07/lego-marble-machine/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 03:32:00 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[Lego]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/2007/03/07/lego-marble-machine/</guid>
		<description><![CDATA[	
I don&#8217;t know what it is about this one but I like it. It sits on my desk and every now and then I turn the crank or run the motor and just watch the marbles go round. It&#8217;s fun. It&#8217;s hypnotizing. It&#8217;s pointless.
A few months ago my kids and I were building with Legos [...]]]></description>
			<content:encoded><![CDATA[<p>	<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/1WX-TYK7LJY"></param><embed src="http://www.youtube.com/v/1WX-TYK7LJY" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
<p>I don&#8217;t know what it is about this one but I like it. It sits on my desk and every now and then I turn the crank or run the motor and just watch the marbles go round. It&#8217;s fun. It&#8217;s hypnotizing. It&#8217;s pointless.</p>
<p>A few months ago my kids and I were building with Legos and making marble runs for the Geomag marbles. I started thinking about different ways to get the marbles raised up. I remembered seeing a device not too different from the one I built but made out of wood. I saw it in a craft fair years ago and although I never saw it in motion I knew what it was for and how it worked. I thought of making my own out of wood but so far have not. Think of this Lego machine as a prototype for &#8230; Well that&#8217;s a project for another day.</p>
<p>It is made out of various Lego, Technic, and Mindstorms kits except for the metal Geomag marbles. The yellow and green rails are from one of the Mindstorm add-on kits. There is no programming to this one. The programmable brick simply runs the motor which I turn on with the remote control. Alexandria and Isabella made the minifigs and Yoda&#8217;s hut. I added them to the video to liven it up.</p>
<p>I have wanted to try out YouTube for a while now and sharing the marble machine seemed like a good way to do it. I&#8217;m no musician but I think it is important for videos to have a sound track. For my home videos I usually use music from my CD collection. But because this one was going public I decided to see what <a href="http://creativecommons.org/">Creative Commons</a> had to offer. From there found <a href="http://www.sectionz.com/detail.asp?SZID=24787&#038;rType=mp3">&#8220;Fault in the air&#8221;</a> by DJFer. The video was made with my old Sony digital 8MM camcorder. For editing I use Adobe Premiere.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2007/03/07/lego-marble-machine/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

