New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.0.3 to 1.0.4

2

package.json
{
"name": "snekjs",
"version": "1.0.3",
"version": "1.0.4",
"description": "A terminal-based Snake implementation written in JavaScript (Node.js) 🐍",

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

@@ -1,8 +0,6 @@

const blessed = require('blessed')
const { Game } = require('./src/Game')
const { UserInterface } = require('./src/UserInterface')
const { Game } = require('./src/Game')
const ui = new UserInterface(blessed, blessed.screen())
const game = new Game(ui)
const game = new Game(new UserInterface())
// Begin game
game.start()

@@ -18,2 +18,5 @@ # 🐍 Snek.js [![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://www.npmjs.com/package/snekjs)

cd snek
# install and run via npm or yarn
npm install && npm run play
yarn && yarn play

@@ -34,7 +37,4 @@ ```

// index.js
const blessed = require('blessed')
const { UserInterface, Game } = require('snekjs')
const ui = new UserInterface(blessed, blessed.screen())
const game = new Game(ui)
const game = new Game(new UserInterface())

@@ -41,0 +41,0 @@ // Begin game

@@ -0,1 +1,3 @@

const blessed = require('blessed')
/**

@@ -10,7 +12,7 @@ * @class UserInterface

class UserInterface {
constructor(blessed, screen) {
constructor() {
// Blessed is the terminal library API that provides a screen, elements, and
// event handling
this.blessed = blessed
this.screen = screen
this.screen = blessed.screen()

@@ -20,4 +22,13 @@ // Game title

// Create the game container
this.gameBox = {
// Create the boxes
this.gameBox = this.createGameBox()
this.scoreBox = this.createScoreBox()
this.gameOverBox = this.createGameOverBox()
this.gameContainer = this.blessed.box(this.gameBox)
this.scoreContainer = this.blessed.box(this.scoreBox)
}
createGameBox() {
return {
parent: this.screen,

@@ -33,5 +44,6 @@ top: 1,

}
}
// Create the score container
this.scoreBox = {
createScoreBox() {
return {
parent: this.screen,

@@ -48,4 +60,6 @@ top: 0,

}
}
this.gameOverBox = {
createGameOverBox() {
return {
parent: this.screen,

@@ -70,5 +84,2 @@ top: 'center',

}
this.gameContainer = this.blessed.box(this.gameBox)
this.scoreContainer = this.blessed.box(this.scoreBox)
}

@@ -75,0 +86,0 @@

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