[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [kidsgames] SMLUC on Kidsgames/Logo



On Sun, Oct 31, 1999 at 11:50:47PM -0600, cwaddell@mail.orion.org wrote:
> Logo
> 
> Jeff's idea for logo, is to have it set up with simple
> controls, such as go right, go left, go up, turn, etc.
> 
> This will draw on the screen, kind of like spiralgraph or
> turtle.  
> At the SAME time, the code for creating this picture will
> appear in a window next to the drawing.  We hope that the
> users will get tired of the simple controls, and move into
> programming.  An early foundation in basic programming logic
> should help them move into other programming languages.

Well, UCBLogo doesn't have great graphics.  But this implements the 
classic pre-logo excersize of using f/b/r/t to control the mouse,
with the addition that it prints commands (and then puts them into
a variable called :i).  It can also compact them, redraw them, and
make a design from them.  I'm sure there are tons of other amusing
controls/etc. that it could do.

Any Logo, and potentially one with a better graphical interface,
can do this pretty easily.  This version does a crude form.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Draw -- allow interactive drawing and save/print code to regenerate
;;         the drawing.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

TO DRAW
 localmake "quitflag "false
 local "k

 resetdraw

 while [not :quitflag] [
  make "k rc
  if :k = "q [make "quitflag "true print "\]]
  make "in []
  if :k = "f [make "in [fd 10]]
  if :k = "b [make "in [bk 10]]
  if :k = "r [make "in [rt 30]]
  if :k = "l [make "in [lt 30]]
  if :k = "c [clearscreen cleartext make "i []]
  run :in
  make "i sentence :i :in
  (type :in "\ )
 ]
END

; redraws whatever you made with DRAW
TO REDRAW
 run :i
END

; makes a spirograph-sort-of-thing out of what you DRAWed
TO SPIRO
 ht
 localmake "t 0
 cs
 repeat 36 [rt :t run :i pu home pd make "t :t + 10]
 st
END

; compacts the output of DRAW
TO COMPACT
 (local "inst "inp)
 localmake "lastinst []
 localmake "lastinp []
 localmake "ti :i
 make "i []
 while [not empty? :ti] [
  make "inst first :ti
  make "inp first butfirst :ti
  make "ti bf bf :ti
  ifelse :lastinst = :inst [
   make "lastinp (:lastinp + :inp)
  ] [
   make "i (se :i :lastinst :lastinp)
   make "lastinst :inst
   make "lastinp :inp
  ]
 ]
 make "i (se :i :lastinst :lastinp)
END
  


to resetdraw
 cs
 ct
 make "i []
 type "\[
end






---------------------------------------------------------------------
| Ian Bicking                 |  bickiia@earlham.edu                |
| 4869 N. Talman Ave. Apt. G  |  http://www.cs.earlham.edu/~bickiia |
| Chicago, IL 60625           |                                     |
---------------------------------------------------------------------
-
kidgames@smluc.org  -- To get off this list send "unsubscribe" in the
body of a message to majordomo@smluc.org