# ladrilho.app
The App's logic as a module: routing (title, modes, daily, adventure, duel, play,
results, profile; settings and pause on menusKit), the mode API
(`App.startMode(id, opts)`, `App.boardEvent(ev)`, `App.finishRound(result)`,
`App.go(route)`, `App.state()`), and the setup of every kit it runs on. Driven by
`ladrilho.App`; tests and tools call it directly.
# ladrilho
The game's own parts for **Ladrilho: Block Puzzle**, a phone-first block-placement
puzzle in English and Brazilian Portuguese: drag pieces onto an 8x8 board of painted
tiles, fill rows and columns to clear them.
## The game shell
- **Title:** the Ladrilho wordmark (each letter on a painted tile), "N playing now",
your level and XP, Play, Progress and Settings.
- **Modes:** Endless (best score kept), Daily Board (the same pieces for everyone each
UTC day, a world leaderboard per day), Adventure (60 levels in five chapters on a
path map, three stars each, the next level opens when one is cleared) and Duel
(3 minutes, a friend by room code or the computer).
- **Results:** score, best / new best, today's rank, stars, XP gained, level up and
tile looks unlocked, then Play again / Next / Map / Modes / Home.
- **Progress:** saved per player account by saveKit and back after a reload: XP and
level (40 levels), twelve tile looks unlocked by level, best scores, stars.
- **Settings:** music and effects volume (menusKit), graphics quality (Graphics
Presets), language (Automatic / English / Português (Brasil), switched live, even
mid-round) and the tile look.
- Portrait first; landscape and desktop mouse layouts too.
## Modules
`ladrilho.app` (routing, the mode API), `ladrilho.App` (the component), `ladrilho.screens`,
`ladrilho.art`, `ladrilho.modes`, `ladrilho.profile`, `ladrilho.daily`, `ladrilho.duel`,
`ladrilho.board` (the seam to blockPuzzleKit), `ladrilho.lang`.
## A mode, and how it plugs in a blockPuzzleKit session
```lua
local Modes = require("ladrilho.modes")
Modes.register({
id = "endless", order = 1, icon = "infinity", route = "play",
title = "ladrilho.modes.endless", blurb = "ladrilho.modes.endless_desc",
session = function(ctx) return { board = "classic8", pieces = "classic", dealer = "merciful", look = ctx.look, seed = ctx.seed } end,
finish = function(ctx, result) ... return { title = ..., score = ..., buttons = { "again", "modes", "home" } } end,
})
-- the App: App.startMode("endless") -> mode.session(ctx) -> Board.mount(cfg, region, App.boardEvent)
-- the board: App.boardEvent{ type = "score", score, lines } / { type = "gameOver" } / { type = "goalDone", stars }
-- the end: App.finishRound(result) -> mode.finish(ctx, result) -> results screen
```
## Installed kits it runs on
- **blockPuzzleKit**: the board, pieces, dealers, scoring, level goals, drag-and-place tray and computer player.
- **menusKit**: pause and settings screens (it brings **controlsKit** with it for input).
- **saveKit**: the saved profile.
- **scoreKit**: best scores and the Daily world boards, one per day (it brings **MatchFlow** with it).
- **Graphics Presets**: the graphics quality setting.
- **Table Codes (roomsKit)**: Duel rooms, the code keypad and the computer seat.
- **announcerKit**: the clear and combo callouts.
- **soundstageCore**: music and sound effects.
- **playingNow**: the "N playing now" chip.
- **levelPathMap**: the Adventure's chapter map, given Ladrilho's palette, fonts, widgets, goal glyphs and words in `Screens.adventureSpec`.
## Words
`locales/en/ladrilho.json` and `locales/pt-BR/ladrilho.json`, with plural forms and
the language's number grouping. The Brazilian Portuguese has been reviewed
(`locales/pt-BR/ladrilho.review.json`, every line `ai_reviewed`, the review state the
catalog check takes for a translation checked by someone other than its writer).