{"id":21529691,"url":"https://github.com/samsamskies/tictactoe-engine","last_synced_at":"2025-08-17T13:05:44.674Z","repository":{"id":69650812,"uuid":"65688598","full_name":"SamSamskies/tictactoe-engine","owner":"SamSamskies","description":"You provide the moves and this module will handle the tictactoe game logic","archived":false,"fork":false,"pushed_at":"2016-08-16T03:41:31.000Z","size":20,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T17:29:50.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/SamSamskies.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":"2016-08-14T22:10:10.000Z","updated_at":"2016-08-15T02:14:58.000Z","dependencies_parsed_at":"2023-05-01T06:00:26.545Z","dependency_job_id":null,"html_url":"https://github.com/SamSamskies/tictactoe-engine","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"692bd22c65c0387f34ce8915a12278498211a452"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SamSamskies/tictactoe-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamSamskies%2Ftictactoe-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamSamskies%2Ftictactoe-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamSamskies%2Ftictactoe-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamSamskies%2Ftictactoe-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamSamskies","download_url":"https://codeload.github.com/SamSamskies/tictactoe-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamSamskies%2Ftictactoe-engine/sbom","scorecard":{"id":125395,"data":{"date":"2025-08-11","repo":{"name":"github.com/SamSamskies/tictactoe-engine","commit":"692bd22c65c0387f34ce8915a12278498211a452"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T03:41:41.544Z","repository_id":69650812,"created_at":"2025-08-16T03:41:41.544Z","updated_at":"2025-08-16T03:41:41.544Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270850286,"owners_count":24656478,"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-08-17T02:00:09.016Z","response_time":129,"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":[],"created_at":"2024-11-24T01:58:42.684Z","updated_at":"2025-08-17T13:05:44.605Z","avatar_url":"https://github.com/SamSamskies.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tictactoe-engine\n\nYou provide the moves and this module will handle the game logic.\n\n## Installation\nNPM\n```\n$ npm install tictactoe-engine --save\n```\n\n## Rules\n* There are 2 players 'x' and 'o'\n* 'x' always goes first \n\n\n## Usage\nES6 Module\n```js\nimport { playRound } from 'tictactoe-engine';\n\nplayRound([[0, 0]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0], [0, 2]])\n// =\u003e { currentPlayer: 'x', isWinner: true }\n```\n\nNode\n```js\nconst { playRound } = require('tictactoe-engine');\n\nplayRound([[0, 0]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0], [0, 2]])\n// =\u003e { currentPlayer: 'x', isWinner: true }\n```\n\nScript Tag\n```html\n\u003cscript src=\"node_modules/tictactoe-engine/dist/ticTacToeEngine.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nconst { playRound } = window.ticTacToeEngine;\n\nplayRound([[0, 0]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1]])\n// =\u003e { currentPlayer: 'x', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0]])\n// =\u003e { currentPlayer: 'o', isWinner: false }\n\nplayRound([[0, 0], [1, 1], [0, 1], [1, 0], [0, 2]])\n// =\u003e { currentPlayer: 'x', isWinner: true }\n\u003c/script\u003e\n```\n\nExample of Using Logic to Build an HTML TicTacToe Game\n\nDemo: https://samsamskies.github.io/tictactoe-engine/\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\"\n          content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"\u003e\n    \u003ctitle\u003eTic Tac Toe\u003c/title\u003e\n    \u003cstyle\u003e\n        body {\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            height: 100vh;\n        }\n\n        .row {\n            display: flex;\n        }\n\n        .cell {\n            width: 200px;\n            height: 200px;\n            border: 2px solid black;\n            font-size: 200px;\n            text-align: center;\n            line-height: 160px;\n            cursor: pointer;\n        }\n    \u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003cdiv class=\"board\"\u003e\n        \u003cdiv class=\"row\" data-row=\"0\"\u003e\n            \u003cdiv class=\"cell\" data-column=\"0\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"1\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"2\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"row\" data-row=\"1\"\u003e\n            \u003cdiv class=\"cell\" data-column=\"0\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"1\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"2\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"row\" data-row=\"2\"\u003e\n            \u003cdiv class=\"cell\" data-column=\"0\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"1\"\u003e\u003c/div\u003e\n            \u003cdiv class=\"cell\" data-column=\"2\"\u003e\u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n    \u003cscript src=\"node_modules/tictactoe-engine/dist/ticTacToeEngine.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n        const { playRound } = window.ticTacToeEngine;\n        \n        startGame();\n\n        function startGame () {\n            let moves = [];\n\n            document.querySelector('.board').addEventListener('click', (e) =\u003e {\n                const move = convertCellToCoordinates(e.target);\n\n                if (checkIfMoveWasAlreadyMade(moves, move)) {\n                    return;\n                }\n\n                moves.push(move);\n\n                const { currentPlayer, winner } = playRound(moves);\n\n                updateCellContents(e.target, currentPlayer);\n\n                if (winner === '') {\n                    return;\n                }\n\n                // Give DOM time to update before showing\n                setTimeout(() =\u003e {\n                    alert(`winner is ${winner}`);\n                    window.location.reload();\n                }, 100);\n            });\n        }\n\n        function checkIfMoveWasAlreadyMade (moves, [moveX, moveY]) {\n            return moves.find(([x, y]) =\u003e moveX === x \u0026\u0026 moveY === y);\n        }\n\n        function convertCellToCoordinates (cellNode) {\n            const x = parseInt(cellNode.closest('.row').getAttribute('data-row'));\n            const y = parseInt(cellNode.getAttribute('data-column'));\n\n            return [x, y];\n        }\n\n        function updateCellContents (cellNode, currentPlayer) {\n            cellNode.innerHTML = currentPlayer;\n        }\n    \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsamskies%2Ftictactoe-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamsamskies%2Ftictactoe-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsamskies%2Ftictactoe-engine/lists"}