{"id":44403071,"url":"https://github.com/chrum/ngx-snake","last_synced_at":"2026-02-12T06:30:11.620Z","repository":{"id":79810799,"uuid":"393467263","full_name":"chrum/ngx-snake","owner":"chrum","description":"angular snake component","archived":false,"fork":false,"pushed_at":"2022-04-03T17:58:08.000Z","size":574,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T12:54:02.508Z","etag":null,"topics":["angular","education","snake"],"latest_commit_sha":null,"homepage":"http://chrum.it/pages/ngx-snake/","language":"TypeScript","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/chrum.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":"2021-08-06T18:28:44.000Z","updated_at":"2023-03-03T04:47:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2d1775d-2c28-4b17-a2cb-ef5961919f70","html_url":"https://github.com/chrum/ngx-snake","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"9b6cb60e4146c72f5f4389ab3097cf5732b3b38d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chrum/ngx-snake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrum%2Fngx-snake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrum%2Fngx-snake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrum%2Fngx-snake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrum%2Fngx-snake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrum","download_url":"https://codeload.github.com/chrum/ngx-snake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrum%2Fngx-snake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29360644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"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":["angular","education","snake"],"created_at":"2026-02-12T06:30:11.056Z","updated_at":"2026-02-12T06:30:11.608Z","avatar_url":"https://github.com/chrum.png","language":"TypeScript","readme":"# ngx-snake\n\nSnake game as an angular component\n\n***ngx-snake*** is actually only the ***core of the game***... YOU need to add everything around it (controls, score...)  yourself :)\n\n\nCheck the demo [here](http://chrum.it/pages/ngx-snake)\n\n## Using it:\n#### Install:\n\n```bash\nnpm install ngx-snake\n```\n\n#### Import\n```javascript\nimport {BrowserModule} from '@angular/platform-browser';\nimport {NgModule} from '@angular/core';\n\nimport {AppComponent} from './app.component';\nimport {NgxSnakeModule} from 'ngx-snake';\n\n@NgModule({\n    declarations: [\n        AppComponent,\n    ],\n    imports: [\n        BrowserModule,\n        NgxSnakeModule\n    ],\n    providers: [],\n    bootstrap: [AppComponent]\n})\nexport class AppModule {\n}\n```\n\n#### Add/Connect to your fancy control interface\n```html\n    \u003cngx-snake #game\u003e\u003c/ngx-snake\u003e\n\n        \u003cbutton (click)=\"game.actionStart()\"\u003eStart\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionStop()\"\u003eStop\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionReset()\"\u003eReset\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionUp()\"\u003eUp\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionLeft()\"\u003eLeft\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionRight()\"\u003eRight\u003c/button\u003e\n        \u003cbutton (click)=\"game.actionDown()\"\u003eDown\u003c/button\u003e\n```\n\n#### Inputs\n\nName  | Default | Type | Description\n--- | --- | --- | ---\nboardHeight | 10 | number | Board height\nboardWidth | 10 | number | Board width\n\n\n\n#### Outputs\n\nName  | Description\n--- | ---\nfoodEaten | Called whenever our sweet snake gained some weight ;)\ngameOver | :( collision! snake didn't make it (remember about reset button)\n\n#### Public methods\n- `actionStart`\n- `actionStop`\n- `actionReset`\n- `actionUp`\n- `actionRight`\n- `actionDown`\n- `actionLeft`\n\nwhich can be used like:\n```html\n\u003cbutton (click)=\"onRotateButtonPressed()\"\u003eRotate\u003c/button\u003e\n```\n```typescript\n...\nexport class SnakeContainingComponent {\n    @ViewChild(NgxSnakeComponent)\n    private _snake: NgxSnakeComponent;\n\n    public onRotateButtonPressed() {\n        this._snake.actionRotate();\n    }\n}\n```\nOR\n```html\n\u003cngx-snake #game\u003e\u003c/ngx-snake\u003e\n\n\u003cbutton (click)=\"game.actionRotate()\"\u003eRotate\u003c/button\u003e\n```\n\n### Styling\n\nTo change colors and tiles (to **black and white** for example) define styles with colors like\n```scss\nngx-snake {\n    ngx-snake-tile {\n        background: #ffffff;\n        \u0026.free {\n            div {\n                background: #ffffff;\n            }\n        }\n    }\n}\n```\nfor full example (and all class names) [go here](https://github.com/chrum/ngx-snake/blob/master/projects/ngx-snake-app/src/styles.scss)\n\n## Development\n\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Authors\n\n[Chrystian Ruminowicz](http://chrum.it)\n\n## Licence\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrum%2Fngx-snake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrum%2Fngx-snake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrum%2Fngx-snake/lists"}