MCPcopy Create free account
hub / github.com/dds-bridge/dds / dict_to_dd_table_results

Function dict_to_dd_table_results

python/src/converters.cpp:216–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216auto dict_to_dd_table_results(const py::dict& table_input) -> DdTableResults
217{
218 DdTableResults table_results{};
219 const auto table_rows = py::cast<py::sequence>(table_input["res_table"]);
220 if (table_rows.size() != DDS_STRAINS) {
221 throw py::value_error(
222 "res_table must have " + std::to_string(DDS_STRAINS) + " rows");
223 }
224
225 for (int strain = 0; strain < DDS_STRAINS; ++strain) {
226 const auto row = py::cast<py::sequence>(table_rows[strain]);
227 if (row.size() != DDS_HANDS) {
228 throw py::value_error(
229 "each res_table row must have " + std::to_string(DDS_HANDS) + " values");
230 }
231 for (int hand = 0; hand < DDS_HANDS; ++hand) {
232 table_results.res_table[strain][hand] = py::cast<int>(row[hand]);
233 }
234 }
235
236 return table_results;
237}
238
239auto future_tricks_to_dict(const FutureTricks& future_tricks) -> py::dict
240{

Callers 2

register_par_bindingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected