guessthenumber-andrea_alii
v1.1.1
Published
Un semplice gioco 'Indovina il Numero' eseguito tramite console Node.js.
Readme
English Version (README.md Content) 🎲 Guess the Number (Indovina il Numero) A simple and classic CLI (Command-Line Interface) game for guessing a random number between 1 and 100, implemented using Node.js.
🚀 Installation To run the game from anywhere in your terminal, install it globally using npm:
npm install -g guessthenumber
(Note: If you used a different package name, such as guessthenumber-yourname, use that instead.)
▶️ How to Play After global installation, you can start the game simply by typing the command name in your terminal:
guessthenumber
Game Rules (Version 1.1.0) The game generates a random number between 1 and 100.
You have 10 attempts to guess the number.
After each guess, the game automatically calculates and displays the new valid search range (e.g., [45-78]).
Crucially, your next guess MUST fall within this new, narrowed range. Attempts outside the range will be rejected without counting against your total.
During the game, you can type reset to start a new game at any time.
⚙️ Development and Structure This project is an example of an interactive console application created with Node.js, utilizing the native readline library to handle synchronous I/O input.
Local Execution (For Developers Only) If you have cloned the repository and wish to run the game without installing it globally:
Install dependencies (if any):
npm install
Run the start script defined in package.json:
npm start
Main Files File
Description
guess_game.js
Contains all game logic, state management, and I/O interaction via readline.
package.json
Defines the project metadata and the start script.
📜 License This project is distributed under the ISC license.
Versione Italiana (Contenuto di README.md) 🎲 Guess the Number (Indovina il Numero) Un semplice e classico gioco CLI (Command-Line Interface) per indovinare un numero casuale tra 1 e 100, implementato in Node.js.
🚀 Installazione Per poter eseguire il gioco da qualsiasi punto del tuo terminale, installalo globalmente usando npm:
npm install -g guessthenumber
(Nota: Se hai usato un nome di pacchetto diverso, come guessthenumber-tuonome, usa quello al posto di guessthenumber.)
▶️ Come Giocare Dopo l'installazione globale, puoi avviare il gioco semplicemente digitando il nome del comando nel tuo terminale:
guessthenumber
Regole del Gioco (Versione 1.1.0) Il gioco genera un numero casuale tra 1 e 100.
Hai 10 tentativi per indovinare il numero.
Dopo ogni tentativo, il gioco calcola e mostra automaticamente il nuovo intervallo di ricerca valido (ad esempio, [45-78]).
Crucialmente, il tuo prossimo tentativo DEVE ricadere all'interno di questo nuovo intervallo ristretto. I tentativi al di fuori di questo range verranno rifiutati senza sprecare un tentativo.
Durante il gioco, puoi digitare reset per ricominciare una nuova partita in qualsiasi momento.
⚙️ Sviluppo e Struttura Questo progetto è un esempio di applicazione interattiva da console creata con Node.js, che utilizza la libreria nativa readline per gestire l'input e l'output in modo sincrono.
Esecuzione Locale (Solo per sviluppatori) Se hai clonato il repository e vuoi eseguire il gioco senza installarlo globalmente:
Installa le dipendenze (se presenti):
npm install
Esegui lo script di avvio definito in package.json:
npm start
File Principali File
Descrizione
guess_game.js
Contiene tutta la logica di gioco, la gestione degli stati e l'interazione I/O tramite readline.
package.json
Definisce i metadati del progetto e lo script start.
📜 Licenza Questo progetto è distribuito sotto licenza ISC.
