[Tutor] Interview questions in python and wxpython

Alan Gauld alan.gauld at btinternet.com
Sun Jan 20 01:49:12 CET 2008


"Ricardo Aráoz" <ricaraoz at gmail.com> wrote

> Anyway the program is obvious:

Not to me :-)

> label1
> Move one car's length fwd
> If car is next to a parachute Goto label2
> do nothing
> goto label1
>
> label2
> Move one car's length fwd
> goto label2

Very clever, but in the interests of readability I'd change
the labels and structure slightly:

GoSlow: move right
             do nothing
             if car next to 'chute goto GoFast
             goto GoSlow

GoFast: move right
             goto GoFast

Interesting example, thanks Bob.

Alan G.




More information about the Tutor mailing list