diff options
| author | Charlie Blake | 2018-07-15 01:16:38 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-07-18 16:04:06 +0100 |
| commit | df6b4405801f762cc536ed441c673e4bd1675620 (patch) | |
| tree | 62bbba8f7dd114ccd39f0e935b1bc4fbd74250dd /src/main/input-output/output | |
| parent | Add accordion top pile state caching (diff) | |
| download | metasol-df6b4405801f762cc536ed441c673e4bd1675620.tar.gz metasol-df6b4405801f762cc536ed441c673e4bd1675620.zip | |
Add accordion move making
Diffstat (limited to 'src/main/input-output/output')
| -rw-r--r-- | src/main/input-output/output/state_printer.cpp | 16 | ||||
| -rw-r--r-- | src/main/input-output/output/state_printer.h | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/input-output/output/state_printer.cpp b/src/main/input-output/output/state_printer.cpp index b418a42..3f1978b 100644 --- a/src/main/input-output/output/state_printer.cpp +++ b/src/main/input-output/output/state_printer.cpp @@ -6,6 +6,7 @@ using std::ostream; using std::vector; +using std::list; typedef sol_rules::stock_deal_type sdt; @@ -49,7 +50,7 @@ ostream& state_printer::print(ostream& stream, const game_state& gs) { } if (gs.rules.accordion_size > 0) { state_printer::print_header(stream, "Accordion"); - state_printer::print_top_of_piles(stream, gs.accordion, gs); + state_printer::print_accordion(stream, gs.accordion, gs); } return stream << "==================================="; } @@ -133,6 +134,16 @@ void state_printer::print_top_of_piles(ostream& stream, stream << "\n"; } +void state_printer::print_accordion(ostream& stream, + const list<pile::ref>& vp, + const game_state& gs) { + for (pile::ref p : vp) { + print_card(stream, gs.piles[p].top_card()); + stream << "\t"; + } + stream << "\n"; +} + void state_printer::print_top_of_pile(ostream& stream, const pile::ref pile_r, const game_state& gs) { @@ -164,6 +175,9 @@ void state_printer::print_move(std::ostream& s, const move m) { case move::mtype::sequence: s << "sequence"; break; + case move::mtype::accordion: + s << "accordion"; + break; case move::mtype::null: s << "null"; break; diff --git a/src/main/input-output/output/state_printer.h b/src/main/input-output/output/state_printer.h index 7e01aea..575b973 100644 --- a/src/main/input-output/output/state_printer.h +++ b/src/main/input-output/output/state_printer.h @@ -27,6 +27,8 @@ private: const game_state&); static void print_top_of_pile(std::ostream&, pile::ref, const game_state&); + static void print_accordion(std::ostream&, const std::list<pile::ref>&, + const game_state&); static void print_card(std::ostream&, card); }; |
