about summary refs log tree commit diff stats
path: root/ext/wittle_generator/wittle_generator.cpp
blob: e8f2dba9c2f96ccab37ee0960a294febf9dd24fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <rice/rice.hpp>

#include "Generate.h"

Rice::Object wittle_generator_generate(Rice::Object /* self */) {
  Generate generator;
  // generator.setFlag(Generate::RegularStartEnd);
  /*generator.generate(4 * 2 + 1, 4 * 2 + 1,
                     {{{Decoration::Triangle | Decoration::Orange, 6}}});*/
  // generator.setSymmetry(Panel::Vertical);
  generator.setSymbol(Decoration::Exit, 0, 0);
  generator.setSymbol(Decoration::Exit, 7 * 2, 0);
  generator.setSymbol(Decoration::Exit, 7 * 2, 7 * 2);
  generator.generate(7 * 2 + 1, 7 * 2 + 1,
                     {{{Decoration::Stone | Decoration::Color::White, 10},
                       {Decoration::Stone | Decoration::Color::Black, 10},
                       {Decoration::Dot, 10},
                       {Decoration::Start, 2}}});

  Rice::String str(generator.AsCode());
  return str;
}

extern "C" void Init_wittle_generator() {
  Rice::Class rb_cWittleGenerator =
      Rice::define_class("WittleGenerator")
          .define_method("generate", &wittle_generator_generate);
}