GREEN HARMONY 手記
2020年03月31日 smalltalkでプログラミング20200331 [長年日記]
☆ Squeak Workspaceにて実行
(直角原理)
| fm pen ft angle arr parr | fm := Form extent: 800@800 depth: Display depth. fm fillColor: Color white. pen := Pen newOnForm: fm. pen defaultNib: 2. ft := StrikeFont familyName: #Atlanta pointSize: 30. pen putDotOfDiameter: 782 at: 400@400. pen color: Color white. pen putDotOfDiameter: 777 at: 400@400. pen color: Color black. pen turn: -45. 4 timesRepeat: [ pen go: 390. pen go: -390. pen turn: -90. ]. pen turn: 45. pen defaultNib: 1. pen place: 210@620. parr := {0@0 . 10@ -40 . -40@ -10 . -10@40 . 40@50 . 50@ -80 . -80@ -50 . -50@80 . 80@90 . 90@ -120 . -120@ -90 . -90@120 }. arr := #(9 1 2 3 4 5 6 7 8). angle := 90. 1 to: 12 do: [:i | i = 2 ifTrue: [ angle := -90]. pen place: (pen location + parr at: i). pen turn: angle. arr do: [:n | pen color: Color black. pen print: n asString withFont: ft. pen color: Color white. pen go: 32. ]. arr := arr collect: [:n | n * 2 - 1 \\ 9 + 1]. ]. fm asMorph openInWorld