Skip to content

Commit c5569f6

Browse files
committed
Launch and test the expanded Battleworld family adventure
1 parent 4b7c296 commit c5569f6

6 files changed

Lines changed: 93 additions & 2 deletions

File tree

‎Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ build/headless-lua: $(HEADLESS_LUA_SOURCES)
163163
@mkdir -p build
164164
$(CC) -O2 -DLUA_USE_MACOSX -Ivendor/lua-5.4.8/src -o $@ $(HEADLESS_LUA_SOURCES)
165165

166+
# Family playtest of the bilingual adventure using the bundled interpreter.
167+
BATTLEWORLD_LANGUAGE ?= en
168+
.PHONY: battleworld
169+
battleworld: build/headless-lua
170+
cd apps/adventure-arena/zilscript && ../../../build/headless-lua main.lua --companion books.$(BATTLEWORLD_LANGUAGE).last-door-of-battleworld.last-door-of-battleworld
171+
166172
.PHONY: studio-test studio-smoke
167173
studio-smoke:
168174
python3 scripts/ipad/studio_smoke.py $(if $(STUDIO_SMOKE_DEVICE),--device $(STUDIO_SMOKE_DEVICE))
@@ -172,7 +178,7 @@ studio-test: build/headless-lua
172178
LUA_PATH='./?.lua;./lua/?.lua;./lua/vendor/etlua/?.lua;;' build/headless-lua "$$test"; \
173179
done
174180

175-
test: $(LUA_OBJC_BIN) $(FRAMEWORK_MODULES) $(NATIVE_PLUGINS) $(PARITY_IMAGE_DIFF)
181+
test: build/headless-lua $(LUA_OBJC_BIN) $(FRAMEWORK_MODULES) $(NATIVE_PLUGINS) $(PARITY_IMAGE_DIFF)
176182
@passed=0; failed=0; \
177183
for t in $(TEST_FILES); do \
178184
echo "--- $$t ---"; \

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ External testing still requires the applicable Beta App Review.
575575

576576
Apple documents [Mac Store package signing](https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution).
577577

578+
### Play Battleworld together
579+
580+
Run `make battleworld` for the English edition or
581+
`make battleworld BATTLEWORLD_LANGUAGE=ru` for Russian. From the first
582+
menu, choose a hero and take turns reading and deciding what to
583+
try. The [family play guide](apps/adventure-arena/zilscript/books/en/last-door-of-battleworld/README.md)
584+
also covers typed commands.
585+
578586
### Adventure Arena tour screenshots
579587

580588
The first-launch guide uses real iPhone reader captures in light and dark.

‎apps/adventure-arena/zilscript‎

Submodule zilscript updated 32 files
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
local t = require("TestKit")
2+
local root = "apps/adventure-arena/zilscript"
3+
local pwd = assert(io.popen("pwd"))
4+
local interpreter = pwd:read("l") .. "/build/headless-lua"
5+
pwd:close()
6+
local function output(story)
7+
local pipe = assert(io.popen("cd " .. root .. " && " .. interpreter .. " main.lua --companion " .. story .. " </dev/null 2>&1"))
8+
local text = pipe:read("a")
9+
t.expect(pipe:close(), story .. " starts successfully")
10+
return text
11+
end
12+
for _, case in ipairs({
13+
{ "books.en.last-door-of-battleworld.last-door-of-battleworld", "What will you do?", "In this scene", "Choose a number" },
14+
{ "books.ru.last-door-of-battleworld.last-door-of-battleworld", "Что вы будете делать?", "Здесь", "Выберите номер или введите команду" },
15+
{ "books.de.blackout-at-meridian.blackout-at-meridian", "Was möchtest du tun?", "An diesem Ort", "Wähle eine Nummer" },
16+
}) do
17+
local text = output(case[1])
18+
for index = 2, 4 do
19+
t.expect(text:find(case[index], 1, true) ~= nil, case[1] .. " displays " .. case[index])
20+
end
21+
end
22+
os.exit(t.summary() and 0 or 1)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
local t = require("TestKit")
2+
local Suggestions = require("apps.adventure-arena.zilscript.zilscript.reader.Suggestions")
3+
4+
local key = { target = "brass key", noun = "key", aliases = { "key", "passkey" } }
5+
local door = { target = "oak door", noun = "door", aliases = { "door" } }
6+
local function complete(input, items)
7+
return Suggestions.forInput(input, items, function(offer)
8+
offer("unlock", door, "with", key)
9+
offer("put", key, "in", door)
10+
end)
11+
end
12+
local function has(input, items, title, text)
13+
for _, choice in ipairs(complete(input, items)) do
14+
if choice.title == title and choice.text == text then return true end
15+
end
16+
return false
17+
end
18+
19+
t.expect(has("put passkey ", { key, door }, "in", "put passkey in "),
20+
"an object's parser synonym continues to the preposition")
21+
t.expect(has("put passkey in ", { key, door }, "door", "put passkey in door "),
22+
"a synonym preserves the typed command while completing its second object")
23+
t.expect(has("unlock door with ", { key, door }, "key", "unlock door with key "),
24+
"a normal noun still reaches the second object")
25+
local other = { target = "iron key", noun = "key", aliases = { "key", "passkey" } }
26+
t.expect(not has("put passkey ", { key, door, other }, "in", "put passkey in "),
27+
"an ambiguous synonym does not advance as if it identified one object")
28+
os.exit(t.summary() and 0 or 1)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
local t = require("TestKit")
2+
package.path = "apps/adventure-arena/zilscript/?.lua;apps/adventure-arena/zilscript/?/init.lua;" .. package.path
3+
local Story = require("apps.adventure-arena.zilscript.zilscript.reader.Story")
4+
local story = Story.of("books/en/last-door-of-battleworld", "apps/adventure-arena/zilscript")
5+
local function contains(list, value)
6+
for _, path in ipairs(list) do if path == value then return true end end
7+
return false
8+
end
9+
for _, part in ipairs({ "en", "early", "village", "late" }) do
10+
local path = "books/en/last-door-of-battleworld/" .. part .. ".zil"
11+
t.expect(contains(story.words, path), "vocabulary checks read " .. path)
12+
t.expect(contains(story.declarations, path), "parser checks read declarations in " .. path)
13+
t.expect(contains(story.sources, path), "link checks read " .. path)
14+
end
15+
for _, part in ipairs({ "logic", "rules", "early", "village", "late" }) do
16+
local path = "books/shared/last-door-of-battleworld/" .. part .. ".zil"
17+
t.expect(contains(story.sources, path), "link checks read shared " .. path)
18+
end
19+
local make = assert(io.popen("make -s -n -C apps/adventure-arena/zilscript lint-zil"))
20+
local commands = make:read("a")
21+
make:close()
22+
local vocabulary = commands:match("lua5%.4 scripts/check%-vocab%.lua ([^\n]+)") or ""
23+
for _, part in ipairs({ "en", "early", "village", "late" }) do
24+
t.expect(vocabulary:find("books/en/last-door-of-battleworld/" .. part .. ".zil", 1, true) ~= nil,
25+
"make passes the " .. part .. " edition file to vocabulary lint")
26+
end
27+
os.exit(t.summary() and 0 or 1)

0 commit comments

Comments
 (0)