{"id":16184418,"url":"https://github.com/cbl/akari","last_synced_at":"2025-07-12T15:39:16.014Z","repository":{"id":131561071,"uuid":"602236523","full_name":"cbl/akari","owner":"cbl","description":"A solver for Akari Puzzles that uses the z3 SMT solver","archived":false,"fork":false,"pushed_at":"2023-02-15T21:44:29.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T04:11:22.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbl.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2023-02-15T19:31:46.000Z","updated_at":"2023-02-15T21:51:08.000Z","dependencies_parsed_at":"2023-03-22T15:32:41.256Z","dependency_job_id":null,"html_url":"https://github.com/cbl/akari","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbl%2Fakari","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbl%2Fakari/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbl%2Fakari/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbl%2Fakari/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbl","download_url":"https://codeload.github.com/cbl/akari/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247656146,"owners_count":20974311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-10T07:10:09.380Z","updated_at":"2025-04-07T12:46:32.416Z","avatar_url":"https://github.com/cbl.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Akari\n\nA solver for [Akari](https://www.janko.at/Raetsel/Akari) Puzzles that uses the [z3](https://github.com/Z3Prover/z3) SMT solver.\n\n## Table Of Contents\n\n-   [Introduction](#introduction)\n-   [Usage](#usage)\n-   [Documentation](#docs)\n\n\u003ca name=\"introduction\"\u003e\u003c/a\u003e\n\n## Introduction\n\n\u003e Akari (美術館, びじゅつかん, Bijutsukan, Light Up, Lighting) is a Japanese logic puzzle: place lamps in such a way that all squares are illuminated and lamps do not illuminate each other..\n\n![Akari Example](example.png)\n\nThere are 3 rules for the puzzle:\n\n1. Place light bulbs in some of the white cells so that all white cells are lit and no light bulb is lit by an other light bulb.\n2. A light bulb shines horizontally and vertically up to the next black cell or the edge of the grid.\n3. A number in a black cell indicates how many light bulbs must be placed in orthogonally adjacent cells.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n## Usage\n\nCreate a build using the following command:\n\n```sh\ncargo build --release\n```\n\nPass the puzzle to be solved via stdin...\n\n...from a file:\n\n```sh\ncat puzzles/074.txt | ./target/release/akari\n```\n\n... or from [www.janko.at](www.janko.at) using `curl`:\n\n```sh\ncurl -v --silent https://www.janko.at/Raetsel/Akari/523.a.htm 2\u003e\u00261 | sed -n -e '/problem/,/solution/ p' | sed -e '1d;$d' | ./target/release/akari\n```\n\n\u003ca name=\"docs\"\u003e\u003c/a\u003e\n\n## Documentation\n\nIn the following the construction of the formulas are described, these are implemented in [src/ankari.rs:91-238](https://github.com/cbl/akari/blob/9791015a71fb643c7111b9e6e39de102c63ffe8b/src/akari.rs#L91-L238).\n\nThe list `S` of variables is given by one or more stripes in each row, marking a range within the line that may contain **one** lamp. The domain of each strip `s ∈ S` is given by `s \u003e= s_start \u0026\u0026 s \u003c= s_end` where `s == s_end` means that no lamp is placed on the strip.\n\n![Akari Strips](strips.png)\n\nThe strips ensure that no lamps iluminate each other across lines. Now it must be ensured that bulbs do not illuminate each other across rows:\n\nTwo strips that lie across the same column cannot have the same value unless they are not placed on the board (`s == s_end`) or there is a black square between them. So for column `0` we would have the following rules:\n\n```sh\n(¬(s1 == s1_end) ∧ ¬(s2 == s2_end)) -\u003e ¬((s1 == 0) ∧ (s2 == 0))\n```\n\nRule 3 is given by the following constraints:\n\nFor the neighboring strips of a black field with a number `n ∈ {0,1,2,3,4}` the condition is fulfilled if in `n` neighboring strips bulbs are placed directly next to the black field implies that the other neighbors cannot be occupied with lamps.\n\nThis would result in the following rules for the field at position (0, 2) with the value `n=2` from the example above:\n\n```sh\n(s1 ∧ s2) \u003c-\u003e ¬s3\n(s1 ∧ s3) \u003c-\u003e ¬s2\n(s2 ∧ s3) \u003c-\u003e ¬s1\n```\n\nFinally, it must be ensured that a strip can only be empty if all fields of the strip are illuminated by strips below or above it. This leads to the following rules for `s1`:\n\n```sh\n(s2 == s_end) -\u003e ((s3 == 3) ∨ (s5 == 3) ∨ (s5 == 3) ∨ (s6 == 3) ∨ (s8 == 3))\n(s2 == s_end) -\u003e (s3 == 4)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbl%2Fakari","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbl%2Fakari","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbl%2Fakari/lists"}