From cbea9f4b5f83f1745ab7ff01b94eb96412f8e035 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 6 Nov 2017 15:40:39 +0000 Subject: Add cell printing --- src/main/game_state.cpp | 11 +++++++++++ src/main/game_state.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp index 2dd1ca8..90a7381 100644 --- a/src/main/game_state.cpp +++ b/src/main/game_state.cpp @@ -181,6 +181,10 @@ ostream& game_state::print(ostream& stream) const { print_header(stream, "Foundations"); print_foundations(stream); } + if (rules.cells) { + print_header(stream, "Cells"); + print_cells(stream); + } if (rules.tableau_pile_count > 0) { print_header(stream, "Tableau Piles"); print_tableau_piles(stream); @@ -208,6 +212,13 @@ void game_state::print_foundations(ostream& stream) const { << foundations[3] << "\n"; } +void game_state::print_cells(ostream& stream) const { + for (pile cell : cells) { + if (!cell.empty()) stream << cells[0] << "\t"; + } + stream << "\n"; +} + void game_state::print_tableau_piles(ostream& stream) const { bool empty_row = false; vector::size_type row_idx = 0; diff --git a/src/main/game_state.h b/src/main/game_state.h index bb98ee3..97a1bec 100644 --- a/src/main/game_state.h +++ b/src/main/game_state.h @@ -36,6 +36,7 @@ private: void print_header(std::ostream&, const char*) const; void print_foundations(std::ostream&) const; + void print_cells(std::ostream&) const; void print_tableau_piles(std::ostream&) const; void print_hole(std::ostream&) const; -- cgit v1.2.1