Reply to comment

Mar 15 16:35

MSWLogo Hypercube

The LOGO code for the hypercube appears below:

to hypc2 :len

; :ps is pensize 
; :homexy is the center of the hyper square
; :ohd is the original heading
; :origpen is the original pen status
(local "ps "homexy "ohd "origpen)

;

; save pen modes
	make "origpen pen

	make "ps (list 2 2) 
	make "centerxy pos
	make "ohd heading

	setpensize :ps
	pu 
	lt 90 
	fd :len + :len/5 
	rt 90 fd :len/2 
	pd
	
	(gifsave "hypc.gif 50 "False -1)
	repeat 8 	
	[	
		sq :len 	
		lt 45 
		bk :len 
		(gifsave "hypc.gif 50 "True -1)
	]

	pu
	setpos :centerxy
	setheading :ohd
	setpen :origpen
end

to sq :len
	repeat 4 [fd :len rt 90]
end

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • You may insert a link to a defined site with [link: title].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.