2023-12-14 03:44:14 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
type imgs struct {
|
|
|
|
img []img
|
|
|
|
}
|
|
|
|
|
|
|
|
func newImages() imgs {
|
|
|
|
return imgs{img: make([]img, 0)}
|
|
|
|
}
|
|
|
|
|
|
|
|
type img struct {
|
|
|
|
raw []string
|
|
|
|
}
|
|
|
|
|
|
|
|
func newImg() img {
|
|
|
|
return img{raw: make([]string, 0)}
|
|
|
|
}
|
|
|
|
|
2023-12-16 00:23:25 +00:00
|
|
|
// transposed rotates an image rightwards ninety degrees
|
2023-12-14 03:44:14 +00:00
|
|
|
func (i img) transposed() []string {
|
|
|
|
transposed := []string{}
|
|
|
|
|
|
|
|
for x := 0; x < len(i.raw[0]); x++ {
|
|
|
|
buf := ""
|
|
|
|
for j := len(i.raw) - 1; j >= 0; j-- {
|
|
|
|
buf += string(i.raw[j][x])
|
|
|
|
}
|
|
|
|
transposed = append(transposed, buf)
|
|
|
|
}
|
|
|
|
|
|
|
|
return transposed
|
|
|
|
}
|
|
|
|
|
|
|
|
var images imgs
|