package sauce type Chunk struct { X int Y int Cells [][]Cell } func NewChunk(width, height int) *Chunk { c := &Chunk{} c.Cells = make([][]Cell, width) for i := range c.Cells { c.Cells[i] = make([]Cell, height) } return c } func (c *Chunk) Width() int { return len(c.Cells) } func (c *Chunk) Height() int { return len(c.Cells[0]) } func (c *Chunk) At(x, y int) *Cell { if x < 0 || y < 0 || x >= c.Width() || y >= c.Height() { return nil } return &c.Cells[x][y] }