From 93c5f7356364bd6e0276dddd0a78bcb50085629f Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 11 Dec 2016 00:23:17 +0100 Subject: Display life density for each world cell --- life.cc | 6 ++++-- 1 file 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); } } } -- cgit v1.2.3