Golly scripts

For scripts to aid with computation or simulation in cellular automata.
Naszvadi
Posts: 618
Joined: May 7th, 2016, 8:53 am
Contact:

Re: Golly scripts

Post by Naszvadi » June 27th, 2020, 6:31 am

Please test this script!

@dvgrn should give this pattern converter script a name due to the lack of ideas - and also further improvements to be planned like generalized hexasymm 4-state rulespace/generator for corresponding OT life-like rules etc:

Code: Select all

#!/usr/bin/python

# Pattern converter script for use with Golly.
# Author: Peter, NASZVADI (), June 2020.
# BUGGY! Do NOT use this script!

# Converts B3/S23 patterns to equivalent hexasymmcgol ones.

import golly as g

currentcellsunsorted = g.getcells(g.getrect())
currentcells = zip(currentcellsunsorted[::2], currentcellsunsorted[1::2])
newcells = {}

if not currentcells:
    g.show('No alive cells. Aborting script.')
elif g.getrule().lower() not in ['b3/s23', 'life', 'b3_s23']:
    g.show('Aborting script - not a CGoL rule: ' + g.getrule())
else:
    for i in currentcells:
        g.setcell(i[0], i[1], 0)
    g.setrule('hexasymmcgol')
    firstrow = min(currentcellsunsorted[::2])
    for i in currentcells:
        xnew = i[0] + i[1] - firstrow
        inew = (xnew // 2, i[1])
        if inew in newcells:
            newcells[inew] = 3
        else:
            newcells[inew] = 2 - xnew % 2
    for i in newcells:
        g.setcell(i[0], i[1], newcells[i])
Update #1:
The above script probably converts badly part of patterns belong to negative quarter-space, an RC2 version is here:

Code: Select all

#!/usr/bin/python

# Pattern converter script for use with Golly.
# Author: Peter, NASZVADI (), June 2020.

# Converts B3/S23 patterns to equivalent hexasymmcgol ones.

import golly as g

currentcellsunsorted = g.getcells(g.getrect())
currentcells = zip(currentcellsunsorted[::2], currentcellsunsorted[1::2])
newcells = {}

if not currentcells:
    g.show('No alive cells. Aborting script.')
elif g.getrule().lower() not in ['b3/s23', 'life', 'b3_s23']:
    g.show('Aborting script - not a CGoL rule: ' + g.getrule())
else:
    for i in currentcells:
        g.setcell(i[0], i[1], 0)
    g.setrule('hexasymmcgol')
    firstrow = min(currentcellsunsorted[::2])
    for i in currentcells:
        xnew = i[0] + i[1] - firstrow
        inew = ((xnew - (xnew % 2)) // 2, i[1])
        if inew in newcells:
            newcells[inew] = 3
        else:
            newcells[inew] = 2 - xnew % 2
    for i in newcells:
        g.setcell(i[0], i[1], newcells[i])
Attachments
hexasymmcgol.rule.gz
UNPACK it before use!
(17.86 KiB) Downloaded 11 times

Ian07
Posts: 587
Joined: September 22nd, 2018, 8:48 am

Re: Golly scripts

Post by Ian07 » August 1st, 2020, 3:17 pm

A relatively simple Life-to-SkewLife converter:

Code: Select all

"""
skew.py, by Ian07

Returns the current pattern as a pattern in SkewLife (i.e. the LifeViewer rule R2,C2,S2-3,B3,N@22a544, specifically rotated 45 degrees clockwise from the original) in the clipboard.

Probably won't work with showinviewer.lua for the moment, since Golly itself currently doesn't support custom neighborhoods.

Bugs:
-Copying doesn't appear to work consistently, and has been temporarily disabled
"""

import golly as g

cells = g.getcells(g.getrect())
g.new("output")
# Affine transformation: each orthogonal movement is mapped to a diagonal movement
g.putcells(cells, 0, 0, 1, -1, 1, 1)

# Change the rule
"""
g.select(g.getrect())
g.copy()
clip = g.getclipstr().replace("B3/S23", "R2,C2,S2-3,B3,N@22a544")
g.setclipstr(clip)
"""

User avatar
LaundryPizza03
Posts: 895
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Golly scripts

Post by LaundryPizza03 » August 9th, 2020, 7:09 am

Dictionary for converting MAP transitions to Hensel notation. The symbols 0c and 8c are used by LLS.

Code: Select all

{0: 'B0c', 1: 'B1c', 2: 'B1e', 3: 'B2a', 4: 'B1c', 5: 'B2c', 6: 'B2a', 7: 'B3i', 8: 'B1e', 9: 'B2a', 10: 'B2e', 11: 'B3a', 12: 'B2k', 13: 'B3n', 14: 'B3j', 15: 'B4a', 16: 'S0c', 17: 'S1c', 18: 'S1e', 19: 'S2a', 20: 'S1c', 21: 'S2c', 22: 'S2a', 23: 'S3i', 24: 'S1e', 25: 'S2a', 26: 'S2e', 27: 'S3a', 28: 'S2k', 29: 'S3n', 30: 'S3j', 31: 'S4a', 32: 'B1e', 33: 'B2k', 34: 'B2e', 35: 'B3j', 36: 'B2a', 37: 'B3n', 38: 'B3a', 39: 'B4a', 40: 'B2i', 41: 'B3r', 42: 'B3e', 43: 'B4r', 44: 'B3r', 45: 'B4i', 46: 'B4r', 47: 'B5i', 48: 'S1e', 49: 'S2k', 50: 'S2e', 51: 'S3j', 52: 'S2a', 53: 'S3n', 54: 'S3a', 55: 'S4a', 56: 'S2i', 57: 'S3r', 58: 'S3e', 59: 'S4r', 60: 'S3r', 61: 'S4i', 62: 'S4r', 63: 'S5i', 64: 'B1c', 65: 'B2c', 66: 'B2k', 67: 'B3n', 68: 'B2n', 69: 'B3c', 70: 'B3q', 71: 'B4n', 72: 'B2a', 73: 'B3i', 74: 'B3j', 75: 'B4a', 76: 'B3q', 77: 'B4n', 78: 'B4w', 79: 'B5a', 80: 'S1c', 81: 'S2c', 82: 'S2k', 83: 'S3n', 84: 'S2n', 85: 'S3c', 86: 'S3q', 87: 'S4n', 88: 'S2a', 89: 'S3i', 90: 'S3j', 91: 'S4a', 92: 'S3q', 93: 'S4n', 94: 'S4w', 95: 'S5a', 96: 'B2k', 97: 'B3y', 98: 'B3k', 99: 'B4k', 100: 'B3q', 101: 'B4y', 102: 'B4q', 103: 'B5j', 104: 'B3r', 105: 'B4t', 106: 'B4j', 107: 'B5n', 108: 'B4z', 109: 'B5r', 110: 'B5q', 111: 'B6a', 112: 'S2k', 113: 'S3y', 114: 'S3k', 115: 'S4k', 116: 'S3q', 117: 'S4y', 118: 'S4q', 119: 'S5j', 120: 'S3r', 121: 'S4t', 122: 'S4j', 123: 'S5n', 124: 'S4z', 125: 'S5r', 126: 'S5q', 127: 'S6a', 128: 'B1e', 129: 'B2k', 130: 'B2i', 131: 'B3r', 132: 'B2k', 133: 'B3y', 134: 'B3r', 135: 'B4t', 136: 'B2e', 137: 'B3j', 138: 'B3e', 139: 'B4r', 140: 'B3k', 141: 'B4k', 142: 'B4j', 143: 'B5n', 144: 'S1e', 145: 'S2k', 146: 'S2i', 147: 'S3r', 148: 'S2k', 149: 'S3y', 150: 'S3r', 151: 'S4t', 152: 'S2e', 153: 'S3j', 154: 'S3e', 155: 'S4r', 156: 'S3k', 157: 'S4k', 158: 'S4j', 159: 'S5n', 160: 'B2e', 161: 'B3k', 162: 'B3e', 163: 'B4j', 164: 'B3j', 165: 'B4k', 166: 'B4r', 167: 'B5n', 168: 'B3e', 169: 'B4j', 170: 'B4e', 171: 'B5c', 172: 'B4j', 173: 'B5y', 174: 'B5c', 175: 'B6c', 176: 'S2e', 177: 'S3k', 178: 'S3e', 179: 'S4j', 180: 'S3j', 181: 'S4k', 182: 'S4r', 183: 'S5n', 184: 'S3e', 185: 'S4j', 186: 'S4e', 187: 'S5c', 188: 'S4j', 189: 'S5y', 190: 'S5c', 191: 'S6c', 192: 'B2a', 193: 'B3n', 194: 'B3r', 195: 'B4i', 196: 'B3q', 197: 'B4y', 198: 'B4z', 199: 'B5r', 200: 'B3a', 201: 'B4a', 202: 'B4r', 203: 'B5i', 204: 'B4q', 205: 'B5j', 206: 'B5q', 207: 'B6a', 208: 'S2a', 209: 'S3n', 210: 'S3r', 211: 'S4i', 212: 'S3q', 213: 'S4y', 214: 'S4z', 215: 'S5r', 216: 'S3a', 217: 'S4a', 218: 'S4r', 219: 'S5i', 220: 'S4q', 221: 'S5j', 222: 'S5q', 223: 'S6a', 224: 'B3j', 225: 'B4k', 226: 'B4j', 227: 'B5y', 228: 'B4w', 229: 'B5k', 230: 'B5q', 231: 'B6k', 232: 'B4r', 233: 'B5n', 234: 'B5c', 235: 'B6c', 236: 'B5q', 237: 'B6k', 238: 'B6n', 239: 'B7c', 240: 'S3j', 241: 'S4k', 242: 'S4j', 243: 'S5y', 244: 'S4w', 245: 'S5k', 246: 'S5q', 247: 'S6k', 248: 'S4r', 249: 'S5n', 250: 'S5c', 251: 'S6c', 252: 'S5q', 253: 'S6k', 254: 'S6n', 255: 'S7c', 256: 'B1c', 257: 'B2n', 258: 'B2k', 259: 'B3q', 260: 'B2c', 261: 'B3c', 262: 'B3n', 263: 'B4n', 264: 'B2k', 265: 'B3q', 266: 'B3k', 267: 'B4q', 268: 'B3y', 269: 'B4y', 270: 'B4k', 271: 'B5j', 272: 'S1c', 273: 'S2n', 274: 'S2k', 275: 'S3q', 276: 'S2c', 277: 'S3c', 278: 'S3n', 279: 'S4n', 280: 'S2k', 281: 'S3q', 282: 'S3k', 283: 'S4q', 284: 'S3y', 285: 'S4y', 286: 'S4k', 287: 'S5j', 288: 'B2a', 289: 'B3q', 290: 'B3j', 291: 'B4w', 292: 'B3i', 293: 'B4n', 294: 'B4a', 295: 'B5a', 296: 'B3r', 297: 'B4z', 298: 'B4j', 299: 'B5q', 300: 'B4t', 301: 'B5r', 302: 'B5n', 303: 'B6a', 304: 'S2a', 305: 'S3q', 306: 'S3j', 307: 'S4w', 308: 'S3i', 309: 'S4n', 310: 'S4a', 311: 'S5a', 312: 'S3r', 313: 'S4z', 314: 'S4j', 315: 'S5q', 316: 'S4t', 317: 'S5r', 318: 'S5n', 319: 'S6a', 320: 'B2c', 321: 'B3c', 322: 'B3y', 323: 'B4y', 324: 'B3c', 325: 'B4c', 326: 'B4y', 327: 'B5e', 328: 'B3n', 329: 'B4n', 330: 'B4k', 331: 'B5j', 332: 'B4y', 333: 'B5e', 334: 'B5k', 335: 'B6e', 336: 'S2c', 337: 'S3c', 338: 'S3y', 339: 'S4y', 340: 'S3c', 341: 'S4c', 342: 'S4y', 343: 'S5e', 344: 'S3n', 345: 'S4n', 346: 'S4k', 347: 'S5j', 348: 'S4y', 349: 'S5e', 350: 'S5k', 351: 'S6e', 352: 'B3n', 353: 'B4y', 354: 'B4k', 355: 'B5k', 356: 'B4n', 357: 'B5e', 358: 'B5j', 359: 'B6e', 360: 'B4i', 361: 'B5r', 362: 'B5y', 363: 'B6k', 364: 'B5r', 365: 'B6i', 366: 'B6k', 367: 'B7e', 368: 'S3n', 369: 'S4y', 370: 'S4k', 371: 'S5k', 372: 'S4n', 373: 'S5e', 374: 'S5j', 375: 'S6e', 376: 'S4i', 377: 'S5r', 378: 'S5y', 379: 'S6k', 380: 'S5r', 381: 'S6i', 382: 'S6k', 383: 'S7e', 384: 'B2a', 385: 'B3q', 386: 'B3r', 387: 'B4z', 388: 'B3n', 389: 'B4y', 390: 'B4i', 391: 'B5r', 392: 'B3j', 393: 'B4w', 394: 'B4j', 395: 'B5q', 396: 'B4k', 397: 'B5k', 398: 'B5y', 399: 'B6k', 400: 'S2a', 401: 'S3q', 402: 'S3r', 403: 'S4z', 404: 'S3n', 405: 'S4y', 406: 'S4i', 407: 'S5r', 408: 'S3j', 409: 'S4w', 410: 'S4j', 411: 'S5q', 412: 'S4k', 413: 'S5k', 414: 'S5y', 415: 'S6k', 416: 'B3a', 417: 'B4q', 418: 'B4r', 419: 'B5q', 420: 'B4a', 421: 'B5j', 422: 'B5i', 423: 'B6a', 424: 'B4r', 425: 'B5q', 426: 'B5c', 427: 'B6n', 428: 'B5n', 429: 'B6k', 430: 'B6c', 431: 'B7c', 432: 'S3a', 433: 'S4q', 434: 'S4r', 435: 'S5q', 436: 'S4a', 437: 'S5j', 438: 'S5i', 439: 'S6a', 440: 'S4r', 441: 'S5q', 442: 'S5c', 443: 'S6n', 444: 'S5n', 445: 'S6k', 446: 'S6c', 447: 'S7c', 448: 'B3i', 449: 'B4n', 450: 'B4t', 451: 'B5r', 452: 'B4n', 453: 'B5e', 454: 'B5r', 455: 'B6i', 456: 'B4a', 457: 'B5a', 458: 'B5n', 459: 'B6a', 460: 'B5j', 461: 'B6e', 462: 'B6k', 463: 'B7e', 464: 'S3i', 465: 'S4n', 466: 'S4t', 467: 'S5r', 468: 'S4n', 469: 'S5e', 470: 'S5r', 471: 'S6i', 472: 'S4a', 473: 'S5a', 474: 'S5n', 475: 'S6a', 476: 'S5j', 477: 'S6e', 478: 'S6k', 479: 'S7e', 480: 'B4a', 481: 'B5j', 482: 'B5n', 483: 'B6k', 484: 'B5a', 485: 'B6e', 486: 'B6a', 487: 'B7e', 488: 'B5i', 489: 'B6a', 490: 'B6c', 491: 'B7c', 492: 'B6a', 493: 'B7e', 494: 'B7c', 495: 'B8c', 496: 'S4a', 497: 'S5j', 498: 'S5n', 499: 'S6k', 500: 'S5a', 501: 'S6e', 502: 'S6a', 503: 'S7e', 504: 'S5i', 505: 'S6a', 506: 'S6c', 507: 'S7c', 508: 'S6a', 509: 'S7e', 510: 'S7c', 511: 'S8c'}
Or, in list format:

Code: Select all

['B0c', 'B1c', 'B1e', 'B2a', 'B1c', 'B2c', 'B2a', 'B3i', 'B1e', 'B2a', 'B2e', 'B3a', 'B2k', 'B3n', 'B3j', 'B4a', 'S0c', 'S1c', 'S1e', 'S2a', 'S1c', 'S2c', 'S2a', 'S3i', 'S1e', 'S2a', 'S2e', 'S3a', 'S2k', 'S3n', 'S3j', 'S4a', 'B1e', 'B2k', 'B2e', 'B3j', 'B2a', 'B3n', 'B3a', 'B4a', 'B2i', 'B3r', 'B3e', 'B4r', 'B3r', 'B4i', 'B4r', 'B5i', 'S1e', 'S2k', 'S2e', 'S3j', 'S2a', 'S3n', 'S3a', 'S4a', 'S2i', 'S3r', 'S3e', 'S4r', 'S3r', 'S4i', 'S4r', 'S5i', 'B1c', 'B2c', 'B2k', 'B3n', 'B2n', 'B3c', 'B3q', 'B4n', 'B2a', 'B3i', 'B3j', 'B4a', 'B3q', 'B4n', 'B4w', 'B5a', 'S1c', 'S2c', 'S2k', 'S3n', 'S2n', 'S3c', 'S3q', 'S4n', 'S2a', 'S3i', 'S3j', 'S4a', 'S3q', 'S4n', 'S4w', 'S5a', 'B2k', 'B3y', 'B3k', 'B4k', 'B3q', 'B4y', 'B4q', 'B5j', 'B3r', 'B4t', 'B4j', 'B5n', 'B4z', 'B5r', 'B5q', 'B6a', 'S2k', 'S3y', 'S3k', 'S4k', 'S3q', 'S4y', 'S4q', 'S5j', 'S3r', 'S4t', 'S4j', 'S5n', 'S4z', 'S5r', 'S5q', 'S6a', 'B1e', 'B2k', 'B2i', 'B3r', 'B2k', 'B3y', 'B3r', 'B4t', 'B2e', 'B3j', 'B3e', 'B4r', 'B3k', 'B4k', 'B4j', 'B5n', 'S1e', 'S2k', 'S2i', 'S3r', 'S2k', 'S3y', 'S3r', 'S4t', 'S2e', 'S3j', 'S3e', 'S4r', 'S3k', 'S4k', 'S4j', 'S5n', 'B2e', 'B3k', 'B3e', 'B4j', 'B3j', 'B4k', 'B4r', 'B5n', 'B3e', 'B4j', 'B4e', 'B5c', 'B4j', 'B5y', 'B5c', 'B6c', 'S2e', 'S3k', 'S3e', 'S4j', 'S3j', 'S4k', 'S4r', 'S5n', 'S3e', 'S4j', 'S4e', 'S5c', 'S4j', 'S5y', 'S5c', 'S6c', 'B2a', 'B3n', 'B3r', 'B4i', 'B3q', 'B4y', 'B4z', 'B5r', 'B3a', 'B4a', 'B4r', 'B5i', 'B4q', 'B5j', 'B5q', 'B6a', 'S2a', 'S3n', 'S3r', 'S4i', 'S3q', 'S4y', 'S4z', 'S5r', 'S3a', 'S4a', 'S4r', 'S5i', 'S4q', 'S5j', 'S5q', 'S6a', 'B3j', 'B4k', 'B4j', 'B5y', 'B4w', 'B5k', 'B5q', 'B6k', 'B4r', 'B5n', 'B5c', 'B6c', 'B5q', 'B6k', 'B6n', 'B7c', 'S3j', 'S4k', 'S4j', 'S5y', 'S4w', 'S5k', 'S5q', 'S6k', 'S4r', 'S5n', 'S5c', 'S6c', 'S5q', 'S6k', 'S6n', 'S7c', 'B1c', 'B2n', 'B2k', 'B3q', 'B2c', 'B3c', 'B3n', 'B4n', 'B2k', 'B3q', 'B3k', 'B4q', 'B3y', 'B4y', 'B4k', 'B5j', 'S1c', 'S2n', 'S2k', 'S3q', 'S2c', 'S3c', 'S3n', 'S4n', 'S2k', 'S3q', 'S3k', 'S4q', 'S3y', 'S4y', 'S4k', 'S5j', 'B2a', 'B3q', 'B3j', 'B4w', 'B3i', 'B4n', 'B4a', 'B5a', 'B3r', 'B4z', 'B4j', 'B5q', 'B4t', 'B5r', 'B5n', 'B6a', 'S2a', 'S3q', 'S3j', 'S4w', 'S3i', 'S4n', 'S4a', 'S5a', 'S3r', 'S4z', 'S4j', 'S5q', 'S4t', 'S5r', 'S5n', 'S6a', 'B2c', 'B3c', 'B3y', 'B4y', 'B3c', 'B4c', 'B4y', 'B5e', 'B3n', 'B4n', 'B4k', 'B5j', 'B4y', 'B5e', 'B5k', 'B6e', 'S2c', 'S3c', 'S3y', 'S4y', 'S3c', 'S4c', 'S4y', 'S5e', 'S3n', 'S4n', 'S4k', 'S5j', 'S4y', 'S5e', 'S5k', 'S6e', 'B3n', 'B4y', 'B4k', 'B5k', 'B4n', 'B5e', 'B5j', 'B6e', 'B4i', 'B5r', 'B5y', 'B6k', 'B5r', 'B6i', 'B6k', 'B7e', 'S3n', 'S4y', 'S4k', 'S5k', 'S4n', 'S5e', 'S5j', 'S6e', 'S4i', 'S5r', 'S5y', 'S6k', 'S5r', 'S6i', 'S6k', 'S7e', 'B2a', 'B3q', 'B3r', 'B4z', 'B3n', 'B4y', 'B4i', 'B5r', 'B3j', 'B4w', 'B4j', 'B5q', 'B4k', 'B5k', 'B5y', 'B6k', 'S2a', 'S3q', 'S3r', 'S4z', 'S3n', 'S4y', 'S4i', 'S5r', 'S3j', 'S4w', 'S4j', 'S5q', 'S4k', 'S5k', 'S5y', 'S6k', 'B3a', 'B4q', 'B4r', 'B5q', 'B4a', 'B5j', 'B5i', 'B6a', 'B4r', 'B5q', 'B5c', 'B6n', 'B5n', 'B6k', 'B6c', 'B7c', 'S3a', 'S4q', 'S4r', 'S5q', 'S4a', 'S5j', 'S5i', 'S6a', 'S4r', 'S5q', 'S5c', 'S6n', 'S5n', 'S6k', 'S6c', 'S7c', 'B3i', 'B4n', 'B4t', 'B5r', 'B4n', 'B5e', 'B5r', 'B6i', 'B4a', 'B5a', 'B5n', 'B6a', 'B5j', 'B6e', 'B6k', 'B7e', 'S3i', 'S4n', 'S4t', 'S5r', 'S4n', 'S5e', 'S5r', 'S6i', 'S4a', 'S5a', 'S5n', 'S6a', 'S5j', 'S6e', 'S6k', 'S7e', 'B4a', 'B5j', 'B5n', 'B6k', 'B5a', 'B6e', 'B6a', 'B7e', 'B5i', 'B6a', 'B6c', 'B7c', 'B6a', 'B7e', 'B7c', 'B8c', 'S4a', 'S5j', 'S5n', 'S6k', 'S5a', 'S6e', 'S6a', 'S7e', 'S5i', 'S6a', 'S6c', 'S7c', 'S6a', 'S7e', 'S7c', 'S8c']

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

The latest edition of new-gliders.db.txt and oscillators.db.txt have 31150 spaceships and 1205 oscillators from outer-totalistic rules. You are invited to help!

Post Reply