From a653a3a2823e9bcecc80ec639cd5d2743f3edd04 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 11 Dec 2016 18:49:20 +0100 Subject: Only print non-null life densities --- README.md | 2 +- life.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 831d505..a8e3d8a 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ ...is a straight forward toy implementation of Conway's Game of Life. It is written in C++ using `termbox` for drawing in the terminal. _Divine intervention_ i.e. manipulating the world state is supported using the mouse. -[![asciicast](https://asciinema.org/a/b8ikx32sc5fe427b86y7kjgh7.png)](https://asciinema.org/a/b8ikx32sc5fe427b86y7kjgh7) +[![asciicast](https://asciinema.org/a/f4nc8r6v1tf2m97s6m81ci37q.png)](https://asciinema.org/a/f4nc8r6v1tf2m97s6m81ci37q) diff --git a/life.cc b/life.cc index ad69d56..ee522ec 100644 --- a/life.cc +++ b/life.cc @@ -22,7 +22,11 @@ void draw( if ( world.isLifeAt(i-x, j-y) ) { tb_change_cell(i, j, 48+density, TB_BLACK, TB_GREEN); } else { - tb_change_cell(i, j, 48+density, TB_BLACK, TB_BLUE); + if ( density == 0 ) { + tb_change_cell(i, j, ' ', TB_BLACK, TB_BLUE); + } else { + tb_change_cell(i, j, 48+density, TB_BLACK, TB_BLUE); + } } }); -- cgit v1.2.3