UNPKG

by-idb

Version:

A simple terminal snake game library with no external dependencies

42 lines (35 loc) 2.39 kB
#!/usr/bin/env node const { initSystem } = require('./utils'); // Check if we're in development environment const isDev = true; function showBanner() { if (!isDev) { console.log(` ███████╗███╗ ██╗ █████╗ ██╗ ██╗███████╗ ██████╗ █████╗ ███╗ ███╗███████╗ ██╔════╝████╗ ██║██╔══██╗██║ ██╔╝██╔════╝ ██╔══██╗██╔══██╗████╗ ████║██╔════╝ ███████╗██╔██╗ ██║███████║█████╔╝ █████╗ ██████╔╝███████║██╔████╔██║█████╗ ╚════██║██║╚██╗██║██╔══██║██╔═██╗ ██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ███████║██║ ╚████║██║ ██║██║ ██╗███████╗ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ `); console.log('Welcome to Terminal Snake Game!'); console.log('--------------------------------'); console.log('Controls:'); console.log(' ↑ - Move Up'); console.log(' ↓ - Move Down'); console.log(' ← - Move Left'); console.log(' → - Move Right'); console.log(' Q - Quit Game'); console.log(' R - Restart Game'); console.log('\nRules:'); console.log(' • Eat food (*) to grow longer'); console.log(' • Avoid hitting walls and yourself'); console.log(' • Score 10 points for each food eaten'); console.log('\nEnjoy the game! 🐍'); console.log('--------------------------------\n'); } else { initSystem(); } } // Show banner and instructions showBanner();