I have been trying really hard to stay focused on my robotics project, but I think I am going to have to take a detour for a little while.  I keep trying to tell people that learning to program is fun and that it isn't hard, but when they ask me where to start and I tell them about html+javscript or using rvm to install ruby it actually starts to sound pretty hard.

So I have been thinking about the best way to learn to program.  The answer of course is to find a project that is fun and start working on it.  So I thought of this idea of a free AI service.

Imagine you can go to a website and click one big button to get started.  In your browser you can write some simple procedural ruby to make a move in a game of tic-tac-toe.  Then you can hit a run button and see your code play against some AI provided by the website.  There could be some guides to making your AI incrementally smarter and eventually you could write the client locally on your machine and have it connect directly the server to play.

The things I love about this idea are:

  • One beautiful language (Ruby of course)
  • Low barrier to entry
    • Play a game and watch it rendered in a single browser window
    • Incrementally add complexity to your AI
  • Interactive
    • Something more interesting than "hello, world" in a console
    • Competive drive to win
  • Plenty of games that can be implemented pretty easily
    • Tic-tac-toe
    • Connect 4
    • Checkers
  • Potentially more difficult games that can be used as code katas or koans (http://codekata.pragprog.com/ -  http://rubykoans.com/)
    • realtime racing game
    • tanks wars type game

Things I'm not sure about:

  • Can I even run ruby code in a browser?
  • Can I safely push in back to the server and execute it there? (tryruby.org)
  • Use websockets to allow the code in the browser to play the game?
  • Use eventmachine to handle the hosting of the game and writing the site-provided AI?
  • Competitions where players or teams can log into a game and compete?

So what do you think? Is this feasible? It certainly sounds like fine and something that I could use with a group of highschoolers to get kids excited about programming.  What challenges am I not thinking about yet?


Funny. I've been thinking of a similar idea but came up with a battle arena where you code up your own contestant and uploaded him to fight other contestants or AIs.

Have you seen http://rubymonk.com? They let you write and execute ruby as you walk through learning Ruby.