PyoLogo

From OLPC
Revision as of 01:43, 13 January 2007 by Xavi (talk | contribs) (→‎LOGO words supported: more compact table (may undo if don't like it))
Jump to navigation Jump to search

PyoLogo [pie-o-logo] or PYthon Open Logo is an implementation of the Logo programing language created on top of Python. It grew out of Arnan (Roger) Sipitakiat's thesis project at the MIT Media Laboratory. PyoLogo consists of a casual Logo interpreter and a simple IDE.

Screenshot01.jpg
Screenshot02.jpg
Screenshot03.jpg

Current Status

Since PyoLogo is currently thesis software, it is far from being a complete product. Here is a list of things it can and cannot do.

Available features

  • Logo Primitives. Supports a subset of Logo primitives. See the command list below. More commands will be added as development progresses.
    • Most of the Turtle Geometry (drawing) primitives are available.
    • List and list manipulation commands
    • Common control flow. If, ifelse, repeat, etc
    • Variables. Using the 'make' command and some other alternatives
    • Mathematical operations. sin, cos, tan, sqrt, etc
  • Supports multiple procedures with parameter passing and procedure output
  • Multi-threaded. I.e. the 'launch' and 'forever' commands creates a new background process
  • Support turtle shapes

Thesis Features

There are some non-traditional features built into PyoLogo for the thesis work form which it was created. Here are some that could perhaps be useful.

  • Robotics. PyoLogo can receive sensor input and control actuators via the GoGo Board. Since OLPC will have a sensor input through its microphone jack, this feature can be adapted to make use of this possibility.
  • Line objects. These are slider-like objects that can be used to track a turtle's position or visualize a sensor value.
  • Variable history. Every variable keeps a record of its previous values. It can be used to calculate the rate of a variable (i.e. position -> speed) or for debugging purposes.

Issues and missing items

  • Performance. PyoLogo currently runs very slowly on OLPC machines. This is based on the A test boards
  • Still some UI issues under Linux
  • Bugs are plentiful. It still needs extensive testing.
  • Error reporting. Errors in the Logo programs are not well reported. This makes it difficult for the user to debug their Logo program
  • No multimedia support. No sound, no video, no text box, no drawing tools
  • No UI widgets for the user program. No buttons, checkboxes
  • No multiple page support

Download

The author is currently preparing the source code to be uploaded into OLPC's code repository. Once this is done, a public release of the software will become available.

The Logo Interpreter

Although PyoLogo tries to conform with other Logo implementations, it contains some rather unconventional properties.

  • Not space delimited. 'Show 1+1' works in PyoLogo whereas most other Logo interpreters do not except this. Logo normally requires spaces between every token. So, only 'Show 1 + 1' would work. Although the uniformity of the Logo language is broken when space becomes optional, the author believes it is a worthwhile trade off. Kids too often becomes frustrated or annoyed by the strict requirement for space.
  • Multiple ways to manipulate variables. The author finds Logo's 'make' primitive unnecessarily complicated for children. The 'set' method is perhaps a better way to go. PyoLogo supports both. For example:
make "counter 0
make "counter :counter + 1
show :counter

The following alternative is also available

global [counter]

setcounter 0
setcounter counter + 1
show counter
  • Object oriented properties as a shortcut for 'ask.' For example, a typical logo command to vertically align one turtle to another would be:
t1, setx ask "t2 "xcor

PyoLogo allows a dot format for accessing a turtle's property.

t1, setx t2.xcor

Both the traditional and shortened approaches are supported in PyoLogo.

LOGO words supported

LOGO keyword list
Letter Implemented Partially Missing
A abs, and, arccos, arcsin, arctan, ascii ask announce, answer
B bf (butfirst), bk (back), bl (butlast) bg, bottom
C cc, cg, char, cos, count cancel, carefully, chdir, clean, clearname, clearnames, clickoff, clickon, color, colorunder, creatprojectvar, currentdir
D distance difference, directories, dolist, done?, dotimes
E exp empty?, equal?, erfile, errormessage, everyone, exporttext
F fd (forward), first, forever files, fill, fontsize, fput, freeze, freezebg
G get, getpage, getproject, glide, greater?
H heading, ht home
I if, ifelse, int identical?, importtext, infront, item
K key?
L last, launch, list, ln, log, lt (left) less?, let, list?, listen, loadpict, loadshape, loadtext, local, lput
M make, mousepos member?, minus
N not name, name?, names, newbutton, newpage, newprojectsize, newturtle, note, np (namepage), number?
O op (output), or opaque
P pd, pensize, pi, pos, pu pagelist, parse, pick, power, pr (print), presentationmode, product, projectlist, projectsize, projectvars
Q question, quotient
R random, readchar, repeat, resett, round, rt (right) remainder, remove, rerandom, rest, restore, run
S setc (setcolor), seth (setheading), setpensize, setpos, setx, sety, show, sin, sqrt, st, stamp, stopall savepict, saveproject, saveshape, savetext, se (sentence), set, setbg, setinstruction, setinstrument, setsh (setshape), setsize, shape, size, startup, stop, stopme, sum
T tan, timer, touching?, towards thing, tto (talkto), turtlesown
U unfreeze, unfreezebg
W wait, waituntil when, who, word, word?
X xcor
Y ycor