Allow to save/re-open crosswords
The goal is to allow to save then re-open crosswords created by croiseur. See #6 (closed) for importing/exporting crosswords from/to other source/software.
Why?
This is an enabler for use-cases like:
- Resume the creation of a crossword that is not finished yet;
- Create new grids from existing grid template.
What?
Introduce the notion of a puzzle repository, where all puzzles known to croiseur are stored. Repository will be defined as a SPI (see How? section), with CRUD operations. Implementation will probably just be files on disk.
Croiseur should expose functions to manage this repository.
-
cli
:- New
puzzle
subcommand with subcommands:-
ls
: List available puzzle in puzzle repository -
cat PUZZLE
: Displays the given puzzle from repository -
rm PUZZLE
: Delete the given puzzle from repository -
(optionally)
add|import PUZZLE_FILE
: Decodes and adds given puzzle to the puzzle repository – depends on #6 (closed) as it needs a puzzle-codec SPI and implementations for common puzzle formats. May be done here or in #6 (closed) or in a separated ticket depending on how the developments of #6 (closed) and of this ticket go.
-
- Modification to the
solver run
subcommand:- Allow to pass a puzzle name instead of a puzzle definition.
- Puzzle should be saved to repository before solver start (if it doesn't exist) and updated upon solver success
- New
-
gui
: TBD
How?
common
- Create a proper type for a puzzle in, which for starting, may only include the grid definition (type already exists,
GridDefinition
, which may be renamed), but later will definitely include some metadata.
spi-puzzle-repository
- Create CRUD repository interface. Identifier type to be defined.
spi-presenter
- Add
PuzzlePresenter
:-
presentPuzzle
: Presents a puzzle loaded from repository -
presentPuzzleList
: Presents a list of the puzzles currently present in repository -
presentPuzzleError
: Presents errors related to puzzle management
-
core
- Adds a
PuzzleService
:-
create
: Adds a puzzle to repository (just forwards the call to puzzle repository SPI) -
update
: Updates a puzzle in repository (just forwards the call to puzzle repository SPI) -
delete
: Removes a puzzle from repository (just forwards the call to puzzle repository SPI) -
list
: Lists the puzzles from repository (calls the puzzle repository SPI and forward results to present). -
load
: Loads the given puzzle from repository then call the presenter method
-
-
SolverService
- Allow to take a puzzle from repository as input (new method with stored puzzle type or just puzzle identifier type - types to be defined in spi-puzzle-repository)
- Create the puzzle into repository if it doesn't exist yet
- Update the puzzle upon success
cli
Should be straightforward, detail if needed.
gui
TBD.
puzzle-repository-TBD-plugin
The repository implementation. Maybe start with a puzzle-repository-memory-plugin
to verify the behaviour of core
.
There will definitely be exchanges with #6 (closed) for actual persisted format - tend to think it should be simple files at this point, maybe ipuz files, maybe xd files.