diff options
author | Adrian Kummerlaender | 2017-03-26 15:38:58 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-03-26 15:38:58 +0200 |
commit | 7e3ea6b0080b2c9127964a096a27369d8cc59c67 (patch) | |
tree | 5f69a365fb9d5ebd9f1646ceadc7da75364b083c | |
parent | 1266502d8f0e72c135198278fcccf75b519cee44 (diff) | |
download | termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar.gz termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar.bz2 termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar.lz termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar.xz termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.tar.zst termlife-7e3ea6b0080b2c9127964a096a27369d8cc59c67.zip |
Rename `TorusArray` to `TorusMatrix` to better fit the represented structure
-rw-r--r-- | life.cc | 4 | ||||
-rw-r--r-- | src/util/torus_matrix.h (renamed from src/util/torus_array.h) | 8 | ||||
-rw-r--r-- | src/world.h | 4 |
3 files changed, 8 insertions, 8 deletions
@@ -30,10 +30,10 @@ void draw( } }); - util::print_tb(1, 1, TB_WHITE, TB_DEFAULT, "Age:"); + util::print_tb(1, 1, TB_WHITE, TB_DEFAULT, "Age:"); util::print_tb(13, 1, TB_WHITE, TB_DEFAULT, std::to_string(world.getAge())); - util::print_tb(1, 2, TB_WHITE, TB_DEFAULT, "Population:"); + util::print_tb(1, 2, TB_WHITE, TB_DEFAULT, "Population:"); util::print_tb(13, 2, TB_WHITE, TB_DEFAULT, std::to_string(world.getPopulation())); tb_present(); diff --git a/src/util/torus_array.h b/src/util/torus_matrix.h index bef0c9f..d09b99e 100644 --- a/src/util/torus_array.h +++ b/src/util/torus_matrix.h @@ -1,5 +1,5 @@ -#ifndef LIFE_SRC_UTIL_TORUS_ARRAY_ -#define LIFE_SRC_UTIL_TORUS_ARRAY_ +#ifndef LIFE_SRC_UTIL_TORUS_MATRIX_ +#define LIFE_SRC_UTIL_TORUS_MATRIX_ #include <array> #include <cstdint> @@ -12,7 +12,7 @@ template< std::size_t WIDTH, std::size_t HEIGHT > -class TorusArray { +class TorusMatrix { static std::size_t toMatrixColumn(const std::ptrdiff_t x) { if ( x >= 0 ) { return x % WIDTH; @@ -49,4 +49,4 @@ class TorusArray { } } -#endif // LIFE_SRC_UTIL_TORUS_ARRAY_ +#endif // LIFE_SRC_UTIL_TORUS_MATRIX_ diff --git a/src/world.h b/src/world.h index a09eb5a..a7a68a0 100644 --- a/src/world.h +++ b/src/world.h @@ -6,7 +6,7 @@ #include <cstdint> #include "util/box_traverser.h" -#include "util/torus_array.h" +#include "util/torus_matrix.h" namespace life { @@ -117,9 +117,9 @@ class World { private: const util::BoxTraverser area_; + util::TorusMatrix<bool, WIDTH, HEIGHT> matrix_; std::size_t age_{}; std::size_t population_{}; - util::TorusArray<bool, WIDTH, HEIGHT> matrix_; }; |