;KW Melvin wrote:- >WoW! >I just figured out how to copy a post to a file >and load it into UCBLogo! Am I impressed >or what? Awesome! I think I've come to the >right place. I've just started working through >Harvey's CSLS series. Incredible! The best >kept secret on the Net is Logo. ;Hello KW Melvin ;Yes you are right. Logo is an Incredible language. Some pepole like ;to call it a language for kids and they are right. some pepole say ;it is a language for explorations and they are right.I consider it ;a language for the clear minds. ;You Will meet on this list a group of marvellous pepole. Let me inform ;you about just a few of them. ;Brian Harvey: the creator of UCBLogo the only free logo to my knowledge. ; : who works at UCB. IN%"bh@anarres.cs.berkeley.edu" ;George Mills: who had ported UCBLogo to MSWLogo with many extensions. ; : the owner at softronix IN%"mills@softronix.com" ;Yehuda Katz : a serious code critic and a member of the fuculty of ; : of teachers in Beitberl IN%"Yehuka@beitberl.ac.il" ;Olga Tuzova : a Ph.D. in Mathematics and a teacher in Sant Peiterburg ; : IN%"olgatu@ort.spb.ru". ; ;And you will meet with many many nice pepole on our group; to whom I owe ;much for most of my Logo knowledge. ; ;Since You are new to Logo let me attatch my favorite demo. The code ;for the famous Towers of Hanoi (usually taught in AI) This code was a ;demo for the "IBMLogo ver. 1 of 1983 " which had never had a second ;release. I reworked that code to run under UCBLogo. Also you can find ;a version which I wrote to run under MSWLogo (thanks to the help of ;George Mills),in Logo Archives. ;With my Best Regards. :Mhelhefny ;----------------------------------------- TO 3STICKS PU setpensize [27 27] SETY -150 setx -400 pd setx 400 setpensize [4 4] setx 260 fd 360 bk 360 setx 0 fd 360 bk 360 setx -260 fd 360 bk 360 pu SETXY -70 240 pd LABEL [THE TOWERS OF HANOI] pu SETXY -285 -205 pd LABEL [START] pu SETXY -35 -205 pd LABEL [SPARE] pu SETXY 250 -205 pd LABEL [GOAL]pu setxy -70 -217 pd label (se "recoded "by "Mhelhefny)pu SETxy -260 -150 END TO ADD :STICK MOVETO :STICK FD 30 PENPAINT DISQ :THIS MAKE :STICK SE :THIS :DSK END TO COLOR :N OP ITEM :N [7 6 3 5 4 12 2 1 29 10 11 13] END TO DESCRIP CT TS SETCURSOR [30 2] PR [THE TOWER OF HANOI] SETCURSOR [20 5] PR [The puzzle begins with a "tower "] SETCURSOR [20 6] PR [of discs arranged in order of size] SETCURSOR [20 10] PR [The task is to move them one by one] SETCURSOR [20 11] PR [from the Start pole to the Goal one] SETCURSOR [20 15] PR [It is not easy, even the computer] SETCURSOR [20 16] PR [takes a while to do it] SETCURSOR [20 18] pr [input no of disks ? :] SETCURSOR [20 19] type [ ( 10 maximum )] type char 9 make "num rw SETCURSOR [20 20] pr [input slow factor ? :] SETCURSOR [20 21] type [ (0 ,2 ,3 ,30.)] type char 9 make "delay rw pr :delay END TO DISKS :SMALL :BIG IF :SMALL > :BIG [SETY -150 STOP] IF :BIG = :NUM [FD 20] FD 10 PENPAINT DISQ :BIG DISKS :SMALL :BIG - 1 END TO DISQ :SIZE SETPC COLOR :SIZE MAKE "SIZE :SIZE * :FACT SETPENSIZe [27 27] LT 90 FD :SIZE BK :SIZE * 2 FD :SIZE RT 90 setpensize [4 4] FD 20 MAKE "CC FIRST BUTFIRST PEN IF :CC = "ERASE [SETPC 3 PENPAINT BK 28] PU END TO ELIM :STICK MOVETO :STICK MAKE "THIS FIRST :DSK PENERASE DISQ :THIS MAKE :STICK BF :DSK END TO go CT CS setpc 3 DESCRIP make "fact 122/ :num CS FS 3STICKS DISKS 1 :NUM MAKE "CO 0 MAKE "S2 [] MAKE "S3 [] MAKE "S1 SEQUENCE :NUM HT HANOI :NUM "S1 "S2 "S3 CT PR (SE [IT TOOK] :CO [MOVES FOR] :NUM "DISCS) WAIT 30 PR [Press a key to play , or esc to quit] MAKE "DUMMY RC IF :DUMMY = CHAR 27 [CS HT CT STOP] go END TO HANOI :NUM :START :SPARE :GOAL IF :NUM = 0 [STOP] HANOI :NUM - 1 :START :GOAL :SPARE WAIT :delay MOVE.ONE :START :GOAL if keyp [throw "toplevel] WAIT :delay HANOI :NUM - 1 :SPARE :START :GOAL END TO MOVE.ONE :FROM :TO MAKE "CO :CO + 1 ELIM :FROM ADD :TO END TO MOVETO :STICK SETX (BF :STICK) * 260 - 520 MAKE "DSK THING :STICK SETY 30 * (COUNT :DSK) - 150 END ;--------------------------------------- --------------------------------------------------------------- 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