summaryrefslogtreecommitdiff
path: root/module/tex/context/third
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-08-16 16:03:49 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-08-16 16:03:49 +0200
commit805134d2763b79ae1f8212092c5d76d934c88dd2 (patch)
tree94971a5a91d9c84856cf86c420bf16c4bf9baa77 /module/tex/context/third
parent04fb784929a939f3a252cb307f3d762eda4b6882 (diff)
downloadautomata-backgrounds-805134d2763b79ae1f8212092c5d76d934c88dd2.tar.gz
revised some code; updated interface.xml
Diffstat (limited to 'module/tex/context/third')
-rw-r--r--module/tex/context/third/simpleslides/automata/automata-eca.lua14
-rw-r--r--module/tex/context/third/simpleslides/automata/automata-life.lua6
-rw-r--r--module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex2
3 files changed, 6 insertions, 16 deletions
diff --git a/module/tex/context/third/simpleslides/automata/automata-eca.lua b/module/tex/context/third/simpleslides/automata/automata-eca.lua
index 27450ba..4dcf3c7 100644
--- a/module/tex/context/third/simpleslides/automata/automata-eca.lua
+++ b/module/tex/context/third/simpleslides/automata/automata-eca.lua
@@ -3,7 +3,7 @@
-- FILE: automata-eca.lua
-- DESCRIPTION: drawing elementary cellular automata
-- REQUIREMENTS: ConTeXt MkIV with Simple Slides module
--- BUGS: uncountable
+-- BUGS: uncountable minus the few I found
-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
-- VERSION: 1.0
-- CREATED: 14/08/10 19:43:35 CEST
@@ -20,10 +20,8 @@ local help = gol.helpers
local C, Cs, Ct, P, R, S, match = lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S, lpeg.match
-
eca = {}
-
function eca.parse_file (fname)
local f = assert(io.open(fname, "r"), "No such file: "..fname..".")
local init = f:read("*all")
@@ -63,7 +61,7 @@ function eca.next_line(from, rule)
--from = string.format("0%s0", from) -- too slow
local cell = C(S"01")
- local cells= Ct(cell * #(cell * cell)) / function (t)
+ local cells= Ct(cell * #(cell * cell)) / function (t) -- I ♡ LPEG
local three = t[1]..t[2]..t[3]
new = new .. rule[three]
end
@@ -99,12 +97,8 @@ end
function eca.successive (current)
local thisframe
current.from, thisframe = eca.gen_frame(current.from, current.framesize, current.rule)
- if not context then -- cli invocation
- for _,j in ipairs(thisframe) do
- io.write(j:gsub("0","·"):gsub("1","O").."\n")
- end
- else
-
+ for _,j in ipairs(thisframe) do
+ io.write(j:gsub("0","·"):gsub("1","O").."\n")
end
return 0
end
diff --git a/module/tex/context/third/simpleslides/automata/automata-life.lua b/module/tex/context/third/simpleslides/automata/automata-life.lua
index 01fc97b..5b171e2 100644
--- a/module/tex/context/third/simpleslides/automata/automata-life.lua
+++ b/module/tex/context/third/simpleslides/automata/automata-life.lua
@@ -90,8 +90,6 @@ function gol.parse_rule (raw_rule)
end
function gol.apply_rule (cell, cnt, rule, fade, keep)
- --local live, dead = "1", "0"
- --local new = dead
local new = 0
local live = "1"
local stay = rule.stay
@@ -154,8 +152,8 @@ gol.formats[".gol"] = function (fname)
local line = Cs(cell^1) / function (l)
if not len then len = string.len(l) end
if len ~= string.len(l) then
- -- inconsistent horizontal sizes; kill off program
- return nil
+ -- inconsistent horizontal sizes
+ return false
else
table.insert(tmp,l)
end
diff --git a/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex b/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex
index 0fa089a..1da3c04 100644
--- a/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex
+++ b/module/tex/context/third/simpleslides/simpleslides-s-Automaton.tex
@@ -77,7 +77,6 @@
\startsetups simpleslides:setups:blue
\definecolor [simpleslides:contrastcolor] [r=0.7,g=0.7,b=0.9]
-%\definecolor [simpleslides:backgroundcolor] [s=1]
\definecolor [simpleslides:backgroundoutside] [r=0.9,g=0.9,b=0.95]
\definecolor [simpleslides:backgroundscreen] [s=.975]
\definecolor [simpleslides:textcolor] [s=0]
@@ -85,7 +84,6 @@
\startsetups simpleslides:setups:red
\definecolor [simpleslides:contrastcolor] [r=0.4]
-%\definecolor [simpleslides:backgroundcolor] [s=.95]
\definecolor [simpleslides:backgroundoutside] [r=0.5,g=0.2,b=0.2]
\definecolor [simpleslides:backgroundscreen] [s=.4]
\definecolor [simpleslides:textcolor] [s=1]