aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/output/state_printer.cpp
diff options
context:
space:
mode:
authorCharlie Blake2018-07-14 15:06:04 +0100
committerGitHub2018-07-14 15:06:04 +0100
commit7a2eaa8280ca35a52227084c037b1adb57193291 (patch)
tree64ab75568e80890a6b5b66ab0481dd4ea24d1d24 /src/main/input-output/output/state_printer.cpp
parentMerge pull request #75 from thecharlesblake/refactor-rules-json (diff)
parentGaps / sequence implementation (diff)
downloadmetasol-7a2eaa8280ca35a52227084c037b1adb57193291.tar.gz
metasol-7a2eaa8280ca35a52227084c037b1adb57193291.zip

Merge pull request #76 from thecharlesblake/add-gaps

Add gaps

Diffstat (limited to 'src/main/input-output/output/state_printer.cpp')
-rw-r--r--src/main/input-output/output/state_printer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/input-output/output/state_printer.cpp b/src/main/input-output/output/state_printer.cpp
index 67702e2..e48ed51 100644
--- a/src/main/input-output/output/state_printer.cpp
+++ b/src/main/input-output/output/state_printer.cpp
@@ -43,6 +43,10 @@ ostream& state_printer::print(ostream& stream, const game_state& gs) {
state_printer::print_header(stream, "Hole Card");
state_printer::print_top_of_pile(stream, gs.hole, gs);
}
+ if (gs.rules.sequence_count > 0) {
+ state_printer::print_header(stream, "Sequences");
+ state_printer::print_sequences(stream, gs.sequences, gs);
+ }
return stream << "===================================";
}
@@ -90,6 +94,25 @@ void state_printer::print_piles(ostream& stream,
}
}
+void state_printer::print_sequences(ostream& stream,
+ const vector<pile::ref>& seq_rs,
+ const game_state& gs) {
+ for (auto s : seq_rs) {
+ stream << "\n";
+ auto& pile = gs.piles[s];
+ for (auto i = pile.size(); i --> 0 ;) {
+ card c = pile[i];
+ if (c == "AS")
+ stream << "__";
+ else
+ print_card(stream, pile[i]);
+ stream << " ";
+ }
+ stream << "\n";
+ }
+ stream << "\n";
+}
+
void state_printer::print_top_of_piles(ostream& stream,
const vector<pile::ref>& vp,
const game_state& gs) {
@@ -134,6 +157,9 @@ void state_printer::print_move(std::ostream& s, const move m) {
case move::mtype::stock_to_all_tableau:
s << "stock-to-all-tableau";
break;
+ case move::mtype::sequence:
+ s << "sequence";
+ break;
case move::mtype::null:
s << "null";
break;