about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ext/wittle_generator/wittle_generator.cpp74
1 files changed, 73 insertions, 1 deletions
diff --git a/ext/wittle_generator/wittle_generator.cpp b/ext/wittle_generator/wittle_generator.cpp index 0e86b27..7951d15 100644 --- a/ext/wittle_generator/wittle_generator.cpp +++ b/ext/wittle_generator/wittle_generator.cpp
@@ -4,6 +4,20 @@
4#include "Generate.h" 4#include "Generate.h"
5#include "Random.h" 5#include "Random.h"
6 6
7void MakeSecretSymmetryGrid(Generate& generator) {
8 for (int x : {0, 6, 8, 14}) {
9 for (int y : {0, 6, 8, 14}) {
10 generator.setSymbol(Decoration::Start, x, y);
11 }
12 }
13 for (int x : {0, 14}) {
14 for (int y : {2, 4, 10, 12}) {
15 generator.setSymbol(Decoration::Exit, x, y);
16 generator.setSymbol(Decoration::Exit, y, x);
17 }
18 }
19}
20
7Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) { 21Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) {
8 Generate generator; 22 Generate generator;
9 23
@@ -1051,7 +1065,7 @@ Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) {
1051Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { 1065Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) {
1052 Generate generator; 1066 Generate generator;
1053 1067
1054 int choice = Random::rand() % 46; 1068 int choice = Random::rand() % 50;
1055 std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl; 1069 std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl;
1056 1070
1057 switch (choice) { 1071 switch (choice) {
@@ -1608,6 +1622,64 @@ Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) {
1608 {Decoration::Stone | Decoration::Color::Yellow, 3}}}); 1622 {Decoration::Stone | Decoration::Color::Yellow, 3}}});
1609 break; 1623 break;
1610 } 1624 }
1625 case 46: {
1626 generator.setGridSize(7, 7);
1627 generator.setSymmetry((Random::rand() % 2) == 0
1628 ? Panel::Symmetry::Vertical
1629 : Panel::Symmetry::Horizontal);
1630 generator.setFlag(Generate::WriteInvisible);
1631 generator.setFlag(Generate::DisableDotIntersection);
1632 MakeSecretSymmetryGrid(generator);
1633 generator.generate(
1634 7, 7,
1635 {{{Decoration::Dot | Decoration::Color::Cyan, 2},
1636 {Decoration::Dot | Decoration::Color::Yellow, 2},
1637 {Decoration::Triangle | Decoration::Color::Orange, 4}}});
1638 break;
1639 }
1640 case 47: {
1641 generator.setGridSize(7, 7);
1642 generator.setSymmetry((Random::rand() % 2) == 0
1643 ? Panel::Symmetry::ParallelH
1644 : Panel::Symmetry::ParallelV);
1645 generator.setFlag(Generate::WriteInvisible);
1646 generator.setFlag(Generate::DisableDotIntersection);
1647 MakeSecretSymmetryGrid(generator);
1648 generator.generate(
1649 7, 7,
1650 {{{Decoration::Dot | Decoration::Color::Cyan, 2},
1651 {Decoration::Dot | Decoration::Color::Yellow, 2},
1652 {Decoration::Triangle | Decoration::Color::Orange, 4}}});
1653 break;
1654 }
1655 case 48: {
1656 generator.setGridSize(7, 7);
1657 generator.setSymmetry(Panel::Symmetry::Rotational);
1658 generator.setFlag(Generate::WriteInvisible);
1659 generator.setFlag(Generate::DisableDotIntersection);
1660 MakeSecretSymmetryGrid(generator);
1661 generator.generate(
1662 7, 7,
1663 {{{Decoration::Dot | Decoration::Color::Cyan, 2},
1664 {Decoration::Dot | Decoration::Color::Yellow, 2},
1665 {Decoration::Triangle | Decoration::Color::Orange, 4}}});
1666 break;
1667 }
1668 case 49: {
1669 generator.setGridSize(7, 7);
1670 generator.setSymmetry((Random::rand() % 2) == 0
1671 ? Panel::Symmetry::ParallelHFlip
1672 : Panel::Symmetry::ParallelVFlip);
1673 generator.setFlag(Generate::WriteInvisible);
1674 generator.setFlag(Generate::DisableDotIntersection);
1675 MakeSecretSymmetryGrid(generator);
1676 generator.generate(
1677 7, 7,
1678 {{{Decoration::Dot | Decoration::Color::Cyan, 2},
1679 {Decoration::Dot | Decoration::Color::Yellow, 2},
1680 {Decoration::Triangle | Decoration::Color::Orange, 4}}});
1681 break;
1682 }
1611 } 1683 }
1612 1684
1613 Rice::String str(generator.AsCode()); 1685 Rice::String str(generator.AsCode());