diff options
author | Adrian Kummerlaender | 2016-12-11 00:23:17 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-12-11 00:23:17 +0100 |
commit | 93c5f7356364bd6e0276dddd0a78bcb50085629f (patch) | |
tree | 7ef8b37395e6ae238a6c92d54cb79502739aa3ab | |
parent | d4adb52e434504d5b1cb388fb0eac9069505edb1 (diff) | |
download | termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar.gz termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar.bz2 termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar.lz termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar.xz termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.tar.zst termlife-93c5f7356364bd6e0276dddd0a78bcb50085629f.zip |
Display life density for each world cell
-rw-r--r-- | life.cc | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -28,10 +28,12 @@ void draw( for ( std::size_t i = 0; i < HEIGHT; i++ ) { for ( std::size_t j = 0; j < WIDTH; j++ ) { + const char density{std::to_string(world.lifeDensityAt(j,i))[0]}; + if ( world.isLifeAt(j,i) ) { - tb_change_cell(x+j, y+i, 0x2588, TB_BLACK, TB_GREEN); + tb_change_cell(x+j, y+i, density, TB_BLACK, TB_GREEN); } else { - tb_change_cell(x+j, y+i, 0x2591, TB_BLACK, TB_BLUE); + tb_change_cell(x+j, y+i, density, TB_BLACK, TB_BLUE); } } } |