63 |
-- some improvements in handling default cell key meanings at multichar maps |
-- some improvements in handling default cell key meanings at multichar maps |
64 |
-- 2003-04-12 -- interface of add_multiobject changed to match interface of other multiples |
-- 2003-04-12 -- interface of add_multiobject changed to match interface of other multiples |
65 |
-- 2003-04-25 -- boolean tables |
-- 2003-04-25 -- boolean tables |
66 |
|
-- 2003-06-19 -- render_puzzles accepts a 'kind' argument. Thanks to ralf! |
67 |
|
|
68 |
|
|
69 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
1084 |
-- PUZZLE GENERATOR -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- PUZZLE GENERATOR -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
1085 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
1086 |
-- see ant.lua documentation for extensive howto |
-- see ant.lua documentation for extensive howto |
1087 |
function render_puzzles(tab, generatorfunc) |
function render_puzzles(tab, kind, generatorfunc) |
1088 |
for _,val in tab do |
for _,val in tab do |
1089 |
|
local kind = kind or puzzle |
1090 |
local x,y = val.x, val.y |
local x,y = val.x, val.y |
1091 |
|
|
1092 |
local up = (tab[getkey(x, y-1)] ~= nil) or 0; |
local up = (tab[getkey(x, y-1)] ~= nil) or 0; |
1095 |
local right= (tab[getkey(x+1, y)] ~= nil) or 0; |
local right= (tab[getkey(x+1, y)] ~= nil) or 0; |
1096 |
|
|
1097 |
if (generatorfunc) then |
if (generatorfunc) then |
1098 |
generatorfunc(x,y); |
generatorfunc(val); |
1099 |
end |
end |
1100 |
|
|
1101 |
if (val.tag~=2) then |
if ((val.tag~=2) and (kind)) then |
1102 |
puzzle(x, y, getglobal("PUZ_"..up..right..down..left)) |
kind(x, y, getglobal("PUZ_"..up..right..down..left)) |
1103 |
end |
end |
1104 |
end |
end |
1105 |
end |
end |
1276 |
-- BOOLEAN TABLES -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- BOOLEAN TABLES -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
1277 |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
1278 |
-- see ant.lua documentation for extensive howto |
-- see ant.lua documentation for extensive howto |
|
-- |
|
|
-- a(C, D) -> C i D ovlivnuji jednu tabulku s metodou and |
|
|
-- o(a(C), D) -> C ovlivnuje jednu tabulku andem, tato tabulka a D ovlivnuji druhou orem |
|
1279 |
|
|
1280 |
-- bool_and tests table for and: all elements have to be '1' to succeed |
-- bool_and tests table for and: all elements have to be '1' to succeed |
1281 |
function bool_and(tab) |
function bool_and(tab) |