{"id":15315592,"url":"https://github.com/obsfx/kmap-solver-lib","last_synced_at":"2026-01-07T00:06:59.226Z","repository":{"id":128852448,"uuid":"319675934","full_name":"obsfx/kmap-solver-lib","owner":"obsfx","description":"This is a utility function that is using in kmap-solver to solve Karnaugh Maps up to 4 variables.","archived":false,"fork":false,"pushed_at":"2020-12-16T18:06:21.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-02T18:07:25.070Z","etag":null,"topics":["boolean-algebra","karnaugh-map","karnaugh-map-simplifier","karnaugh-map-solver","library","logic","typescript","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/kmap-solver-lib","language":"TypeScript","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/obsfx.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,"publiccode":null,"codemeta":null}},"created_at":"2020-12-08T15:13:06.000Z","updated_at":"2022-02-07T22:57:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"cdc97979-8c4e-4e7f-a0ca-8f0574f05771","html_url":"https://github.com/obsfx/kmap-solver-lib","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/obsfx%2Fkmap-solver-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsfx%2Fkmap-solver-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsfx%2Fkmap-solver-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsfx%2Fkmap-solver-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obsfx","download_url":"https://codeload.github.com/obsfx/kmap-solver-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245896812,"owners_count":20690342,"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":["boolean-algebra","karnaugh-map","karnaugh-map-simplifier","karnaugh-map-solver","library","logic","typescript","utility"],"created_at":"2024-10-01T08:51:10.685Z","updated_at":"2026-01-07T00:06:59.199Z","avatar_url":"https://github.com/obsfx.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kmap-solver-lib\n\nThis is a utility function that is using in `kmap-solver` to solve `Karnaugh Maps` up to 4 variables.\n\n\n\n## installation\n\n```\nnpm i kmap-solver-lib\n```\n\n\n\n## usage\n\n`kmap-solver-lib` takes 3 parameters and returns an object that holds `groups` and the simplified `expression`. \n\n```javascript\ntype KMapCell = {\n  binary: string;\n  decimal: number;\n  row: number;\n  col: number;\n}\n\ntype KMapResult = {\n  groups: KMapCell[][];\n  expression: string;\n}\n\nsolve(variables: string[], minterms: number[], dontcares?: number[]): KMapResult;\n```\n\n```javascript\nconst solve = require('kmap-solver-lib');\n\nconst variables = ['x', 'y', 'z'];\nconst minterms = [0, 1, 3, 4, 5, 6];\n\n// placement\n// 0 | 1\n// 2 | 3\n// 6 | 7\n// 4 | 5\n\n// optional\n// const dontcares = []\n\nsolve(variables, minterms);\n// output\n//{\n//    groups: [\n//      [\n//        { binary: '000', decimal: 0, row: 0, col: 0 },\n//        { binary: '001', decimal: 1, row: 0, col: 1 },\n//        { binary: '100', decimal: 4, row: 3, col: 0 },\n//        { binary: '101', decimal: 5, row: 3, col: 1 }\n//      ],\n//      [\n//        { binary: '011', decimal: 3, row: 1, col: 1 },\n//        { binary: '001', decimal: 1, row: 0, col: 1 }\n//      ],\n//      [\n//        { binary: '110', decimal: 6, row: 2, col: 0 },\n//        { binary: '100', decimal: 4, row: 3, col: 0 }\n//      ]\n//    ],\n//    expression: `y'+x'z+xz'`\n//}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobsfx%2Fkmap-solver-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobsfx%2Fkmap-solver-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobsfx%2Fkmap-solver-lib/lists"}