Hexagonal neighborhood rotate 60 degrees

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
PHPBB12345
Posts: 1096
Joined: August 5th, 2015, 11:55 pm
Contact:

Hexagonal neighborhood rotate 60 degrees

Post by PHPBB12345 » January 15th, 2017, 6:20 am

Code: Select all

-- Lua version
local g = golly()
local cells = g.getcells( g.getrect() ) 
local selectarea = g.getselrect()

cells = g.transform( cells, 0, 0 ) 
g.select( g.getrect() )
g.clear( 0 )
g.select( selectarea )
g.putcells( cells, 0, 0, 1, -1, 1, 0 ) 

Post Reply