mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-15 15:10:49 +00:00
35 lines
529 B
Go
35 lines
529 B
Go
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)}
|
|
}
|
|
|
|
// transposed rotates an image rightwards ninety degrees
|
|
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
|