From a262c86b8d027e188b99e4ce57b77bae4411191d Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Fri, 1 Sep 2023 15:26:37 +0100 Subject: [PATCH] Added readme --- README.md | 33 +++++++++++++++++++++++++++++++++ riddle_creator.md | 2 +- riddle_creator_lazy.md | 2 +- riddle_definitions.md | 6 +----- 4 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b5d199 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Riddle solving and generation + +> My first is in crankshaft but not in camshaft +> My second is in sincere but not in cancer +> My third is in hardtop but not in carton +> My fourth is in deliberation but not in celebration +> My fifth is in flail but not in await +> My sixth is in both beetling and nestling +> What am I? +> +> Answer: riddle + +This repository is code written to solve and generate riddles of the form above. These programs are fully discussed on my blog in a three-part series. You should read those articles to understand how this code works and why I organised it like I did. + +1. [Solving riddles](https://work.njae.me.uk/2023/08/15/solving-riddles/) +2. [Generating riddles](https://work.njae.me.uk/2023/08/30/generating-riddles/) +3. [Optimising riddle generation](https://work.njae.me.uk/2023/09/01/optimising-riddle-generation/) + +The files here are: + +* [Riddle solver](riddle_solver.md): solves riddles given in text +* [Riddle creator](riddle_creator.md): generates new riddles, from given or random words +* [A faster riddle creator](riddle_creator_filtered.md) +* [A much faster riddle creator](riddle_creator_lazy.md) +* [Riddle definitions](riddle_definitions.md): some definitions used across the code base + +The last two creation programs use a pre-processed word list; the [pre-processor program](riddle_dict_builder.md) is also here. There is a [file that analyses the performance of the different riddle creation programs](creation_analysis.md). + +You can find the code on [my Git server](https://git.njae.me.uk/?p=riddle-generator.git;a=summary) or on [Gitlab](https://gitlab.com/NeilNjae/riddle-generator). + +## Licence + +The code here is published under the [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) licence. \ No newline at end of file diff --git a/riddle_creator.md b/riddle_creator.md index 5b4b43e..8373658 100644 --- a/riddle_creator.md +++ b/riddle_creator.md @@ -200,7 +200,7 @@ def write_riddle(riddle: Riddle) -> List[str]: ``` ```python -sample_riddle = valid_random_riddle("elephant") +sample_riddle = valid_random_riddle("riddle") sample_riddle ``` diff --git a/riddle_creator_lazy.md b/riddle_creator_lazy.md index 4af0f00..dad6932 100644 --- a/riddle_creator_lazy.md +++ b/riddle_creator_lazy.md @@ -266,7 +266,7 @@ def write_riddle(riddle: Riddle) -> List[str]: ``` ```python -sample_riddle = valid_random_riddle("elephant") +sample_riddle = valid_random_riddle("riddle") sample_riddle ``` diff --git a/riddle_definitions.md b/riddle_definitions.md index a9242f3..da25f92 100644 --- a/riddle_definitions.md +++ b/riddle_definitions.md @@ -6,17 +6,13 @@ jupyter: extension: .md format_name: markdown format_version: '1.3' - jupytext_version: 1.15.0 + jupytext_version: 1.14.5 kernelspec: display_name: Python 3 (ipykernel) language: python name: python3 --- -# Definitions generally useful for the riddle solver - -While this file is here as a Markdown file, it's intended that Jupytext will save this file as a "percent" Python file, so that it can be imported by other notebooks here. - ```python import unicodedata import re -- 2.34.1