Loading controllers/spaceinvaders/spaceinvaders.go +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ func SpaceInvaders(w http.ResponseWriter, r *http.Request) { colors = append(colors, colorMap["base"]...) } } else { colors = append(colors, fg, bg) colors = append(colors, bg, fg) } size := extract.Size(r) Loading draw/spaceinvaders/spaceinvaders.go +59 −59 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size for xQ := 0; xQ < squares; xQ++ { x := xQ * quadrantSize fill := draw.FillFromRGBA(colors[1]) fill := draw.FillFromRGBA(colors[0]) if _, ok := colorMap[xQ]; !ok { if float64(xQ) < middle { colorMap[xQ] = draw.PickColor(key, colors, xQ+2*yQ) Loading @@ -42,15 +42,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex { if invader.eyes == 2 { if xQ > 4 && xQ < 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ > 3 && xQ < 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ > 3 && xQ < 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } if invader.eyes > 1 { Loading @@ -62,15 +62,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex-1 && invader.anthenaSize == 2 { if invader.anthenas == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 2 { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 3 { if xQ == 2 || xQ == 5 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -78,15 +78,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex { if invader.anthenas == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 3 { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -94,19 +94,19 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 3 { // pre frontal lobe :p if invader.eyes == 1 { if xQ >= 5 && xQ <= 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ >= 4 && xQ <= 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ >= 3 && xQ <= 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ >= 3 && xQ <= 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -114,19 +114,19 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 4 { // frontal lobe if invader.eyes == 1 { if xQ >= 4 && xQ <= 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ >= 3 && xQ <= 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ >= 2 && xQ <= 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ >= 2 && xQ <= 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -135,7 +135,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size leftOver := squares - invader.length if invader.arms > 0 { if xQ == (leftOver/2) || xQ == squares-1-leftOver/2 || xQ == (leftOver/2)-1 || xQ == (squares-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -144,12 +144,12 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if yQ == 4 && invader.armsUp && invader.armSize == 3 { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } if yQ == 6 && !invader.armsUp && invader.armSize == 3 { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -158,27 +158,27 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 5 { // eyes if invader.eyes == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ == 5 || xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -186,7 +186,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 6 { // length of body leftOver := squares - invader.length if xQ > (leftOver/2)-1 && xQ < squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -196,7 +196,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == lowBodyIndex { leftOver := squares - invader.length if xQ > (leftOver/2) && xQ < (squares-1-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -208,7 +208,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == lowBodyIndex { leftOver := squares - invader.length if xQ > (leftOver/2)+1 && xQ < (squares-2-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -220,11 +220,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - (leftOver / 2) - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-2 || xQ == squares-leftOver/2+1 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -237,11 +237,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - (leftOver / 2) - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -258,11 +258,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -274,11 +274,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -290,11 +290,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-2 || xQ == squares-leftOver/2+1 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -304,34 +304,34 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.legs%2 == 0 { if invader.legs == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 4 { if invader.length >= 6 { if invader.height >= 7 { if yQ == lowBodyIndex { if xQ == 3 || xQ == 4 || xQ == 6 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if yQ == lowBodyIndex { if xQ == 3 || xQ == 5 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -339,27 +339,27 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size } else { if invader.legs == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 3 { if invader.length > 5 { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if yQ == lowBodyIndex { if xQ == 4 || xQ == 5 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } } else if invader.legs == 5 { if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -369,32 +369,32 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.legs%2 == 0 { if invader.legs == 2 { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 4 { if xQ == 1 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if invader.legs == 1 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 3 { if invader.length > 5 { if xQ == 2 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else if invader.legs == 5 { if xQ == 0 || xQ == 10 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading Loading
controllers/spaceinvaders/spaceinvaders.go +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ func SpaceInvaders(w http.ResponseWriter, r *http.Request) { colors = append(colors, colorMap["base"]...) } } else { colors = append(colors, fg, bg) colors = append(colors, bg, fg) } size := extract.Size(r) Loading
draw/spaceinvaders/spaceinvaders.go +59 −59 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size for xQ := 0; xQ < squares; xQ++ { x := xQ * quadrantSize fill := draw.FillFromRGBA(colors[1]) fill := draw.FillFromRGBA(colors[0]) if _, ok := colorMap[xQ]; !ok { if float64(xQ) < middle { colorMap[xQ] = draw.PickColor(key, colors, xQ+2*yQ) Loading @@ -42,15 +42,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex { if invader.eyes == 2 { if xQ > 4 && xQ < 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ > 3 && xQ < 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ > 3 && xQ < 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } if invader.eyes > 1 { Loading @@ -62,15 +62,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex-1 && invader.anthenaSize == 2 { if invader.anthenas == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 2 { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 3 { if xQ == 2 || xQ == 5 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -78,15 +78,15 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == highBodyIndex { if invader.anthenas == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.anthenas == 3 { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -94,19 +94,19 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 3 { // pre frontal lobe :p if invader.eyes == 1 { if xQ >= 5 && xQ <= 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ >= 4 && xQ <= 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ >= 3 && xQ <= 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ >= 3 && xQ <= 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -114,19 +114,19 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 4 { // frontal lobe if invader.eyes == 1 { if xQ >= 4 && xQ <= 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ >= 3 && xQ <= 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ >= 2 && xQ <= 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ >= 2 && xQ <= 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -135,7 +135,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size leftOver := squares - invader.length if invader.arms > 0 { if xQ == (leftOver/2) || xQ == squares-1-leftOver/2 || xQ == (leftOver/2)-1 || xQ == (squares-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -144,12 +144,12 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if yQ == 4 && invader.armsUp && invader.armSize == 3 { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } if yQ == 6 && !invader.armsUp && invader.armSize == 3 { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -158,27 +158,27 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 5 { // eyes if invader.eyes == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 3 { if xQ == 5 || xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[1]) } } else if invader.eyes == 4 { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[1]) } else if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) } else if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -186,7 +186,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == 6 { // length of body leftOver := squares - invader.length if xQ > (leftOver/2)-1 && xQ < squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -196,7 +196,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == lowBodyIndex { leftOver := squares - invader.length if xQ > (leftOver/2) && xQ < (squares-1-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -208,7 +208,7 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if yQ == lowBodyIndex { leftOver := squares - invader.length if xQ > (leftOver/2)+1 && xQ < (squares-2-leftOver/2) { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -220,11 +220,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - (leftOver / 2) - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-2 || xQ == squares-leftOver/2+1 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } Loading @@ -237,11 +237,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - (leftOver / 2) - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -258,11 +258,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -274,11 +274,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-1 || xQ == squares-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -290,11 +290,11 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.arms > 0 { if (squares - leftOver/2 - (leftOver / 2) - 1) >= invader.length { if xQ == (leftOver/2)-2 || xQ == squares-leftOver/2+1 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == (leftOver/2)-2 || xQ == squares+1-leftOver/2 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -304,34 +304,34 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.legs%2 == 0 { if invader.legs == 2 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 4 { if invader.length >= 6 { if invader.height >= 7 { if yQ == lowBodyIndex { if xQ == 3 || xQ == 4 || xQ == 6 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if yQ == lowBodyIndex { if xQ == 3 || xQ == 5 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 2 || xQ == 4 || xQ == 6 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -339,27 +339,27 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size } else { if invader.legs == 1 { if xQ == 5 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 3 { if invader.length > 5 { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if yQ == lowBodyIndex { if xQ == 4 || xQ == 5 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 3 || xQ == 5 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } } else if invader.legs == 5 { if xQ == 1 || xQ == 3 || xQ == 5 || xQ == 7 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading @@ -369,32 +369,32 @@ func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size if invader.legs%2 == 0 { if invader.legs == 2 { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 4 { if xQ == 1 || xQ == 9 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else { if invader.legs == 1 { if xQ == 4 || xQ == 6 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else if invader.legs == 3 { if invader.length > 5 { if xQ == 2 || xQ == 8 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } else { if xQ == 3 || xQ == 7 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } else if invader.legs == 5 { if xQ == 0 || xQ == 10 { fill = draw.FillFromRGBA(colors[0]) fill = draw.FillFromRGBA(colors[1]) } } } Loading