2
\$\begingroup\$

There are many generalizations of Conway's Game of Life. One of them is the isotropic non-totalistic rulespace, in which the state of a cell in the next generation depends not just on its state and the amount of alive cells around it, but also the relative positions of the cells around it.

Given an rulestring corresponding to an isotropic non-totalistic cellular automaton, an integer \$T\$, and an initial pattern \$P\$, simulate the initial pattern \$P\$ for \$T\$ generations under the given rulestring.

Constraints

  • The given rulestring is valid and does not contain the B0 transition.
  • \$0 < T \le 10^3\$
  • Area of bounding box of \$P \le 10^3\$

Input

The rulestring, \$T\$ and \$P\$ will all be given in any necessary (specified) format.

Output

Output the resulting pattern after \$P\$ is run \$T\$ generations.

Example

Rulestring: B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c

T: 62

Pattern (in canonical RLE format):

x = 15, y = 13, rule = B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c
3b2o$2ob2o$2o4$13b2o$13b2o$3bo$2b3o$2bob2o$2bobo$2b2o!

Output:

x = 15, y = 13, rule = B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c
3b2o$2ob2o$2o4$13b2o$13b2o$3b2o$b5o$bo3bo$bo2bo$2b3o!

Scoring

This is extended , which means that the program with smallest (length in bytes - bonuses) wins.

Standard loopholes are not allowed. Your program is not allowed to use any external libraries that deal with cellular automata. Your program is expected to finish relatively quickly (in at most 10 minutes).

Bonuses:

  • 10 for finishing in under 10 seconds under max tests
  • 20 for accepting the rulestring in canonical form (e.g. B2-a/S12)
\$\endgroup\$
  • 1
    \$\begingroup\$ To clarify, can we invent a custom rulestring specifically for this challenge? And if so, how far can we go with this? Can we input a string of 'born' and 'survival' grids, which would make this a lot easier? \$\endgroup\$ – dingledooper Apr 17 at 5:04
  • \$\begingroup\$ @dingledooper Yes, you can. In fact, you can even require the rulestring be put in a file "t.h" in the form of a function int t(int a, int b, int c, int d, int e, int f, int g, int h, int i). \$\endgroup\$ – Baaing Cow Apr 17 at 7:34
  • \$\begingroup\$ +1 because I mainly investigate isotropic non-totalistic rules. I think "Hensel notation" should be mentioned in the question, though. \$\endgroup\$ – HighlyRadioactive Apr 23 at 0:09
  • \$\begingroup\$ Are you testitem by the way? (I can't think of anyone else who promote X3VI to this level) \$\endgroup\$ – HighlyRadioactive Apr 23 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.