{"id":20622330,"url":"https://github.com/smoeding/prolog-wordle","last_synced_at":"2026-03-19T16:45:56.368Z","repository":{"id":151615553,"uuid":"478674623","full_name":"smoeding/prolog-wordle","owner":"smoeding","description":"Solve wordle puzzles using Prolog","archived":false,"fork":false,"pushed_at":"2024-04-06T10:09:24.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T07:04:04.984Z","etag":null,"topics":["game","prolog","prolog-programming-language","wordle"],"latest_commit_sha":null,"homepage":"","language":"Prolog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smoeding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-04-06T18:08:22.000Z","updated_at":"2025-05-31T13:30:19.000Z","dependencies_parsed_at":"2023-05-25T00:00:45.525Z","dependency_job_id":null,"html_url":"https://github.com/smoeding/prolog-wordle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smoeding/prolog-wordle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoeding%2Fprolog-wordle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoeding%2Fprolog-wordle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoeding%2Fprolog-wordle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoeding%2Fprolog-wordle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smoeding","download_url":"https://codeload.github.com/smoeding/prolog-wordle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoeding%2Fprolog-wordle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29208161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T20:13:33.422Z","status":"ssl_error","status_checked_at":"2026-02-07T20:13:31.455Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","prolog","prolog-programming-language","wordle"],"created_at":"2024-11-16T12:22:18.046Z","updated_at":"2026-02-07T20:31:10.423Z","avatar_url":"https://github.com/smoeding.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Play Wordle using GNU Prolog\n\nThis is an implementation of the [Wordle](https://en.m.wikipedia.org/wiki/Wordle) game written in [GNU Prolog](http://www.gprolog.org).  The program tries to guess English or German words and expects updates to the knowledge base about the answers. So it can help you to play a Wordle game (try https://gridgames.app/gridwords/ for Austrian/German words).\n\n## How to play\n\nStart by consulting the code:\n\n    | ?- [wordle].\n    compiling /Users/stm/prolog-wordle/wordle.pro for byte code...\n    /Users/stm/prolog-wordle/wordle.pro compiled, 235 lines read - 15126 bytes written, 7 ms\n\nInitialize a new game by calling the `play` goal with the language to use as parameter. This will load the known words from a file. Currently only the values `english` and `german` are supported.\n\n    | ?- play(german).\n\nYou can list the possible solutions by calling the `words` goal:\n\n    | ?- words.\n    ...\n    zwick\n    zwing\n    zwirn\n    zwist\n    zyste\n    4411 candidates remain.\n\nWith the provided list of German words there are more than 4000 possible solutions when the game starts and no additional facts are added to the knowledge base.\n\nLet's start and try the word *insel*. Maybe this guess tells us the letters *i*, *e* and *l* are yellow and the letters *n* and *s* are gray. So we enter this data into the knowledge base:\n\n    | ?- yellow(i, 1), gray(n), gray(s), yellow(e, 4), yellow(l, 5).\n\nNow we can look at the remaining possibilities:\n\n    | ?- words.\n    ...\n    ylide\n    zeile\n    ziele\n    zielt\n    zille\n    93 candidates\n\nNow only 93 words are left. Let's ask Prolog about the best guess:\n\n    | ?- bestguess(Words).\n    Words = [heilt,hielt,leiht,lieht,tilde]\n\nThe program suggests to try one of these words next. It uses the following heuristic:\n* prefer words with common letters over words with rarely used letters\n* prefer words with distinct letters over words with duplicate letters\n\nLet's go for *tilde*. Now we might get the feedback, that *t* and *d* are gray, *i* and *e* are still only yellow but *l* is green. So we enter the new data into the knowledge base:\n\n    | ?- gray(t), yellow(i, 2), green(l, 3), gray(d), yellow(e, 5).\n\nThen we check the remaining solution candidates:\n\n    | ?- words.\n    celli\n    eklig\n    oelig\n    3 candidates remain.\n\nAs you can see we are down to only 3 remaining words after two guesses.\n\nYou can also use the goal `bestguess1(Word)` to ask for a single (random) word out of the remaining candidates:\n\n    | ?- bestguess1(Word).\n    Word = oelig\n\n## Implemented goals\n\nIn the following descriptions `Position` and `Number` must be an integer between `1` and `5` and `Letter` must be a single character atom.\n\n### play(+atom)\n\n`play(Language)` starts a new game. All known words for the given `Language` are loaded from a file and established as facts. Currently `Language` must be the atom `english` or `german` to load the list of words.\n\nThe goals `english` or `german` can be used as a shortcut.\n\n### green(+atom, +integer)\n\n`green(Letter, Position)` marks `Letter` as correct on `Position`.\n\nThe clause removes all words that have a different letter on the given position from the knowledge base. So effectively only words that have the letter at this position are kept in the knowledge base for subsequent searches.\n\n### yellow(+atom, +integer)\n\n`yellow(Letter, Position)` marks `Letter` as used in the solution but not on `Position`.\n\nThe clause removes all words from the knowledge base that either do not include `Letter` at all or have `Letter` on `Position`.\n\n### gray(+atom, +integer)\n\n`gray(Letter, Number)` marks `Letter` as not used in the solution if the letter occurs `Number` or more times.\n\nThe goal removes all words from the knowledge base where `Letter` occurs `Number` or more times.\n\nThe parameter `Number` should be instantiated with `1` for a letter that is only tested once and receives the gray mark.\n\n`Number` should be instantiated with `2` or a higher number to remove all words where the letter occurs more than the given number. This is needed if you try a word where a specific letter is used multiple times and the result shows different colors for the letter (e.g. once yellow and once gray).\n\n### words\n\n`words` prints a list of remaining words to the terminal.\n\n### bestguess(-list)\n\n`bestguess(Words)` instantiates `Words` with a list of words that remain as solution candidates. It uses a heuristic that prefers words with common letters.\n\n### bestguess1(-atom)\n\n`bestguess1(Word)` instantiates `Word` with a single random word that remain as solution candidates. It uses `bestguess(Words)` to produce a list of words and selects a random word from that list.\n\n## Compilation\n\nYou can compile the program into a native executable using the GNU Prolog compiler:\n\n    gplc wordle.pro\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoeding%2Fprolog-wordle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoeding%2Fprolog-wordle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoeding%2Fprolog-wordle/lists"}