package conway type GameStateRow struct { Y int Cells []int } func (row *GameStateRow) GetCell(x int) *GameStateCell { lenCells := len(row.Cells) if x+1 > lenCells { return row.GetCell(x % lenCells) } return &GameStateCell{ Value: row.Cells[x], X: x, Y: row.Y, cellmates: row.Cells, } }