When I grew up, I learned to program by typing in BASIC code from the back of magazines and from books I found at the library. There doesn’t seem to be anything like that anymore, but I think it’s a great way to learn so I’m proposing we bring that back, but use modern languages like Python and Ruby to write simple games.
I’m talking about things like this:
http://www.atariarchives.org/basicgames/showpage.php?page=36
The kid types the game, and he or she then gets to play it. Great for 4th-6th graders just getting started. Even greater for parents and teachers to use in class.
I think we need to keep it simple. I’m going to do my examples in very basic Ruby, although it would be nice to see Python too. If we get enough contributers, maybe we do this in two parts, or we do each program in multiple languages.
You can download a stable copy from
http://www.napcs.com/files/programmingforkids/
We’ll build a new copy once every few days.
Once we have serious contribution and we’ve done editing, we’ll do a formal launch.
Fork this, write a chapter and commit it to the repository. That’s it. Please please please make your commits self-contained if possible. Send me a commit I can merge in. Don’t modify book.xml or any of the other files in your commit, or at least check in your files into a separate commit I can easily snag. Otherwise send a patch I can apply. That workflow might look like this:
git checkout -b my_chapter git commit -a -m "I made an awesome Battleship game in Ruby!" git checkout master git pull git checkout my_chapter git rebase master git format-patch master --stdout > my-chapter.diff
and email it to bphogan at gmail.com and I’ll get it applied. Since it’s signed, you’ll get credit in the logs.
If you know Docbook, great. Write a chapter using the sample chapter as a template and hook it up in the book.xml file. If you don’t, just write it as a text file and someone else can convert it. Put it in the plaintext_chapters folder. If you commit a chapter, I’ll add you to the main repo as a committer.
Think of small simple games that you ca do, like Craps, Blackjack, a slot machine, rock-paper-scissors, maybe even a simple text adventure. Graphical games are cool too, and so are math games. Be imaginative, but keep it simple. You don’t even really need to explain the concepts if you don’t want to - just let the kids type in the code and run it. And don’t steal code from somewhere else. Nobody wants to get sued.
We’ll also need people to test and verify and review stuff that’s been submitted.
Use para
for paragraphs, and sect1
, sect2
, and sect3
for section hierarchies.
<sect1> <title>Overview</title> <para>This is a paragraph.</para> <sect2> <title>This is a subsection</title> <para>This is a paragraph in the subsection.</para> </sect2> </sect1>
Use programlisting
for source code.
<programlisting language="ruby"><![CDATA[ puts "Hello there. What is your name?" gets name puts "Hello #{name}! Nice to meet you!" ]]></programlisting>
Use screen
to show screen output.
<screen> Hello there. What is your name? Brian Hello Brian! Nice to meet you! </screen>
You can include a screenshot with this markup
<figure xml:id="fig."> <title></title> <screenshot> <mediaobject> <imageobject> <imagedata fileref="" align="center" width="" /> </imageobject> <caption><para>Your caption</para></caption> </mediaobject> </screenshot> </figure>
Put images in the images/png folder in a subfolder with the same name as your chapter.
This will build using the Short Attention Span Docbook chain (github.com/napcs/docbook) or pretty much any other docbook system that uses Docbook 5. Oxygen’s built-in system seems to work just fine. I’ll try to set up a continuous integration system somewhere in the future once there’s some serious content, and I’ll build frequent copies and link them here. Once there’s significant content, we’ll do a formal launch of the book.
Let’s leave this completely open. The book’s content is licensed under Creative Commons.
The source code must be licensed under the MIT license. We won’t commit anything that’s not.
Copyright © 2010. For explicit copyrights, see credits.xml.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.