Monday, February 09, 2009

Turtle Lander


For TurtleArt in its current experimental fork, TurtleArtPortfolio on the OLPC. Use the a s d keys to fire the thrusters. Keys do not auto-repeat.


Issues
Execution speed is becoming an issue, each block adds 2-5 mS, the print adds 25mS, the wait 1, which is necessary to see the turtle, adds 10mS.
The area of the canvas limits how big a program you can create, is it worth adding scroll bars?
Dragging the stack of blocks is starting to become slow.
It is not possible to test if a key is held down.

Timing program execution
I used the following TA program to time the execution time of each block. It uses the clock() Python function from the time library.


block milliseconds
nothing** 0.21ms
clean 20*
forward 0 3.37
left 0 2.5
arc 0 0 4.99
setxy 0 0 3.35
seth 0 2.3
store in box1 xcor 1.49
text 16 5.23
pen down 0.82
set pen size 0 1.27
set color 0 1.47
set text color 0 1.42
fill screen 0 0 20*
store in box1 pensize 1.5
store in box1 0+0 2.36
store in box1 1/1 2.33
store in box1 random 0 100 3.09
query kyb 1.0
store in box 1 keyboard 1.56
store in box 1 x x=1 2.85
store in box 1 volume 7*
repeat 1 2.02
if 1=1 3.74
hor or vert spacers 0.8
variable = 1 1.61
push 0 1.23
store in box1 pop 1.6
show heap 23
empty heap 0.9
hide blocks 300

*timer unreliable
**timer overhead-subtract from others

Labels: , , ,

3 Comments:

Blogger walter said...

And I thought I was the one completely over the top :)

Do you have any screen shots of the game itself?

-walter

Tuesday, February 10, 2009 11:54:00 PM  
Blogger Tony Forster said...

Walter
Screenshot added. Unfortunately its very plain, not enough canvas or execution speed to add nice graphics.

Wednesday, February 11, 2009 9:07:00 AM  
Blogger Tony Forster said...

By TurtleArtPortfolio V18, the S key is no longer available for the vertical thruster andanother would need to be used. Apparently the following shortcuts are implemented:

r run
w walk
s stop
b blocks show/hide
p pallet show/hide
e erase screen

Thursday, March 05, 2009 9:16:00 PM  

Post a Comment

<< Home