MCPcopy Create free account
hub / github.com/Gecode/gecode / print

Method print

examples/queen-armies.cpp:138–149  ·  view source on GitHub ↗

Print solution

Source from the content-addressed store, hash-verified

136 }
137 /// Print solution
138 virtual void
139 print(std::ostream& os) const {
140 os << '\t';
141 for (int i = 0; i < n*n; ++i) {
142 if (w[i].assigned() && w[i].val()) os << "W";
143 else if (b[i].assigned() && b[i].val()) os << "B";
144 else if (!w[i].assigned() && !b[i].assigned()) os << " ";
145 else os << ".";
146 if ((i+1)%n == 0) os << std::endl << (i!=(n*n-1)?"\t":"");
147 }
148 os << "Number of white queens: " << q << std::endl << std::endl;
149 }
150
151 /** \brief Custom brancher for Peacable queens
152 *

Callers

nothing calls this directly

Calls 2

assignedMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected