GREEN HARMONY 手記
2020年04月09日 smalltalkでプログラミング20200409 [長年日記]
☆ smalltalkプログラミング
Squeak Workspaceにて実行
| aMorph gMorph sMorph colorList pdict | colorList := #('#9370DB' 'red' 'orange' 'yellow' 'green' 'blue' '#000080' '#800080' '#808000' ). aMorph := Morph new. aMorph position: 500@500. aMorph extent: 300@300. aMorph color: Color white. pdict := Dictionary new. pdict at:7 put: -70@36. pdict at:2 put: -70@ -36. pdict at:8 put: 0@ -78. pdict at:3 put: 36@ -70. pdict at:9 put: 70@ -36. pdict at:4 put: 70@36. pdict at:6 put: 0@78. pdict at:1 put: -36@70. gMorph := CircleMorph new. gMorph bounds: (0@0 corner: 200@200). gMorph color: Color white. gMorph borderWidth: 3. gMorph borderColor: (Color fromString: '#DAA520'). aMorph addMorphCentered: gMorph. sMorph := CircleMorph new. sMorph bounds: (0@0 corner: 72@72). sMorph color: (Color fromString: '#DAA520'). sMorph borderWidth: 3. sMorph borderColor: (Color fromString: '#DAA520'). aMorph addMorphCentered: sMorph. {-78@0 . 78@0 . -36@ -70 . 36@70} do: [:each | | bMorph p | bMorph := CircleMorph new. bMorph bounds: (0@0 corner: 36@36). bMorph color: (Color fromString: (colorList at:5)). bMorph borderColor: (Color fromString: (colorList at:5)). p := bMorph extent // 2. bMorph position: (aMorph bounds center - (p + each)). aMorph addMorph: bMorph. ]. #(7 2 8 3 9 4 6 1) do: [: n | | bMorph p | bMorph := CircleMorph new. bMorph bounds: (0@0 corner: 36@36). bMorph color: (Color fromString: (colorList at:n)). bMorph borderColor: (Color fromString: (colorList at:n)). p := bMorph extent // 2. bMorph position: (aMorph bounds center - (p + (pdict at:n))). aMorph addMorph: bMorph. ]. aMorph openInWorld.