diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-03 00:18:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-03 00:18:41 -0400 |
commit | 00641f16c889093b32b8e97a6050817f6fe43780 (patch) | |
tree | 33d0279af22ac028472d5eda0b535b58757dbc05 /ext | |
parent | 13dfac7905faac21ea98b08a0948104df8411d42 (diff) | |
download | wittle-00641f16c889093b32b8e97a6050817f6fe43780.tar.gz wittle-00641f16c889093b32b8e97a6050817f6fe43780.tar.bz2 wittle-00641f16c889093b32b8e97a6050817f6fe43780.zip |
added weird symmetries (and some more puzzles)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/wittle_generator/Panel.cpp | 8 | ||||
-rw-r--r-- | ext/wittle_generator/Panel.h | 32 | ||||
-rw-r--r-- | ext/wittle_generator/wittle_generator.cpp | 116 |
3 files changed, 132 insertions, 24 deletions
diff --git a/ext/wittle_generator/Panel.cpp b/ext/wittle_generator/Panel.cpp index 879d205..3279943 100644 --- a/ext/wittle_generator/Panel.cpp +++ b/ext/wittle_generator/Panel.cpp | |||
@@ -127,12 +127,6 @@ std::string Panel::Write() { | |||
127 | int genericFlags = 0; | 127 | int genericFlags = 0; |
128 | if (symmetry != Symmetry::None) { | 128 | if (symmetry != Symmetry::None) { |
129 | genericFlags |= Serializer::Symmetrical; | 129 | genericFlags |= Serializer::Symmetrical; |
130 | if (symmetry == Symmetry::Vertical || symmetry == Symmetry::Rotational) { | ||
131 | genericFlags |= Serializer::SymmetryX; | ||
132 | } | ||
133 | if (symmetry == Symmetry::Horizontal || symmetry == Symmetry::Rotational) { | ||
134 | genericFlags |= Serializer::SymmetryY; | ||
135 | } | ||
136 | } | 130 | } |
137 | serializer.writeByte(genericFlags); | 131 | serializer.writeByte(genericFlags); |
138 | 132 | ||
@@ -233,5 +227,7 @@ std::string Panel::Write() { | |||
233 | } | 227 | } |
234 | serializer.writeByte(settings); | 228 | serializer.writeByte(settings); |
235 | 229 | ||
230 | serializer.writeByte(symmetry); | ||
231 | |||
236 | return serializer.str(); | 232 | return serializer.str(); |
237 | } | 233 | } |
diff --git a/ext/wittle_generator/Panel.h b/ext/wittle_generator/Panel.h index d152370..3bc23c9 100644 --- a/ext/wittle_generator/Panel.h +++ b/ext/wittle_generator/Panel.h | |||
@@ -188,22 +188,22 @@ class Panel { | |||
188 | 188 | ||
189 | enum Symmetry { // NOTE - Not all of these are valid symmetries for certain | 189 | enum Symmetry { // NOTE - Not all of these are valid symmetries for certain |
190 | // puzzles | 190 | // puzzles |
191 | None, | 191 | None = 0, |
192 | Horizontal, | 192 | Horizontal = 1, |
193 | Vertical, | 193 | Vertical = 2, |
194 | Rotational, | 194 | Rotational = 3, |
195 | RotateLeft, | 195 | RotateLeft = 4, |
196 | RotateRight, | 196 | RotateRight = 5, |
197 | FlipXY, | 197 | FlipXY = 6, |
198 | FlipNegXY, | 198 | FlipNegXY = 7, |
199 | ParallelH, | 199 | ParallelH = 8, |
200 | ParallelV, | 200 | ParallelV = 9, |
201 | ParallelHFlip, | 201 | ParallelHFlip = 10, |
202 | ParallelVFlip, | 202 | ParallelVFlip = 11, |
203 | PillarParallel, | 203 | PillarParallel = 12, |
204 | PillarHorizontal, | 204 | PillarHorizontal = 13, |
205 | PillarVertical, | 205 | PillarVertical = 14, |
206 | PillarRotational | 206 | PillarRotational = 15, |
207 | }; | 207 | }; |
208 | Symmetry symmetry; | 208 | Symmetry symmetry; |
209 | 209 | ||
diff --git a/ext/wittle_generator/wittle_generator.cpp b/ext/wittle_generator/wittle_generator.cpp index c2407cf..0efac07 100644 --- a/ext/wittle_generator/wittle_generator.cpp +++ b/ext/wittle_generator/wittle_generator.cpp | |||
@@ -420,7 +420,7 @@ Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) { | |||
420 | Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { | 420 | Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { |
421 | Generate generator; | 421 | Generate generator; |
422 | 422 | ||
423 | int choice = Random::rand() % 66; | 423 | int choice = Random::rand() % 69; |
424 | std::cout << "Generate MEDIUM: choice " << std::dec << choice << std::endl; | 424 | std::cout << "Generate MEDIUM: choice " << std::dec << choice << std::endl; |
425 | 425 | ||
426 | switch (choice) { | 426 | switch (choice) { |
@@ -1015,6 +1015,33 @@ Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { | |||
1015 | {Decoration::Dot_Intersection, 25}}}); | 1015 | {Decoration::Dot_Intersection, 25}}}); |
1016 | break; | 1016 | break; |
1017 | } | 1017 | } |
1018 | case 66: { | ||
1019 | generator.setSymmetry(Panel::Symmetry::FlipNegXY); | ||
1020 | generator.generate(7, 7, | ||
1021 | {{{Decoration::Gap, 10}, | ||
1022 | {Decoration::Dot_Intersection, 8}, | ||
1023 | {Decoration::Start, 2}, | ||
1024 | {Decoration::Exit, 1}}}); | ||
1025 | break; | ||
1026 | } | ||
1027 | case 67: { | ||
1028 | generator.setSymmetry(Panel::Symmetry::ParallelV); | ||
1029 | generator.generate(7, 7, | ||
1030 | {{{Decoration::Gap, 12}, | ||
1031 | {Decoration::Dot_Intersection, 10}, | ||
1032 | {Decoration::Start, 2}, | ||
1033 | {Decoration::Exit, 1}}}); | ||
1034 | break; | ||
1035 | } | ||
1036 | case 68: { | ||
1037 | generator.setSymmetry(Panel::Symmetry::ParallelHFlip); | ||
1038 | generator.generate(7, 7, | ||
1039 | {{{Decoration::Gap, 12}, | ||
1040 | {Decoration::Dot_Intersection, 10}, | ||
1041 | {Decoration::Start, 2}, | ||
1042 | {Decoration::Exit, 1}}}); | ||
1043 | break; | ||
1044 | } | ||
1018 | } | 1045 | } |
1019 | 1046 | ||
1020 | Rice::String str(generator.AsCode()); | 1047 | Rice::String str(generator.AsCode()); |
@@ -1024,7 +1051,7 @@ Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { | |||
1024 | Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { | 1051 | Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { |
1025 | Generate generator; | 1052 | Generate generator; |
1026 | 1053 | ||
1027 | int choice = Random::rand() % 40; | 1054 | int choice = Random::rand() % 46; |
1028 | std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl; | 1055 | std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl; |
1029 | 1056 | ||
1030 | switch (choice) { | 1057 | switch (choice) { |
@@ -1497,6 +1524,91 @@ Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { | |||
1497 | {Decoration::Dot_Intersection, 36}}}); | 1524 | {Decoration::Dot_Intersection, 36}}}); |
1498 | break; | 1525 | break; |
1499 | } | 1526 | } |
1527 | case 40: { | ||
1528 | generator.setGridSize(7, 7); | ||
1529 | generator.setFlag(Generate::RequireCombineShapes); | ||
1530 | generator.setSymmetry(Panel::ParallelV); | ||
1531 | generator.setSymbol(Decoration::Start, 0, 14); | ||
1532 | generator.setSymbol(Decoration::Start, 8, 14); | ||
1533 | generator.setSymbol(Decoration::Exit, 6, 0); | ||
1534 | generator.setSymbol(Decoration::Exit, 14, 0); | ||
1535 | generator.generate(7, 7, | ||
1536 | {{{Decoration::Poly | Decoration::Color::Orange, 5}}}); | ||
1537 | break; | ||
1538 | } | ||
1539 | case 41: { | ||
1540 | generator.setGridSize(7, 7); | ||
1541 | generator.setFlag(Generate::RequireCombineShapes); | ||
1542 | generator.setSymmetry(Panel::ParallelHFlip); | ||
1543 | generator.setSymbol(Decoration::Start, 0, 14); | ||
1544 | generator.setSymbol(Decoration::Start, 14, 6); | ||
1545 | generator.setSymbol(Decoration::Exit, 0, 0); | ||
1546 | generator.setSymbol(Decoration::Exit, 14, 8); | ||
1547 | generator.generate(7, 7, | ||
1548 | {{{Decoration::Poly | Decoration::Color::Orange, 5}}}); | ||
1549 | break; | ||
1550 | } | ||
1551 | case 42: { | ||
1552 | generator.setGridSize(7, 7); | ||
1553 | generator.setFlag(Generate::RequireCombineShapes); | ||
1554 | generator.setSymmetry(Panel::ParallelVFlip); | ||
1555 | generator.setSymbol(Decoration::Start, 0, 14); | ||
1556 | generator.setSymbol(Decoration::Start, 8, 0); | ||
1557 | generator.setSymbol(Decoration::Exit, 6, 0); | ||
1558 | generator.setSymbol(Decoration::Exit, 14, 14); | ||
1559 | generator.generate(7, 7, | ||
1560 | {{{Decoration::Poly | Decoration::Color::Orange, 5}}}); | ||
1561 | break; | ||
1562 | } | ||
1563 | case 43: { | ||
1564 | generator.setSymmetry(Panel::Symmetry::RotateLeft); | ||
1565 | generator.setSymbol(Decoration::Start, 4, 4); | ||
1566 | generator.setSymbol(Decoration::Start, 10, 4); | ||
1567 | generator.setSymbol(Decoration::Start, 4, 10); | ||
1568 | generator.setSymbol(Decoration::Start, 10, 10); | ||
1569 | generator.setSymbol(Decoration::Exit, 4, 0); | ||
1570 | generator.setSymbol(Decoration::Exit, 14, 4); | ||
1571 | generator.setSymbol(Decoration::Exit, 0, 10); | ||
1572 | generator.setSymbol(Decoration::Exit, 10, 14); | ||
1573 | generator.generate( | ||
1574 | 7, 7, | ||
1575 | {{{Decoration::Triangle4 | Decoration::Color::Orange, 1}, | ||
1576 | {Decoration::Triangle | Decoration::Color::Orange, 4}}}); | ||
1577 | break; | ||
1578 | } | ||
1579 | case 44: { | ||
1580 | generator.setFlag(Generate::WriteInvisible); | ||
1581 | generator.setFlag(Generate::StartEdgeOnly); | ||
1582 | generator.setSymmetry(Panel::Symmetry::FlipXY); | ||
1583 | generator.setSymbol(Decoration::Exit, 0, 8); | ||
1584 | generator.setSymbol(Decoration::Exit, 8, 0); | ||
1585 | generator.generate(7, 7, | ||
1586 | {{{Decoration::Dot | Decoration::Color::Blue, 2}, | ||
1587 | {Decoration::Dot | Decoration::Color::Yellow, 2}, | ||
1588 | {Decoration::Dot, 8}, | ||
1589 | {Decoration::Eraser | Decoration::Color::White, 1}, | ||
1590 | {Decoration::Start, 1}}}); | ||
1591 | break; | ||
1592 | } | ||
1593 | case 45: { | ||
1594 | generator.setFlag(Generate::WriteInvisible); | ||
1595 | generator.setSymmetry(Panel::Symmetry::FlipXY); | ||
1596 | generator.setSymbol(Decoration::Start, 0, 16); | ||
1597 | generator.setSymbol(Decoration::Start, 16, 0); | ||
1598 | generator.setSymbol(Decoration::Exit, 8, 0); | ||
1599 | generator.setSymbol(Decoration::Exit, 8, 16); | ||
1600 | generator.setSymbol(Decoration::Exit, 0, 8); | ||
1601 | generator.setSymbol(Decoration::Exit, 16, 8); | ||
1602 | generator.generate( | ||
1603 | 8, 8, | ||
1604 | {{{Decoration::Triangle | Decoration::Color::Cyan, 3}, | ||
1605 | {Decoration::Triangle | Decoration::Color::Yellow, 2}, | ||
1606 | {Decoration::Star | Decoration::Color::Cyan, 3}, | ||
1607 | {Decoration::Star | Decoration::Color::Yellow, 3}, | ||
1608 | {Decoration::Stone | Decoration::Color::Cyan, 2}, | ||
1609 | {Decoration::Stone | Decoration::Color::Yellow, 3}}}); | ||
1610 | break; | ||
1611 | } | ||
1500 | } | 1612 | } |
1501 | 1613 | ||
1502 | Rice::String str(generator.AsCode()); | 1614 | Rice::String str(generator.AsCode()); |