aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-12-11 00:23:17 +0100
committerAdrian Kummerlaender2016-12-11 00:23:17 +0100
commit93c5f7356364bd6e0276dddd0a78bcb50085629f (patch)
tree7ef8b37395e6ae238a6c92d54cb79502739aa3ab
parentd4adb52e434504d5b1cb388fb0eac9069505edb1 (diff)
downloadtermlife-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.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/life.cc b/life.cc
index 58d1c49..5e9b52c 100644
--- a/life.cc
+++ b/life.cc
@@ -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);
}
}
}