From 6b11e2530eaaecb1e4ab75821b12521fbb44062c Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 3 Mar 2020 21:26:17 -0800 Subject: Helper for serializing all puzzles --- App/Main.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'App/Main.cpp') diff --git a/App/Main.cpp b/App/Main.cpp index 7f15236..10aac89 100644 --- a/App/Main.cpp +++ b/App/Main.cpp @@ -6,6 +6,7 @@ #include "Random.h" #include "Randomizer.h" #include "Randomizer2.h" +#include "Panels_.h" #define HEARTBEAT 0x401 #define RANDOMIZE_READY 0x402 @@ -20,6 +21,7 @@ #include "Solver.h" #include "PuzzleSerializer.h" #include +#include #define TMP1 0x501 #define TMP2 0x502 @@ -160,7 +162,29 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } break; case TMP3: - Solver::Solve(g_puzzle); + { + for (auto [key, value] : PANELS) { + std::stringstream out; + std::string name(value); + out << " {'id': 0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(5) << key << ", 'area':'"; + int k; + for (k=0; name[k] != ' '; k++) out << name[k]; + if (name[k+2] == ' ') { + out << name[k] << name[k+1]; + k += 2; + } + out << "', 'name':'"; + k++; + for (k; k < name.size(); k++) out << name[k]; + out << "', 'data':'"; + auto puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(key); + out << puzzle.Serialize(); + out << "'},\r\n"; + DebugPrint(out.str()); + } + } + + // Solver::Solve(g_puzzle); break; case TMP4: SetRandomSeed(); -- cgit 1.4.1