{"id":24156283,"url":"https://github.com/dolfost/markov-algorithm-lua","last_synced_at":"2026-06-05T22:31:24.639Z","repository":{"id":182411394,"uuid":"668451287","full_name":"Dolfost/markov-algorithm-lua","owner":"Dolfost","description":"The Lua Markov algorithm implementation","archived":false,"fork":false,"pushed_at":"2024-11-23T15:12:06.000Z","size":3055,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T13:16:24.777Z","etag":null,"topics":["computer-science","markov-algorithm","markov-algorithms","math","mathematics"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dolfost.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}},"created_at":"2023-07-19T20:56:04.000Z","updated_at":"2024-11-23T15:12:09.000Z","dependencies_parsed_at":"2023-11-10T22:22:50.105Z","dependency_job_id":"cd0889c2-b2b7-4f47-a1c5-d08d18782f2e","html_url":"https://github.com/Dolfost/markov-algorithm-lua","commit_stats":null,"previous_names":["dolfost/markov-algorithm-lua"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dolfost%2Fmarkov-algorithm-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dolfost%2Fmarkov-algorithm-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dolfost%2Fmarkov-algorithm-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dolfost%2Fmarkov-algorithm-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dolfost","download_url":"https://codeload.github.com/Dolfost/markov-algorithm-lua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241439906,"owners_count":19963146,"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":["computer-science","markov-algorithm","markov-algorithms","math","mathematics"],"created_at":"2025-01-12T13:16:30.356Z","updated_at":"2026-06-05T22:31:24.630Z","avatar_url":"https://github.com/Dolfost.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markov-algorithms-lua\n[Lua][lua]-Data-Described [Markov Algorithms][malorithms] executer.\n\n### Features\n- [x] Easy to use\n- [x] Has verbose terminal options \n- [x] Markov Algorithm itsef described as Lua table ([BibTex][bibtex]-like syntax)\n\n## Screenshots\n![Algorithms](images/algorithms.png)\n![Running](images/run1.png)\n![Running](images/run2.png)\n![Running](images/run3.png)\n![Running](images/run4.png)\n\n## Algorithms notation\n\n```lua\nmalgorithm{ -- doubles string \"aaa\" to \"aaaaaa\"\n\tname = \"double\",\n\t{[\"*a\"] = \"aa*\"},\n\t{[\"*\"] = \"\", terminating = true},\n\t{[\"a\"] = \"*a\"}\n}\n\nmalgorithm{ -- takes \"aaa-aa\" and returns \"a\" (unary)\n\tname = \"diff\",\n\t{[\"a-a\"] = \"-\"},\n\t{[\"a-\"] = \"a\", terminating = true},\n\t{[\"-a\"] = \"-a\", terminating = true},\n\t{[\"-\"] = \"\", terminating = true}\n}\n\nmalgorithm{ -- converts \"0101\" to \"aaaaa\" (binary to unary conversion)\n\tname = \"toun\",\n\t{[\"1\"] = \"0a\"},\n\t{[\"a0\"] = \"0aa\"},\n\t{[\"0\"] = \"\"}\n}\n\nmalgorithm{ -- takes \"aaa*aa\" and returns \"aaaaaa\" (unary multiplication)\n\tname = \"mult\",\n\t{[\"Ba\"] = \"aB\"},\n\t{[\"Aa\"] = \"aBA\"},\n\t{[\"A\"]  = \"\"},\n\t{[\"a*\"] = \"*A\"},\n\t{[\"*a\"] = \"*\"},\n\t{[\"*\"] = \"\"},\n\t{[\"B\"] = \"a\"},\n}\n\nmalgorithm{ -- takes \"aaaa|aa\" and returns gcd(aaaa, aa) (unary gcd)\n\tname = \"gcd\",\n\t{[\"aA\"] = \"Aa\"},\n\t{[\"a|a\"] = \"A|\"},\n\t{[\"a|\"] = \"|B\"},\n\t{[\"B\"] = \"a\"},\n\t{[\"A\"] = \"C\"},\n\t{[\"C\"] = \"a\"},\n\t{[\"|\"] = \"\"}\n}\n\nmalgorithm{ -- takes \"aaaaa/aa\" and returns \"aaRa\" (unary division with remainder)\n\tname = \"div\",\n\t{[\"*A\"] = \"Pc*\"}, -- 4\n\t{[\"cP\"] = \"Pc\"}, -- 5\n\n\t{[\"*\"] = \"\"}, -- 6\n\n\t{[\"cc\"] = \"c\"}, -- 7\n\t{[\"c\"] = \"x\"}, -- 8\n\n\t{[\"P\"] = \"a\"}, -- 9\n\n\t{[\"Aa\"] = \"aA\"}, -- 2\n\t{[\"a/a\"] = \"/A\"}, -- 1\n\n\t{[\"/aA\"] = \"/ar\"}, -- 10 \n\t{[\"rA\"] = \"Ar\"}, -- 11\n\t{[\"/a\"] = \"/\"}, -- 12\n\n\t{[\"A\"] = \"*A\"}, -- 3\n\n\t{[\"rx\"] = \"xr\"}, -- 13\n\t{[\"xr\"] = \"xRr\"}, -- 14\n\t{[\"/r\"] = \"Rr\"}, -- 15\n\n\t{[\"/\"] = \"\"}, -- 16\n\n\t{[\"r\"] = \"a\"}, -- 17\n\t{[\"x\"] = \"a\"}, -- 18\n}\n\n```\nYou can get more Lua-described Markov algorithms examples in [`sorting.lua`][sorting] and [`chains.lua`][chains].\n\n---\nTo make Your Markov algorithm to be able to run in this program You need\n* Create new `.lua` file or edit existing [`sorting.lua`][sorting] or [`chains.lua`][chains]\n* Make [Lua table][luatable] and fill its fields with:\n    - `name` field. This is used to adress You Markov algorithm with `-a` option\n    - Other tables in format `{[\"string\"] = \"replacement\"}`\n        - `terminating` field set to `true`. This is not necessary if Your algorithm designed to have no possible substitutions at the end. If so, then program ends. Also, this means that you can't have `{[\"terminating\"] = \"replacement\"}`.\n* Pass this table to `malgorithm` function. \n* Execute `markov.lua` with options `-f file.lua -a algorithm_name` at least.\n* Volia!\n\n## How to install\nApplication relies on\n- [x] [`Lua v5.3`][lua] and newer\n- [x] [`argparse v0.7.1`][argparse] and newer\n- [ ] [`luarocks`][luarocks] (optional)\n\nExample installation with [`homebrew`][brew]:\n```shell-session\n$ brew install lua luarocks\n$ luarocks install argparse\n```\n\nThen, app can be run with\n\n```\n$ lua markov.lua \u003coptions\u003e\n```\n\n Try \n\n ```\n $ lua markov.lua --help\n ```\n\n to get movin on.\n\n![Help](images/help.png)\n\n## Contributing\nIf You have any problems running markov-algorithms-lua, You are welcome at the [issues tab][issue].\n\n\n\n[issue]: https://github.com/Dolfost/markov-algorithm-lua/issues\n[malorithms]: https://en.wikipedia.org/wiki/Markov_algorithm\n\n[sorting]:https://github.com/Dolfost/markov-algorithm-lua/blob/main/sorting.lua\n[chains]: https://github.com/Dolfost/markov-algorithm-lua/blob/main/chains.lua\n\n[lua]: https://www.lua.org\n[argparse]: https://luarocks.org/modules/argparse/argparse\n[luarocks]: https://luarocks.org\n\n[bibtex]: https://en.wikipedia.org/wiki/BibTeX\n[brew]: https://brew.sh\n[luatable]: https://www.lua.org/pil/2.5.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdolfost%2Fmarkov-algorithm-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdolfost%2Fmarkov-algorithm-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdolfost%2Fmarkov-algorithm-lua/lists"}