{"id":27304773,"url":"https://github.com/bryanesmith/wormj","last_synced_at":"2025-07-12T20:12:53.839Z","repository":{"id":6915127,"uuid":"8165665","full_name":"bryanesmith/wormj","owner":"bryanesmith","description":"Clojure port of BSD game \"worm\" - the growing worm game.","archived":false,"fork":false,"pushed_at":"2013-03-22T01:48:44.000Z","size":272,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T03:33:06.466Z","etag":null,"topics":["clojure","games","growing-worm-game"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"TryGhost/Ghost","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bryanesmith.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}},"created_at":"2013-02-12T19:34:14.000Z","updated_at":"2018-01-08T00:55:19.000Z","dependencies_parsed_at":"2022-09-13T12:01:17.879Z","dependency_job_id":null,"html_url":"https://github.com/bryanesmith/wormj","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bryanesmith/wormj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanesmith%2Fwormj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanesmith%2Fwormj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanesmith%2Fwormj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanesmith%2Fwormj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryanesmith","download_url":"https://codeload.github.com/bryanesmith/wormj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryanesmith%2Fwormj/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265047848,"owners_count":23703218,"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":["clojure","games","growing-worm-game"],"created_at":"2025-04-12T03:26:39.069Z","updated_at":"2025-07-12T20:12:53.819Z","avatar_url":"https://github.com/bryanesmith.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wormj\n\nClojure port of BSD game `worm` - the growing worm game.\n\n## Notice\n\nThe game is finished. `ooooooo@`\n\n![Screenshot of wormj](https://raw.github.com/bryanesmith/wormj/master/screenshots/wormj-29.png \"Screenshot of wormj\")\n\n## Build \u0026 run\n\n1. Install [Leiningen](http://leiningen.org/#install)\n\n2. Run:\n\n        lein deps\n   \n3. You can run the application using Leiningen:\n\n        lein run\n\n  Or you can build an Uberjar and run that:\n\n        lein uberjar\n        java -jar wormj-\u003cversion\u003e-standalone.jar\n\n## Usage\n\nYou can run the application without any options, and the game will attempt to run inside a text-based terminal (Unix or Cygwin):\n\n    lein run\n\nHowever, you can specify a terminal in which to run:\n\n    lein run -t \u003cterminal\u003e\n\nTerminal options include:\n  * `auto`: attempt to use Swing-based (GUI) environment, otherwise use text-based console\n  * `swing`: use Swing-based (GUI) environment\n  * `text`: use text-based console. Attempts to use `unix` or `cygwin`\n  * `unix`\n  * `cygwin`\n\nSo the default is the same as:\n\n    lein run -t text\n\nBut if you would rather launch a Swing-based GUI environment (but fall back on text-based console):\n\n    lein run -t auto\n\n## API\n\nLet's start by initializing a game, which generates a 12x12 board, along with a worm and an apple. \n\n    (require 'wormj.functions \n             'wormj.state\n             'wormj.core :reload)\n\n    (wormj.state/init-game 12 12)\n    (wormj.core/print-game)\n\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *............*\n    ; 6 *ooooooo@.2..*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *............*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nA couple notes about `print-game`:\n  * `print-game` is intended for debugging, but is not used for rendering during game play\n  * The output of `print-game` in this section (which is shown as `; comments` below the Clojure code examples) is slightly enhanced for the sake of clarity.\n\nBy chance (though you can always override chance), the apple, `2`, randomly appears two spaces to the right of the worm.\n\nNote that the default trajectory is `:right`, so to advance one space closer to the apple, just advance the turn:\n\n    (wormj.state/advance-turn)\n    (wormj.core/print-game)\n\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *............*\n    ; 6 *.ooooooo@2..*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *............*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nAnd to consume the apple, advance the turn again:\n\n    (wormj.state/advance-turn)\n    (wormj.core/print-game)\n\n    ;   :grow-count 2\n    ;\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *............*\n    ; 6 *..ooooooo@..*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *..........9.*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nSince the worm consumes the apple, two things happen:\n  1. A new apple is randomly generated. In this example, an apple `9` appears at the `{:x 10 :y 10}` position on the board.\n  2. The worm will grow to match the nutritional value of the consumed apple. The last apple, `2`, had nutritional value of 2, so for the next two turns the worm will grow.\n\nNote that you can determine how many more turns your worm will grow:\n\n    (:grow-count @wormj.state/worm)\n\nThis turn, our worm will move up. Our worm also grows this turn, and hence its `:grow-count` is decremented:\n\n    (wormj.state/set-trajectory :up)\n    (wormj.state/advance-turn)\n    (wormj.core/print-game)\n\n    ;   :grow-count 1\n    ;\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *.........@..*\n    ; 6 *..oooooooo..*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *..........9.*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nOur worm now takes a `:right`, and grows one last time (until the next apple is consumed):\n\n    (wormj.state/set-trajectory :right)\n    (wormj.state/advance-turn)  \n    (wormj.core/print-game)\n\n    ;   :grow-count 0\n    ;\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *.........o@.*\n    ; 6 *..oooooooo..*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *..........9.*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nFinally, the worm turns `:down`. Since it is no longer growing, the worm's tail starts moving again.\n\n    (wormj.state/set-trajectory :down)\n    (wormj.state/advance-turn)  \n    (wormj.core/print-game)\n\n    ;   ┌************┐\n    ; 0 *............*\n    ; 1 *............*\n    ; 2 *............*\n    ; 3 *............*\n    ; 4 *............*\n    ; 5 *.........oo.*\n    ; 6 *...ooooooo@.*\n    ; 7 *............*\n    ; 8 *............*\n    ; 9 *............*\n    ; 0 *..........9.*\n    ; 1 *............*\n    ;   └************┘\n    ;    012345678901\n\nNote that this application has three layers:\n  1. *Functional layer* (`src/wormj/functions.clj`): pure functions.\n  2. *State layer* (`src/wormj/state.clj`): holds the game state, such as current worm and board. Also holds any impure functions (such as functions with side-effects or random generation).\n  3. *GUI layer* (`src/wormj/core.clj`): reads input, calls API, and renders output from state. Also provides functionality like `game-to-str` and `print-game` for debugging purposes.\n\nFor more examples, see associated tests.\n\n## History\n\n  * **1.0** (2013/02/18): Game completed.\n  * **0.3** (**alpha**, 2013/02/17): Game functional (including arrow keys, `hjkl`, and `HJKL`), though score not reported until game over, and script arguments ignored.\n  * **0.2** (2013/02/16): Functional API, but no GUI.\n  * **0.1** (2013/02/12): Game is non-functional while working on documentation and infrastructure.\n\n## License\n\nDistributed under [Eclipse Public License 1.0](http://opensource.org/licenses/eclipse-1.0.php), which is the same as Clojure.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanesmith%2Fwormj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryanesmith%2Fwormj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanesmith%2Fwormj/lists"}