| 214 | } |
| 215 | |
| 216 | auto 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 | |
| 239 | auto future_tricks_to_dict(const FutureTricks& future_tricks) -> py::dict |
| 240 | { |
no outgoing calls
no test coverage detected