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

LOGO-L> Re: Property lists?



Hi fajoy@uio.satnet.net

Here's an example of a program with Property Lists. It's written in
UCBLogo. It will not run on MSWLogo (MSWLogo doesn't support some of the
commands used in the program). With slight modifications it could be
written with arrays instead of Property Lists.

Here's my code:

=====================================================
to main ; Swim Competition
cleartext textscreen
directions
build
end

to directions
setcursor[6 0] pr standout[Swim Competition]
repeat 27[type char 246]
pr " pr "
pr[Ten swimmers, numbered 0-9,]
pr[jump into the pool.]
pr "
pr[Hit any key to start.]
ern readchar                      ; wait for any key
end

to build
for[i 0 9][pprop "race :i 0]            ; initialize
for[i 0 9][pr :i]                       ; start line
ct do random 10              ; select random swimmer
end

to do :current
setcursor se gprop "race :current :current
type word ". :current
pprop "race :current -1+first cursor
if(first cursor)>77[        ; arrived to finish line
   announce stop]
do random 10                 ; select random swimmer
end

to announce
setcursor[26 11] (pr[The winner is No.] :current)
setcursor[17 23] 
pr standout[Esc to quit, any key to run it again]
ifelse readchar=char 27[stop][build]
end
=====================================================

After running it, say POALL and look at the bottom of the screen.

Enjoy it,

[[Yehuda]]

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home