summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-08-15 21:53:12 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-08-15 21:53:12 +0200
commit7ad9a559fbd9ac46336d9e0689c0df4cc87e5eb9 (patch)
tree121557ba9a7d740ed3b18168e6371412cc36e2ed /misc
parent6fa296f715de6149ebf9a45b1d8d1fb11b6dd813 (diff)
downloadautomata-backgrounds-7ad9a559fbd9ac46336d9e0689c0df4cc87e5eb9.tar.gz
adjusted example rcs. added README
Diffstat (limited to 'misc')
-rw-r--r--misc/run.lua37
1 files changed, 25 insertions, 12 deletions
diff --git a/misc/run.lua b/misc/run.lua
index 0fcc030..b90f90d 100644
--- a/misc/run.lua
+++ b/misc/run.lua
@@ -25,7 +25,11 @@ GOTO http://www.luatex.org/
return 1
end
-require "life"
+mplife = {}
+mplife.setup = {}
+
+require "automata-life"
+require "automata-eca"
local C, Cs, Ct, P, R, S, match = lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S, lpeg.match
@@ -102,15 +106,8 @@ function life (current)
return 0
end
-function eca(current)
- local eca = require "eca"
- -- how many lines to draw
- current.n = tonumber(current.kv_args.n) or 30
- current.aspect = tonumber(current.kv_args.aspect) or 3/4
- current.rule = eca.gen_rule(tonumber(current.kv_args.rule) or 110)
- current.from = eca.parse_file(current.kv_args.file)
- current.framesize = math.floor(current.aspect * current.from:len())
-
+function elem(current)
+ print (current.n, type(current.n))
for n=1,current.n,1 do
gol.pre_section(current.from:len(), n)
eca.successive(current)
@@ -121,14 +118,30 @@ end
function main ()
local current = {}
current.kv_args = get_args()
- current.file = current.kv_args.file or "10x10_glider.gol"
+ current.file = current.kv_args.file
local p_suf = P"." * (1-P".")^3 * -P(1)
local p_fn = (1-p_suf)^1 * C(p_suf)
local suffix = p_fn:match(current.file) or ".gol" -- assume .gol format as default
if suffix == ".eca" then
- return eca(current)
+ require "automatarc-eca"
+ for i,j in pairs(mplife.setup.rc) do
+ current[i] = mplife.setup.rc[i]
+ end
+ current.aspect = tonumber(current.kv_args.aspect) or 3/4
+ current.rule = eca.gen_rule(tonumber(current.kv_args.rule) or 110)
+ current.from = eca.parse_file(current.kv_args.file)
+ current.framesize = math.floor(current.aspect * current.from:len())
+
+ current.n = tonumber(current.kv_args.n)
+ end
+
+ current.n = tonumber(current.kv_args.n)
+
+ if suffix == ".eca" then
+ mplife.setup.current = current
+ return elem(current)
else
return life(current)
end