Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snekjs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snekjs - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "snekjs",
"version": "0.1.1",
"version": "0.1.2",
"description": "no step on snek",

@@ -5,0 +5,0 @@ "author": {

@@ -1,7 +0,9 @@

# no step on snek
# 🐍 no step on snek [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![snekjs on NPM](https://img.shields.io/npm/v/snekjs.svg?color=green&label=snekjs)](https://https://www.npmjs.com/package/snekjs)
Snake written in JavaScript for the terminal (Node.js)
Snake written in JavaScript for the terminal (Node.js).
## Instructions
### Clone from repository
```bash

@@ -12,1 +14,65 @@ git clone git@github.com:taniarascia/snek

```
### npm module
Install the snek package:
```bash
yarn add snekjs
```
Create `play.js`
```js
// play.js
const blessed = require('blessed')
const screen = blessed.screen({ smartCSR: true })
const { Interface, Game } = require('snekjs')
const ui = new Interface(screen, blessed)
const game = new Game(ui)
function tick() {
if (game.gameOver()) {
// Show game over screen on collision and end game
ui.gameOverScreen()
ui.render()
return
}
ui.clearScreen()
ui.clearDirection()
game.renderDot()
game.moveSnake()
game.renderSnake()
ui.render()
}
// Iterate every 50ms
function main() {
setInterval(tick, 50)
}
// Generate the coordinates of the first dot before the game begins
game.generateDot()
// Begin game
main()
```
Run the game.
```bash
node play.js
```
## Author
- [Tania Rascia](https://www.taniarascia.com)
## License
This project is open source and available under the [MIT License](LICENSE).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc