ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

ofind

For scripts to aid with computation or simulation in cellular automata.

ofind

Postby Scorbie » September 26th, 2018, 3:38 am

Okay, this has been sitting dormant in my computer for a while, and it's certainly not polished, but reading this made me open my ofind tools:

1. Mods to ofind.c
- Reports last partial every deeping iteration (Yeah, I know it isn't much)
- Adjustable memory usage depending on RAM. (Compile with -mcmodel=medium)
- May have to compile with -m32 on Windows (AFAIK also present in the vanilla ofind.c)
I forgot the details, but line 91 can be adjusted to use more memory.
ofind.c
Slightly modified ofind.c
I edited line 91 (#define STATE_SPACE_SIZE) for memory usage
(48.5 KiB) Downloaded 188 times


2. golly frontend, ofind.lua
- Select one or two *working* partial rows from a partial oscillator in Golly.
e.g. An example selection would be the State 3,4 cells in this pattern:
Code: Select all
x = 18, y = 27, rule = LifeHistory
8.2A$4.2A.4B.2A$3.A.8B.A$3.A.A6BA.A$.3A.A.ABDCDCD3CD$A4.2ABACD2C4DC$.
3A.A6BA.3A$3.A4B2A4BA$3.BA3B2A3BAB$4.BA6BAB$5.B6AB$3.A.B6AB.A$.3A.B2A
2B2AB.3A$A4.B2A2B2AB4.A$.3A.B2A2B2AB.3A$3.A.B6AB.A$5.B6AB$4.BA6BAB$3.
BA3B2A3BAB$3.A4B2A4BA$.3A.A6BA.3A$A4.2AB2AB2A4.A$.3A.A.A2BA.A.3A$3.A.
A6BA.A$3.A.8B.A$4.2A.4B.2A$8.2A!
[[ THUMBNAIL ]]
- Run the script.
- Enter the period as 7 (or whatever period of which the oscillator you are searching for)
- The script copies the necessary rows to the clipboard.
- paste this to make an input file like this: (p7hw2.txt)
- And run ofind < p7hw2.txt (and optionally > p7hw2.log.txt to redirect the logs into a file)
b3s23
7
even
n  # symmetric completions
7
2
y

2
.o.o.ooo.
oo.o.ooo.
...o.ooo.
oo.o.ooo.
...o.ooo.
o..o.ooo.
o..o.ooo.
o.oo....o
oo.o....o
...o....o
..oo....o
oo.o....o
.o.o....o
o..o....o
Demo on how ofind interprets these files: (this file itself would not run)
ofind 0.9, D. Eppstein, 14 August 2000
Type ? at any prompt for help, or ^ to return to a previous prompt.
Rule: b3s23
Period: 7
Symmetry type (even, odd, none): even
Allow symmetric completion of patterns (yes, no): y
Rotor width: 5
Stator width: 5
Allow final stator rows to exceed width limit (yes, no): y
Maximum deepening amount:
Number of initially specified rows: 2
Specify initial phase of each row; '.'=dead, 'o'=live.
Phase 0: o
Phase 1: .
Phase 2: .
Phase 3: .
Phase 4: .
Phase 5: .
Phase 6: .
Phase 0: ...oo
Phase 1: ....o
Phase 2: ....o
Phase 3: ....o
Phase 4: o...o
Phase 5: o...o
Phase 6: oo.oo
Best wishes to you, Scorbie
User avatar
Scorbie
 
Posts: 1379
Joined: December 7th, 2013, 1:05 am

Re: ofind

Postby Scorbie » December 7th, 2018, 6:19 am

Whoops, sorry, here's ofind.lua
local g = golly()

local x, y, w, h = table.unpack(g.getselrect())
if h ~= 1 and h ~= 2 then
  g
.exit("ofind needs one or two rows to be specified...")
end

local period 
= tonumber(g.getstring("Enter the period of the osc to find."))

if h == 1 then
  local firstrows 
= {}
  for gen = 1,period do
    local firstrow 
= {}
    for i = x, x+w-1 do
      
-- g.note(g.getcell(i,y))
      table.insert(firstrow, g.getcell(i, y)==1 and "o" or ".")
    end
    table
.insert(firstrows, table.concat(firstrow))
    g.run(1)
  end
  g
.setclipstr(table.concat(firstrows, "\n") .. "\n")
elseif h == 2 then
  local firstrows
, secondrows = {}, {}
  for gen = 1,period do
    local firstrow
, secondrow = {}, {}
    for i = x, x+w-1 do
      table
.insert(firstrow, g.getcell(i, y)==1 and "o" or ".")
      table.insert(secondrow, g.getcell(i, y+1)==1 and "o" or ".")
    end
    table
.insert(firstrows, table.concat(firstrow))
    table.insert(secondrows, table.concat(secondrow))
    g.run(1)
  end
  g
.setclipstr(table.concat(firstrows, '\n') .. '\n' .. table.concat(secondrows, '\n') .. "\n")
end
Best wishes to you, Scorbie
User avatar
Scorbie
 
Posts: 1379
Joined: December 7th, 2013, 1:05 am


Return to Scripts

Who is online

Users browsing this forum: No registered users and 3 guests