{"id":16582228,"url":"https://github.com/shenweiyan/catchthecat","last_synced_at":"2026-03-06T23:31:25.549Z","repository":{"id":152974175,"uuid":"616332942","full_name":"shenweiyan/CatchTheCAT","owner":"shenweiyan","description":"捉住那只小猫，一个有趣同时也很难的游戏，通过围堵的方式阻止小猫跑到边缘处。","archived":false,"fork":false,"pushed_at":"2024-12-02T06:09:15.000Z","size":775,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T02:25:16.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://shenweiyan.github.io/CatchTheCAT/","language":"HTML","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/shenweiyan.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":"2023-03-20T07:17:40.000Z","updated_at":"2024-12-02T06:09:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"936067c9-b4fc-426a-94be-3a7174fd2028","html_url":"https://github.com/shenweiyan/CatchTheCAT","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shenweiyan/CatchTheCAT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweiyan%2FCatchTheCAT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweiyan%2FCatchTheCAT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweiyan%2FCatchTheCAT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweiyan%2FCatchTheCAT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenweiyan","download_url":"https://codeload.github.com/shenweiyan/CatchTheCAT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweiyan%2FCatchTheCAT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30203334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-11T22:32:02.297Z","updated_at":"2026-03-06T23:31:25.533Z","avatar_url":"https://github.com/shenweiyan.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 捉住小猫\n\n## 游戏玩法\n\n* 点击小圆点，围住小猫。\n* 你点击一次，小猫走一次。\n* 直到你把小猫围住（赢），或者小猫走到边界并逃跑（输）。\n\n## 部署\n\n首先引入游戏框架 `phaser.min.js`\n\n```html\n\u003cscript src=\"phaser.min.js\"\u003e\u003c/script\u003e\n```\n\n然后引入游戏代码 `catch-the-cat.js`\n\n```html\n\u003cscript src=\"catch-the-cat.js\"\u003e\u003c/script\u003e\n```\n\n然后在指定的 div 中新建一个游戏的 canvas，并开始游戏\n\n```html\n\u003cdiv id=\"catch-the-cat\"\u003e\u003c/div\u003e\n\u003cscript\u003e\n    window.game = new CatchTheCatGame({\n        w: 11,\n        h: 11,\n        r: 20,\n        initialWallCount: 8,\n        backgroundColor: 0xeeeeee,\n        parent: 'catch-the-cat',\n        statusBarAlign: 'center',\n        credit: 'github.com/ganlvtech'\n    });\n\u003c/script\u003e\n```\n\n参数列表：\n\n| 参数  | 值    | 说明       |\n| :---: | :---: | :--------- |\n| w     | `11`  | 横向格子数 |\n| h     | `11`  | 竖向格子数 |\n| r     | `20`  | 圆半径像素 |\n\n非必选参数：\n\n| 参数            | 值                     | 说明                                |\n| :-------------: | :--------------------- | :---------------------------------- |\n| backgroundColor | `0xeeeeee`             | 背景颜色                            |\n| parent          | `catch-the-cat`        | 父元素的 id 或 DOM 对象             |\n| statusBarAlign  | `center`               | 状态栏左对齐 `left` 或居中 `center` |\n| credit          | `github.com/ganlvtech` | 右下角的备注信息                    |\n\n## 自己编写算法\n\n参考 `src/solvers/` 中提供的例子编写算法，并使用下列代码替换。\n\n```js\nwindow.game.solver = yourSolver;\n```\n\n这个 solver 的返回值即为猫要往哪个方向走一步，如果撞墙则算玩家获胜\n\n| 值 | 说明 |\n| :--- | :---------------------- |\n| -1 | 猫主动弃权 |\n| 0  | 左 |\n| 1  | 左上 |\n| 2  | 右上 |\n| 3  | 右 |\n| 4  | 右下 |\n| 5  | 左下 |\n\n猫站在星号的位置，数字代表每个方向的编号\n\n```plain\n 1 2\n0 * 3\n 5 4\n```\n\n例如\n\n```js\nwindow.game.solver = function (blocksIsWall, i, j) {\n    return 0;\n};\n```\n\n即：一直向左走，直到撞墙。\n\n## 说明\n\n* 游戏的思路和小猫的图片来源于 [www.gamedesign.jp](https://www.gamedesign.jp/flash/chatnoir/chatnoir.html)，原来的游戏名叫 Chat Noir，我只是尝试用 javascript 重写一遍。\n\n* Html 源码来源于 [ganlvtech/phaser-catch-the-cat](https://github.com/ganlvtech/phaser-catch-the-cat)。\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweiyan%2Fcatchthecat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenweiyan%2Fcatchthecat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweiyan%2Fcatchthecat/lists"}