Compare commits

..

2 Commits

5 changed files with 38 additions and 4 deletions

View File

@ -3,7 +3,7 @@
#include <raylib.h>
// #define PRINT_TIMINGS
#define PRINT_TIMINGS
#define VERLET_UPDATE
// #define WEB

View File

@ -272,6 +272,8 @@ public:
auto ToggleTarget(int x, int y) -> bool;
auto ToggleRestricted() -> void;
auto MoveBlockAt(int x, int y, Direction dir) -> bool;
auto GetNextStates() const -> std::vector<State>;

View File

@ -175,15 +175,42 @@ inline auto state_klotski_wc(const State &state) -> bool {
return state.GetBlockAt(1, 3) == "bb";
}
inline auto state_century() -> State {
return State("F4x5:11bb..1112....12..12....11....1121..21..");
}
inline auto state_century_wc(const State &state) -> bool {
return state.GetBlockAt(1, 3) == "bb";
}
inline auto state_super_century() -> State {
return State("F4x5:12111111..12bb..12........21..11....21..");
}
inline auto state_super_century_wc(const State &state) -> bool {
return state.GetBlockAt(1, 3) == "bb";
}
inline auto state_new_century() -> State {
return State("F4x5:12111111..12bb..12........21..11....21..");
}
inline auto state_new_century_wc(const State &state) -> bool {
// What kind of brain do you need for this???
return state.state == "F4x5:21......1121..12bb..12........12111111..";
}
std::vector<StateGenerator> generators{
state_simple_1r, state_simple_2r, state_simple_3r, state_complex_1r,
state_complex_2r, state_complex_3r, state_complex_4f, state_complex_5r,
state_complex_6r, state_klotski};
state_complex_6r, state_klotski, state_century, state_super_century,
state_new_century};
std::vector<WinCondition> win_conditions{
state_simple_1r_wc, state_simple_2r_wc, state_simple_3r_wc,
state_complex_1r_wc, state_complex_2r_wc, state_complex_3r_wc,
state_complex_4f_wc, state_complex_5r_wc, state_complex_6r_wc,
state_klotski_wc};
state_klotski_wc, state_century_wc, state_super_century_wc,
state_new_century_wc};
#endif

View File

@ -162,6 +162,11 @@ auto State::ToggleTarget(int x, int y) -> bool {
return true;
}
auto State::ToggleRestricted() -> void {
restricted = !restricted;
state.replace(0, 1, restricted ? "R" : "F");
}
auto State::MoveBlockAt(int x, int y, Direction dir) -> bool {
Block block = GetBlock(x, y);
if (!block.IsValid()) {

View File

@ -266,7 +266,7 @@ auto main(int argc, char *argv[]) -> int {
} else if (IsKeyPressed(KEY_O)) {
renderer.connect_solutions = !renderer.connect_solutions;
} else if (IsKeyPressed(KEY_F)) {
current_state.restricted = !current_state.restricted;
current_state.ToggleRestricted();
previous_state = clear_masssprings(masssprings, current_state);
edited = true;
} else if (IsKeyPressed(KEY_T)) {