diff --git a/main.go b/main.go index abe676b..9fadcc6 100644 --- a/main.go +++ b/main.go @@ -23,8 +23,9 @@ type gol struct { // Initialize empty game of life func initGol() gol { start := [ROW][COL]int{} - for i := 0; i < ROW; i++ { - for j := 0; j < COL; j++ { + // Intentionally skipping field around the array making it empty + for i := 1; i < ROW-1; i++ { + for j := 1; j < COL-1; j++ { if rand.Intn(2) == 1 { start[i][j] = 1 } else { @@ -59,8 +60,9 @@ func (g gol) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // Let's draw this all simply func (g gol) View() string { var s string - for i := 0; i < ROW; i++ { - for j := 0; j < COL; j++ { + // Making sure to not draw the empty field around the array + for i := 1; i < ROW-1; i++ { + for j := 1; j < COL-1; j++ { if g.grid[i][j] == 1 { s += "*" } else {