Last active
November 4, 2019 05:16
-
-
Save apaap/16665595b16009e20db650fde0102cf6 to your computer and use it in GitHub Desktop.
c/98 spaceship generator for Omosso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#p392_pairs.py | |
# c/98 spaceship generator | |
# Usage: python p392_pairs.py [<start> [<stop>]] | |
# where <start> is the starting value and <stop> is the final value for the | |
# phase of the LHS (default is 0 <= phase < 196) | |
# | |
# Example usage with apgluxe: | |
# $ cd apgmera | |
# $ ./recompile.sh --rule b2k3acijr4ijqy6i7cs2aek3ijnqr4it5n --symmetry stdin_c98_pairs | |
# $ mv apgluxe apgluxe-stdin_c98_pairs | |
# $ python p392_pairs.py | ./apgluxe-stdin_c98_pairs -t 0 -L 0 -n 10000 -k <key> | |
from __future__ import print_function | |
import sys | |
import lifelib | |
import itertools | |
start = 0 | |
stop = 195 + 1 | |
if len(sys.argv) > 1: | |
start = int(sys.argv[1]) | |
if len(sys.argv) > 2: | |
stop = int(sys.argv[2]) + 1 | |
lt = lifelib.load_rules("B2k3acijr4ijqy6i7c/S2aek3ijnqr4it5n").lifetree(memory=4000) | |
p392_l = lt.pattern("""x = 38, y = 34, rule = B2k3acijr4ijqy6i7c/S2aek3ijnqr4it5n | |
2bo$b3o$2o2bo$o2b2o$o7$32bo$31bobob3o$31bo2bo2bo$30b2ob2o2bo$8bo22b6o$ | |
5b3o$4bobo2b2o$3bobob2obo$2b2o3bo$3b3obo$7bo$5b2ob2o$6b3o$7bo3$21b3o$ | |
21b4o$19b2o2bo$18bobo$18bo$18b2o$20bo!""") | |
width = p392_l.bounding_box[2] | |
p392_r = p392_l('flip_x', width-1, 0) | |
for phase in range(start, stop): | |
print('Generating c/98 pairs with phase {}.'.format(phase), file=sys.stderr) | |
lhs = p392_l[phase] | |
for dxdy in itertools.product(range(85), range(100)): | |
soup = lt.pattern() | |
soup += lhs | |
dx = width - 5 + dxdy[0] | |
dy = -50 + dxdy[1] | |
soup += p392_r(dx, dy) | |
print(soup.rle_string()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment