Monday, May 02, 2011

Lesson Planning

Some programmers new to Python do not understand how a two dimensional array might be implemented simply as nested lists. The "outer list" forms your rows and the members of that list, themselves lists, define the columns. I used to go back and forth with Bernie Gunn on that one, the 70+ year old geochemist who flew his own plane in New Zealand, had cut his teeth on Pascal.

Whereas years of grade-school drill in this biases, such as to put (0,0) either in the middle or lower right, the way printers and typewriters work, by typing against an advancing scroll, suggests the first row will end up at the top of the page. Ding, carriage return. Old typewriter noises. So (0,0) tends to mean "upper left) and (1,0) is one row down, far left margin if you read left to right, possibly far right margin if you read right to left.

The Tractor is similar enough to a Turtle to be imported as such, but the field it plows is simply a two-dimensional array with a simple ASCII representation. Mentally, students are starting to think in terms of a GUI canvas, but in terms of working the server, we're keeping the processes fairly lightweight. The REPL buffer stays reasonable unless students create vast fields (of soybeans), like in Brazil.