diff options
author | Adrian Kummerlaender | 2016-12-11 18:49:20 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-12-11 18:49:20 +0100 |
commit | a653a3a2823e9bcecc80ec639cd5d2743f3edd04 (patch) | |
tree | 82754818f93d39187689669e13602ffe65ce1028 | |
parent | 7082c43f116902173d332d81e97f98c306c0dcba (diff) | |
download | termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar.gz termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar.bz2 termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar.lz termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar.xz termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.tar.zst termlife-a653a3a2823e9bcecc80ec639cd5d2743f3edd04.zip |
Only print non-null life densities
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | life.cc | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -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) @@ -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); + } } }); |