Einzelnen Beitrag anzeigen

Benutzerbild von Die Muhkuh
Die Muhkuh

Registriert seit: 21. Aug 2003
7.332 Beiträge
 
Delphi 2009 Professional
 
#6

Re: Die Programmiersprache LOGO

  Alt 11. Feb 2005, 14:28
Hier mal ne LOGO-Procedure:

Code:
pr putdisk :tnum :dnum :state
;
; Called by HANOI to put a disk on a tower.
; first arg. is number of tower (1,2 or 3)
; second arg. is number of disk to draw (1 is smallest)
; third arg. is "final, "temp, or "erase depending on whether
;  disk is drawn in final state, in temporary state to indicate
;  motion, or is being erased (removed from this tower)
; Note that this procedure re-draws the tower correctly.
;
local "tc
local "halfsize
make "tc towercnt :tnum
make "halfsize sum 20 product :dnum 10
pu
ifelse :tnum = 1 ~
   [setxy "-240 "-100] ~
   [ ~
   ifelse :tnum = 2 ~
      [setxy "-15 "-100] ~
      [setxy 210 "-100] ~
   ]
pe
fd product 30 :tc
pu
setxy xcor - :halfsize ycor
pd
penpaint
ifelse :state = "final ~
   [setpencolor [0 255 0]] ~
   [ ~
   ifelse :state = "temp ~
      [setpencolor [0 0 255]] ~
      [pe] ~
   ]
fd 30
rt 90
fd product :halfsize 2
rt 90
fd 30
rt 90
pu
fd :halfsize
rt 90
setpencolor [255 0 0]
ifelse :state = "erase ~
   [ ~
   pd ~
   penpaint ~
   fd 30 ~
   ] ~
   [ ~
   pe ~
   fd 30 ~
   ]
ende
Was mich schon an würde ist immer diese Tilde-Zeichen ( ~ ).

Die Programmoberfläche ist genau so kack^^.
  Mit Zitat antworten Zitat