Skip to content

Commit

Permalink
BLD: Having built errors for windows cibuildwheel
Browse files Browse the repository at this point in the history
  • Loading branch information
lunathanael committed Aug 18, 2024
1 parent 919bf8e commit 9789737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/botris/_core/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ namespace nb = nanobind;
using namespace nb::literals;

void bind_constants(nb::module_ &m) {
nb::module_ constants = m.def_submodule("constants", "Group of constants and enums");
nb::module_ constants_module = m.def_submodule("constants", "Group of constants and enums");

nb::enum_<spinType>(constants, "spinType")
nb::enum_<spinType>(constants_module, "spinType")
.value("null", spinType::null)
.value("mini", spinType::mini)
.value("normal", spinType::normal);

nb::enum_<RotationDirection>(constants, "RotationDirection")
nb::enum_<RotationDirection>(constants_module, "RotationDirection")
.value("North", RotationDirection::North)
.value("East", RotationDirection::East)
.value("South", RotationDirection::South)
.value("West", RotationDirection::West)
.value("RotationDirections_N", RotationDirection::RotationDirections_N);

nb::enum_<ColorType>(constants, "ColorType")
nb::enum_<ColorType>(constants_module, "ColorType")
.value("S", ColorType::S)
.value("Z", ColorType::Z)
.value("J", ColorType::J)
Expand All @@ -34,7 +34,7 @@ void bind_constants(nb::module_ &m) {
.value("Garbage", ColorType::Garbage)
.value("ColorTypes_N", ColorType::ColorTypes_N);

nb::enum_<PieceType>(constants, "PieceType")
nb::enum_<PieceType>(constants_module, "PieceType")
.value("S", PieceType::S)
.value("Z", PieceType::Z)
.value("J", PieceType::J)
Expand All @@ -45,28 +45,28 @@ void bind_constants(nb::module_ &m) {
.value("Empty", PieceType::Empty)
.value("PieceTypes_N", PieceType::PieceTypes_N);

nb::enum_<TurnDirection>(constants, "TurnDirection")
nb::enum_<TurnDirection>(constants_module, "TurnDirection")
.value("Left", TurnDirection::Left)
.value("Right", TurnDirection::Right);

nb::enum_<Movement>(constants, "Movement")
nb::enum_<Movement>(constants_module, "Movement")
.value("Left", Movement::Left)
.value("Right", Movement::Right)
.value("RotateClockwise", Movement::RotateClockwise)
.value("RotateCounterClockwise", Movement::RotateCounterClockwise)
.value("SonicDrop", Movement::SonicDrop);

nb::class_<Coord>(constants, "Coord")
nb::class_<Coord>(constants_module, "Coord")
.def(nb::init<>())
.def(nb::init<i8, i8>(), "x"_a, "y"_a)
.def_rw("x", &Coord::x)
.def_rw("y", &Coord::y);

constants.attr("n_minos") = n_minos;
constants_module.attr("n_minos") = n_minos;

constants.attr("piece_definitions") = piece_definitions;
constants_module.attr("piece_definitions") = piece_definitions;

constants.attr("rot_piece_def") = rot_piece_def;
constants_module.attr("rot_piece_def") = rot_piece_def;

constants.attr("piece_spawn_height") = piece_spawn_height;
constants_module.attr("piece_spawn_height") = piece_spawn_height;
}
8 changes: 4 additions & 4 deletions src/botris/_core/movegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace nb = nanobind;
using namespace nb::literals;

void bind_movegen(nb::module_ &m) {
auto tm = m.def_submodule("traditional_movegen", "Shaktris Traditional Movegen Module");
auto sm = m.def_submodule("smeared_movegen", "Shaktris Smeared Movegen Module");
auto traditional_module = m.def_submodule("traditional_movegen", "Shaktris Traditional Movegen Module");
auto smeared_module = m.def_submodule("smeared_movegen", "Shaktris Smeared Movegen Module");

tm.def("sky_piece_movegen", &Shaktris::MoveGen::Traditional::sky_piece_movegen, "board"_a, "piece_type"_a)
traditional_module.def("sky_piece_movegen", &Shaktris::MoveGen::Traditional::sky_piece_movegen, "board"_a, "piece_type"_a)
.def("convex_movegen", &Shaktris::MoveGen::Traditional::convex_movegen, "board"_a, "piece_type"_a);

sm.def("movegen", &Shaktris::MoveGen::Smeared::movegen, "board"_a, "type"_a)
smeared_module.def("movegen", &Shaktris::MoveGen::Smeared::movegen, "board"_a, "type"_a)
.def("god_movegen", &Shaktris::MoveGen::Smeared::god_movegen, "board"_a, "type"_a);
}

0 comments on commit 9789737

Please sign in to comment.