package machine import "fmt" type Button struct { X int Y int } type Prize struct { X int Y int } type Machine struct { A Button B Button Prize Prize } func New(btnA, btnB, prz []string) *Machine { return &Machine{ A: Button{X: mustConv(btnA[2]), Y: mustConv(btnA[3])}, B: Button{X: mustConv(btnB[2]), Y: mustConv(btnB[3])}, Prize: Prize{X: mustConv(prz[1]), Y: mustConv(prz[2])}, } } func (m *Machine) String() string { return fmt.Sprintf( "ButtonA: (%d,%d) ButtonB: (%d,%d) Prize: (%d,%d)", m.A.X, m.A.Y, m.B.X, m.B.Y, m.Prize.X, m.Prize.Y, ) }