[MWForum] to advance the turtle
Wendy Petti
mwforum@lists.mathcats.com
Sun, 12 Jan 2003 21:39:05 -0500
I've uploaded Jacques' "diriger" project with minor modifications: to
make the arrow keys responsive on a Mac keyboard as well as a PC
keyboard, I've added four commands to the "pilote" procedure, like this:
to pilote
make "comm ascii readchar
if :comm = 38 [seth 0]
if :comm = 39 [seth 90]
if :comm = 40 [seth 180]
if :comm = 37 [seth 270]
if :comm = 30 [seth 0]
if :comm = 29 [seth 90]
if :comm = 31 [seth 180]
if :comm = 28 [seth 270]
if :comm = 32 [
ifelse get "t1 "on? [setc 15 clickoff][setc 55 clickon]]
end
The procedures for activating and deactivating the turtle remain
unchanged:
to avanti
forever [pilote]
t1, setinstruction [forever [fd 5 wait 1]]
setc 55 ;;if you want !
clickon
end
to basta
t1, setinstruction []
setc 9
stopall
end
(Remember that with MW Pro you might need to click on the background of
the page before the turtle will respond to key commands.)
The project is on the attachments page:
http://www.mathcats.com/mwforum/attachments.html
I've also uploaded Jeff's minor bug fix to the attachments page; it is
now LINEWEAVERv1-04a.
Wendy
> -----Original Message-----
> From: mwforum-admin@lists.mathcats.com
> [mailto:mwforum-admin@lists.mathcats.com]On Behalf Of Jacques Mathil
> Sent: Sunday, January 12, 2003 10:51 AM
> To: mwforum@lists.mathcats.com
> Subject: Re: [MWForum] to advance the turtle
>
>
> Hi Azim,
> Here is another example on how to control turtle with
> keyboard. It is based
> on the parallelism of processes.
> If I remind, the trick for scaning the keyboard (readchar)
> was explained by
> Wendy a time ago, and could be extended to other keys. I dont
> know if ascii
> codes for specials characters (b.e. arrows) are the sames on
> US QWERTY as
> on Swiss QWERTZ keyboards. (verify with command "show ascii readchar")
....
>
> Jacques Mathil
> Geneva, Switzerland
> mathil-j@bluewin.ch
> jacques.mathil@edu.ge.ch
>