Programming for absolute beginners
Apr. 26th, 2012 02:07 pmI just had to lead a one hour programming lesson for a small group of 14 year old girls who know nothing about programming.
So what I did was I've taken a Qt snake game demo (very similar to a game installed on many Nokia phones), removed few lines from a Javascript file that contains the games logic (Qt/demos/declarative/snake/content/snake.js), and guided students in re-creating the parts I removed.
I only explained that we have two sets of Cartesian coordinates (one for human, one for AI player) which we can alter each time tick, and told them they can use assignments and checking conditions with <, >, ==.
I think this is a very visually appealing and interesting exercise with easily adjustable complexity.
diff is under cut.
( Read more... )
Three places to check are marked with FIXME. First place is logic to move a snake, good to start. Second is a hack to make it easier to debug.
Third is the really interesting part, because here students can invent a strategy, algorithm and code for AI player. The girls I worked with, who had never programmed before, managed to write an AI player that chases and catches human one :) It was running on a netbook and CE4100 Atom based set top box
So what I did was I've taken a Qt snake game demo (very similar to a game installed on many Nokia phones), removed few lines from a Javascript file that contains the games logic (Qt/demos/declarative/snake/content/snake.js), and guided students in re-creating the parts I removed.
I only explained that we have two sets of Cartesian coordinates (one for human, one for AI player) which we can alter each time tick, and told them they can use assignments and checking conditions with <, >, ==.
I think this is a very visually appealing and interesting exercise with easily adjustable complexity.
diff is under cut.
( Read more... )
Three places to check are marked with FIXME. First place is logic to move a snake, good to start. Second is a hack to make it easier to debug.
Third is the really interesting part, because here students can invent a strategy, algorithm and code for AI player. The girls I worked with, who had never programmed before, managed to write an AI player that chases and catches human one :) It was running on a netbook and CE4100 Atom based set top box