{"id":16358336,"url":"https://github.com/linguini1/logicgates","last_synced_at":"2025-09-06T19:42:23.402Z","repository":{"id":122591367,"uuid":"448077711","full_name":"linguini1/logicGates","owner":"linguini1","description":"The Logic Gates generator is a command line program that makes use of Python to generate logic gate schematics of (theoretically) any size, along with their Karnaugh map.","archived":false,"fork":false,"pushed_at":"2024-01-06T22:46:36.000Z","size":37,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T11:13:54.875Z","etag":null,"topics":["image-generation","karnaugh","karnaugh-map","karnaugh-maps","logic-gate","logic-gate-circuits","logic-gate-simulator","logic-gates","pixel-art","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linguini1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-01-14T19:01:49.000Z","updated_at":"2024-10-22T21:26:43.000Z","dependencies_parsed_at":"2024-01-07T00:00:24.701Z","dependency_job_id":null,"html_url":"https://github.com/linguini1/logicGates","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"618e653230421513e871d765bda36b878bdb47b5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linguini1/logicGates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguini1%2FlogicGates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguini1%2FlogicGates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguini1%2FlogicGates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguini1%2FlogicGates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linguini1","download_url":"https://codeload.github.com/linguini1/logicGates/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguini1%2FlogicGates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273955518,"owners_count":25197579,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["image-generation","karnaugh","karnaugh-map","karnaugh-maps","logic-gate","logic-gate-circuits","logic-gate-simulator","logic-gates","pixel-art","python"],"created_at":"2024-10-11T02:05:21.849Z","updated_at":"2025-09-06T19:42:23.371Z","avatar_url":"https://github.com/linguini1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logic Gates Generator\n\n### Matteo Golin\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-indigo.svg)](https://opensource.org/licenses/MIT)\n\nThe Logic Gates generator is a command line program that makes use of Python to generate logic gate schematics of\n(theoretically) any size, along with their Karnaugh map.\n\n![Example #7](./examples/example7.png)\n\n```console\nLeft side inputs: y, u, s\nTop side inputs: z, n\n\n#   00  10  11  01\n000 0   0   0   0\n100 0   0   0   0\n110 0   0   0   0\n010 0   1   1   1\n011 0   0   0   0\n111 1   0   0   0\n101 0   1   1   1\n001 0   1   1   1\n```\n\n## Usage\n\nIn order to view the specific command line commands, please run the program by typing\n`py main.py -h`\n\n### Program Parameters\n\nIn order to run effectively, the program requires the following paramters:\n\n- A filename\n- The number of random schematics to be produced (versions)\n\nThe program can also take the following parameters, but sets a default value for each.\n\n- Number of inputs (uses the maximum available amount, currently up to 26 have assets)\n- Scalar (the factor by which the image produced will be scaled)\n- Clear (if set to true, the output folder will be emptied before the program runs)\n\n## Outputs\n\nThe program will produce the schematics as PNG images, which by default are unscaled. Karnaugh maps will be created as\ntext files.\n\n**Example 4 input Karnaugh Map:**\n\n```\nLeft side inputs: a, b\nTop side inputs: c, d\n\n#  00 10 11 01\n00 1  1  1  1\n10 1  1  0  1\n11 1  1  1  1\n01 1  1  0  1\n```\n\nBy default, assets are 17x17 pixels, so the size of the image will depend on the number of inputs added. The width is\nequal to the number of inputs multiplied by 17, and the height is equal to the number of bits in the binary\nrepresentation of the number of inputs, multiplied by 2, plus one (and of course multiplied by 17 pixels).\n\n```\nFORMULA:\nn = number of inputs\nwidth = n * 12\nheight = (2 * length(binary(n)) + 1) * 17\n\nEXAMPLE:\nn = 10\nwidth = 10 * 17\nheight = (2 * length(binary(10)) + 1) * 17\n\nbinary(10) = 1010\nlength(binary(10)) = 4\nheight = (2 * 4 + 1) * 17\n```\n\nOutputted image size can be controlled by the scalar value, which will be multiplied by the width and height of the image\nto enlarge it.\n\n## Installation\n\nPython 3.10.0 or later must be installed. This software makes use of the following modules:\n\n- Numpy\n- Progress\n- PIL\n- Random\n\n## For Reviewers\n\nThe following functions could be optimized, and get quite slow when handling schematics that have large numbers of inputs:\n\n### All functions pertaining to output trees:\n\n- output_tree\n- grid_output_trees\n- evaluate_tree\n- populate_map\n\n- I have looked into graph theory to success, and also into tail recursion, but I am not sure how to implement it for this\n  purpose. Looking into these areas might be helpful?\n\n### The process for generating input combinations _in order_ for Karnaugh maps:\n\n- generate_index\n\nThe best process I could find for generating these in order requires brute forcing possible steps. Its slightly\nalgorithmic and faster than path theory, but it's far from perfect.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinguini1%2Flogicgates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinguini1%2Flogicgates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinguini1%2Flogicgates/lists"}