Allow clue generation
Why?
It might be interesting to generate clues at the same time as generating crossword grid.
What?
For cli, it could be:
- New subcommand
clue
for accessing the clue service:- New subcommand
list-providers
:croiseur-cli clue list-providers
- New subcommand
create
(not sure of the name):croiseur-cli clue create <word> [<word>...]
- New subcommand
- New flag
--clues
to the existingsolver run
subcommand to generate clues at the same time as filling the grid:- Example
croiseur-cli solver run --size 3x3 --clues
- Example
GUI impact not envisioned yet.
How?
- Create a provider interface
ClueProvider
incroiseur-spi/croiseur-spi-clue
, e.g. something like:
/**
* Provides crossword clues.
*/
public interface ClueProvider {
/**
* The clue provider's name.
*
* @return the clue provider's name
*/
String name();
/**
* A short description of the clue provider.
*
* @return a short description of the clue provider
*/
String description();
/**
* Generates a clue for a single word.
*
* @param word the word to define
* @return the clue or {@link Optional#empty()} if word couldn't be defined
*/
default Optional<String> define(final String word) {
return Optional.ofNullable(define(List.of(word)).get(word));
}
/**
* Creates clues for the given words.
*
* @param words the words to define
* @return clues indexed by the defined word; Map may be empty or incomplete
*/
Map<String, String> define(final List<String> words);
}
Tasks
-
Create Clue Provider interface -
Create example implementation -
Impact CLI frontend -
Impact GUI frontend
Edited by Antoine Belvire