aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/output/state_printer.cpp
diff options
context:
space:
mode:
authorCharlie Blake2018-07-18 16:04:56 +0100
committerGitHub2018-07-18 16:04:56 +0100
commit4ddf1752f3909eb1c87c06414597463208120058 (patch)
tree62bbba8f7dd114ccd39f0e935b1bc4fbd74250dd /src/main/input-output/output/state_printer.cpp
parentMerge pull request #76 from thecharlesblake/add-gaps (diff)
parentAdd accordion move making (diff)
downloadmetasol-4ddf1752f3909eb1c87c06414597463208120058.tar.gz
metasol-4ddf1752f3909eb1c87c06414597463208120058.zip

Merge pull request #77 from thecharlesblake/add-accordion

Add accordion

Diffstat (limited to 'src/main/input-output/output/state_printer.cpp')
-rw-r--r--src/main/input-output/output/state_printer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/input-output/output/state_printer.cpp b/src/main/input-output/output/state_printer.cpp
index e48ed51..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;
@@ -47,6 +48,10 @@ ostream& state_printer::print(ostream& stream, const game_state& gs) {
state_printer::print_header(stream, "Sequences");
state_printer::print_sequences(stream, gs.sequences, gs);
}
+ if (gs.rules.accordion_size > 0) {
+ state_printer::print_header(stream, "Accordion");
+ state_printer::print_accordion(stream, gs.accordion, gs);
+ }
return stream << "===================================";
}
@@ -129,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) {
@@ -160,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;