Loading draw/spaceinvaders/spaceinvaders.go +38 −9 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ type invader struct { length int eyes int armSize int anthenaSize int } func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size int) { Loading Loading @@ -73,6 +74,23 @@ 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 = fillBlack() } } else if invader.anthenas == 2 { if xQ == 3 || xQ == 7 { fill = fillBlack() } } else if invader.anthenas == 3 { if xQ == 2 || xQ == 5 || xQ == 8 { fill = fillBlack() } } } if yQ == highBodyIndex { if invader.anthenas == 1 { if xQ == 5 { Loading Loading @@ -428,6 +446,17 @@ func newInvader(key string) invader { invader.foot = true } s = hex.EncodeToString([]byte{key[9]}) if val, err := strconv.ParseInt(s, 16, 0); err == nil { if val%2 == 0 { invader.anthenaSize = 1 } else { invader.anthenaSize = 2 } } else { invader.foot = true } return invader } Loading Loading
draw/spaceinvaders/spaceinvaders.go +38 −9 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ type invader struct { length int eyes int armSize int anthenaSize int } func SpaceInvaders(w http.ResponseWriter, key string, colors []color.RGBA, size int) { Loading Loading @@ -73,6 +74,23 @@ 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 = fillBlack() } } else if invader.anthenas == 2 { if xQ == 3 || xQ == 7 { fill = fillBlack() } } else if invader.anthenas == 3 { if xQ == 2 || xQ == 5 || xQ == 8 { fill = fillBlack() } } } if yQ == highBodyIndex { if invader.anthenas == 1 { if xQ == 5 { Loading Loading @@ -428,6 +446,17 @@ func newInvader(key string) invader { invader.foot = true } s = hex.EncodeToString([]byte{key[9]}) if val, err := strconv.ParseInt(s, 16, 0); err == nil { if val%2 == 0 { invader.anthenaSize = 1 } else { invader.anthenaSize = 2 } } else { invader.foot = true } return invader } Loading