jengine-sudoku
Sudoku under six rules - generated with one answer, graded by the logic a person uses - and Ninefold.
| Kind | Project package: linked into the builds of the projects that list it |
| Source | packages/jengine-sudoku |
| Version | 0.1.0 |
| Entry point | jengine_sudoku::SudokuPackage |
| Script namespace | Sudoku |
| Listed by | projects/arcade-classics |
Using it
Section titled “Using it”List it in the top-level "packages" array of project.jengine:
{ "packages": [ { "name": "jengine-sudoku", "source": { "type": "path", "path": "../../packages/jengine-sudoku" } } ]}Then rebuild the editor viewport for the project (jengine viewport-build projects/<name>, or the
editor’s Rebuild viewport banner). Native and web builds link it on their own.
A scene that uses its components must be a v2 scene ("version": 2): a v1 scene has no field
for a package component and keeps it as inert custom data.
A script can check that the package is linked with if Sudoku == nil then return end.
Components
Section titled “Components”| Scene key | Rust type | |
|---|---|---|
nf_board | Board | package only: needs a v2 scene |
Script commands
Section titled “Script commands”Commands run in every runtime and return nothing; a package publishes what scripts read onto components (see the notes below). The flat name also works.
| Call | Flat name |
|---|---|
Sudoku.new(e, variant, difficulty, seed) | nf_new |
Sudoku.resume(e, variant, difficulty, seed, values, notes, time, hints, mistakes) | nf_resume |
Sudoku.stop(e) | nf_stop |
Sudoku.press(e, x, y) | nf_press |
Sudoku.move(e, dx, dy) | nf_move |
Sudoku.digit(e, d) | nf_digit |
Sudoku.erase(e) | nf_erase |
Sudoku.notes(e) | nf_notes |
Sudoku.undo(e) | nf_undo |
Sudoku.hint(e) | nf_hint |
Sudoku.pause(e, paused) | nf_pause |
Sudoku.assist(e, on) | nf_assist |
Scenes that use it
Section titled “Scenes that use it”projects/arcade-classics/assets/scenes/ninefold.scene
From packages/jengine-sudoku/src/lib.rs.
Sudoku under six rules - and Ninefold, the arcade’s number puzzle.
rules says what a grid is: a list of houses (and, for Killer, cages),
so Classic, Mini (6 x 6), Diagonal, Windoku and Jigsaw are one rule over
different houses. solve counts solutions; logic solves the way a
person does and says how hard that was; generate makes a puzzle from a
seed that has exactly one answer and needs no harder logic than its
difficulty allows; game is a puzzle being played.
This module draws it. The board, the notes and the number pad are all
entities the package owns - sprites for cells and lines, world text in the
arcade’s large .font for digits - and a tap is one command,
Request::Press, hit-tested here against the same rects that were
drawn. So a game is playable with nothing but a finger, and a test plays
it by the same points.
One nf_board on a manager entity: centre and size of the board,
pad_centre and key (the number pad’s key size), font with its
digit_top / digit_height (where a digit sits in its line, which
tools/gen_tabletop_font.py prints), white (a white texture) and
round (a rounded square drawn nine-sliced for keys).
Script commands
Section titled “Script commands”| Call | Does |
|---|---|
Sudoku.new(e, variant, difficulty, seed) | a new puzzle: classic, mini, diagonal, windoku, jigsaw, killer; easy … expert |
Sudoku.resume(e, variant, difficulty, seed, values, notes, time, hints, mistakes) | the same puzzle again, with a saved grid |
Sudoku.stop(e) | clear the board |
Sudoku.press(e, x, y) | a tap at a world point: a cell selects, a key acts |
Sudoku.move(e, dx, dy) | move the selection |
Sudoku.digit(e, d) / Sudoku.erase(e) / Sudoku.notes(e) / Sudoku.undo(e) / Sudoku.hint(e) | what the keys do |
Sudoku.pause(e, paused) | stop the clock and hide the digits |
Sudoku.assist(e, on) | show wrong entries in red as they are made |
What scripts read
Section titled “What scripts read”The nf_board bag: active, variant, difficulty, seed, n,
clues, filled, cells, time, mistakes, hints, notes (note
mode), selected, solved, level (the logic grade), values and
notes_text (what nf_resume takes back), and events: started,
placed (correct), noted, erased, undone, given, hint
(text), house, solved (time, hints, mistakes), full_wrong.