It contains just 50 different words: a, am, and, anywhere, are, be, boat, box, car, could, dark, do, eat, eggs, fox, goat, good, green, ham, here, house, I, if, in, let, like, may, me, mouse, not, on, or, rain, Sam, say, see, so, thank, that, the, them, there, they, train, tree, try, will, with, would, you.
A great beginners book, because it's a full story teaching a number of other concepts using a limited amount of words. It's a clever bootstrapping hack to language learning. Apart from all its cleverness, it's a fun & entertaining read too! :)
So you want to teach some newbies how to be l33t python pygame pr0grAmm3rs? Maybe Sam I am, and Green Eggs and Ham have something to teach us, the teachers?
Let's reduce the number of concepts!
Classes, packages, and even functions are hard to get right away. As in the first 10 minutes of teaching something to someone it's hard anyway. Some people may get your car metaphors, and your nonsense about Ducks quacking like ducks... but others will look at you blankly. Then that snotty nosed brat at the back of the class will start texting rude words about how you are a poo poo head, and it's GAME OVER.
However, there are two parts to these concepts. Creating them, and just using them.
Here is an example pygame program using functions, packages, and classes... but not creating them. This requires less knowledge to start doing something.
|Press r for red.|
import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((640, 480)) message = "Press q to quit, b for blue, r for red." pygame.display.set_caption(message) going = True while going: events = pygame.event.get() for event in events: print (event) if event.type == KEYDOWN and event.key == K_q: going = False if event.type == KEYDOWN and event.key == K_b: screen.fill(Color("blue")) if event.type == KEYDOWN and event.key == K_r: screen.fill(Color("red")) pygame.display.flip()
This displays quite a number of perhaps confusing concepts, but removes a few of the complex concepts.
|Watch ALL the events printed out!|
Notice how there are no functions declared, no classes created, and no packages declared. There's also no "Reactor", or callbacks required for the events. It's just importing (which is boiler plate).
By reducing the set of concepts needed to understand the code you will have an easier job teaching it.
|Press b for blue!|
(* I don't like Green Eggs and Ham. I don't like them here or there. I don't like them anywhere.)
q for quit.