Move and remove test files

This commit is contained in:
Pasi Kallinen
2019-11-07 19:32:36 +02:00
parent 4e438e0146
commit 6f5a50a538
6 changed files with 0 additions and 309 deletions

99
x.lua
View File

@@ -1,99 +0,0 @@
-- s = string.format("(%i,%i),[%i,%i,%i]", u.ux, u.uy, u.dx, u.dy, u.dz);
-- nh.pline(s);
nh.test({ x = 3, y = 7, name="foo" });
local l = nh.getmap(u.ux, u.uy);
nh.pline(string.format("map(%i,%i): glyph=%i, typ=%i, lit=%i, candig=%i",
u.ux, u.uy,
l.glyph, l.typ, l.lit, l.candig));
-- nh.pline("lit: " .. x.lit .. ". ")
-- str = nh.getlin("What do you call it?");
-- nh.verbalize("Hello, this is " .. str .. " speaking");
-- nh.pline("COLNOxROWNO=(" .. nhc.COLNO .. "x" .. nhc.ROWNO .. ")")
-- local opts = { a = "valinta a", b = "bbbbb", c = "option c" }
-- local ret = nh.menu("Chooooooose one", "a", "one", opts)
-- nh.pline("You chose: '" .. ret .. "', that is: '" .. opts[ret] .. "'");
-- nh.pline("makeplural: " .. nh.makeplural("zorkmid"));
-- nh.pline("makesingular: " .. nh.makesingular("zorkmids"));
-- local opts = {
-- { key = "a", text = "valinta a" },
-- { key = "b", text = "bbbbb" },
-- { key = "c", text = "option c" }
-- }
--local ret = nh.menu("Choose one (1)", nil, nil, opts)
--nh.pline("You chose: '" .. ret .. "'")
--local ret = nh.menu("Choose one (2)", opts)
--nh.pline("You chose: '" .. ret .. "'")
--[[
nh.level_init({
style = "none", -- or "fill", "grid", "mines", "rogue"
filling = "tree",
init_present = 1,
padding = 1,
fg = "floor",
bg = "wall",
smoothed = 0,
joined = 1,
lit = -1,
walled = 0,
icedpools = 0
});
nh.level_flags({"noteleport", "hardfloor"});
nh.message("What a strange feeling!");
nh.map({horiz = "center",
vert = "center",
map = "
.....
.L.L.
.....
" });
nh.monster({
class = "V",
typename = "vampire",
coord = {5, 10},
name = "Phil",
attitude = "peaceful",
alertness = "asleep",
alignment = "lawful",
-- appearance = ...?
female = 1,
invisible = 1,
cancelled = 1,
revived = 1,
avenge = 1,
fleeing = 23,
blinded = 23,
paralyzed = 23,
stunned = 1,
confused = 1,
seentraps = { "pit", "magic trap" }, -- could be "all"
-- how to add inventory for this monster?
-- should be able to just directly set struct monst fields
});
nh.object({
});
-- ]]

210
y.lua
View File

@@ -1,210 +0,0 @@
-- run tests on the des-level commands
-- des.level_init({ style = "mines", joined = 1, lit = 1 });
-- des.level_init({ style = "mazegrid", lit = 1 });
-- des.level_init({ style = "solidfill" });
-- des.level_init({ style = "rogue" });
des.level_init();
function selection_tests ()
-- OO style
local sel = selection.new();
sel:get(1, 2);
sel:set(1, 2);
sel:negate();
sel:percentage(50);
sel:rndcoord(1);
sel:line(1,2, 50,20);
sel:randline(1,2, 50,20, 7);
sel:rect(1,2, 7,8);
sel:fillrect(1,2, 7,8);
sel:area(1,2, 7,8);
sel:grow();
sel:filter_mapchar(' ');
sel:floodfill(1,1);
sel:circle(40, 10, 9);
sel:circle(40, 10, 9, 1);
sel:ellipse(40, 10, 20, 8);
sel:ellipse(40, 10, 20, 8, 1);
-- initializers
selection.set(1, 2);
selection.negate();
selection.line(1,2, 50,20);
selection.randline(1,2, 50,20, 7);
selection.rect(1,2, 7,8);
selection.fillrect(1,2, 7,8);
selection.area(1,2, 7,8);
selection.floodfill(1,1);
selection.circle(40, 10, 9);
selection.circle(40, 10, 9, 1);
selection.ellipse(40, 10, 20, 8);
selection.ellipse(40, 10, 20, 8, 1);
-- variable as param
selection.get(sel, 1, 2);
selection.set(sel, 1, 2);
selection.negate(sel);
selection.percentage(sel, 50);
selection.rndcoord(sel, 1);
selection.line(sel, 1,2, 50,20);
selection.randline(sel, 1,2, 50,20, 7);
selection.rect(sel, 1,2, 7,8);
selection.fillrect(sel, 1,2, 7,8);
selection.area(sel, 1,2, 7,8);
selection.grow(sel);
selection.filter_mapchar(sel, ' ');
selection.floodfill(sel, 1,1);
selection.circle(sel, 40, 10, 9);
selection.circle(sel, 40, 10, 9, 1);
selection.ellipse(sel, 40, 10, 20, 8);
selection.ellipse(sel, 40, 10, 20, 8, 1);
end -- selection_tests()
-- set coordinate 4,5 to value 1
-- selection.set(sel, 4, 5);
-- set coordinate 7,7 to value 1
-- sel:set(7, 7);
-- set 5,5 to value 2
-- sel:set(5,5, 2);
-- get 3 coordinates, removing the coordinates from the selection
-- local tx1, ty1 = selection.rndcoord(sel, 1);
-- local tx2, ty2 = selection.rndcoord(sel, 1);
-- local tx3, ty3 = selection.rndcoord(sel, 1);
-- filter randomly 50% of the selection
-- local sel2 = selection.percentage(sel, 50);
-- negate the selection
-- local sel3 = selection.negate(sel);
-- negate first, then 50%
-- local sel4 = selection.percentage(selection.negate(sel), 50);
-- local yyy = sel:get(6, 7);
-- des.mazewalk({ x = 4, y = 6, stocked = 0 });
-- draw a line from (1,1) to (40,15)
-- selection.line(sel, 1,1, 40,15);
-- draw a rectangle with upper left at (1,1) to lower right at (10,10)
-- selection.rect(sel, 1,1, 10,10);
-- draw a filled rectangle with upper left at (1,1) to lower right at (10,10)
-- selection.fillrect(sel, 40,2, 50,5);
-- alias to fillrect
-- selection.area(sel, 40,2, 50,5);
-- randomized line from (73,1) to (1,20), with roughness 7
-- selection.randline(sel, 73, 1, 1, 20, 7);
-- grow selection to all directions
-- selection.grow(sel);
-- floodfill from (2,7), matching the same terrain type
-- sel:floodfill(2, 5);
-- draw a circle at (40,10) with radius 9
-- selection.circle(sel, 40, 10, 9);
-- draw a filled circle at (40,10) with radius 9
-- selection.circle(sel, 40, 10, 9, 1);
-- draw an ellipse at (40,10) with radii 20 and 8
-- selection.ellipse(sel, 40, 10, 20, 8);
-- draw a filled ellipse at (40,10) with radii 20 and 8
-- sel:ellipse(40, 10, 20, 8, 1);
-- filter selection by matching terrain
-- selection.filter_mapchar(sel, ' ');
-- set lava in the selection
local sel = selection.area(4,5, 40,10) ~ selection.rect(7,8, 60,14);
des.terrain(sel, "L");
-- des.terrain({ x = tx1, y = ty1, typ = "L" });
-- des.terrain({ x = tx2, y = ty2, typ = "T" });
-- des.terrain({ x = tx3, y = ty3, typ = "F" });
-- des.wall_property({ property = "nondiggable", x1 = 0, y1 = 0, x2 = 40, y2 = 20 });
-- des.wall_property();
des.wallify();
function test ()
rectroom = [[
----
|..|
|...
|..|
----]];
des.map({
-- halign = "center", valign = "center",
x = 5, y = 5,
keepregion = 1,
map = [[
------
|.....
|....|
|....|
.....|
|....|
|....|
------]]});
--[[
for i = 0, 5 do
xp = math.random(70);
yp = math.random(20);
-- des.message("i=" .. i .. " (" .. xp .. "," .. yp .. ")");
-- des.map({ x = xp, y = yp , map = rectroom, keepregion = 1 });
end
]]
-- des.wallify();
-- des.message("viesti");
for i = 1, 10 do
mx = i;
my = i;
des.message(i .."=(" .. mx .. "," .. my .. ")");
des.monster({ x = mx, y = my,
name = "foo" .. mx .. "x" .. my,
-- class = "F",
id = "red mold",
peaceful = 1,
asleep = 1,
female = 1
});
des.object({ x = mx + 1, y = my,
-- class = "=",
id = "silver dagger",
buc = "blessed",
quantity = 1,
spe = "random"
});
end
for i = 1, 1000 do
des.object({ x = 40, y = 10,
-- class = "=",
id = "silver dagger",
buc = "blessed",
quantity = 1,
-- spe = "random"
});
end
end -- function test()