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