Coder Social home page Coder Social logo

guessthenumbergame's Introduction

Guess the Number Game

A simple console-based "Guess the Number" game implemented in Java using the Observer Pattern.

Overview

This project implements a console-based "Guess the Number" game where players take turns guessing a randomly generated number between 1 and 100. The game notifies players of their guesses and provides feedback on whether their guesses are too high, too low, or correct. The game continues until one of the players guesses the correct number.

Features

  • Randomly generates a number between 1 and 100 for players to guess.
  • Notifies players of their guesses and provides feedback on whether they are too high, too low, or correct.
  • Uses the Observer Pattern to decouple game logic from player interaction.
  • Handles endgame conditions when a player guesses the correct number.

Usage

  1. Clone the repository:

    git clone https://github.com/yourusername/guess-the-number-game.git
  2. Compile the Java files:

    javac *.java
  3. Run the GuessTheNumberGame class:

    java GuessTheNumberGame
  4. Follow the on-screen instructions to play the game.

Observer Pattern

The Observer Pattern is a behavioral design pattern that defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. In this project, the game class acts as the subject, and the player class acts as the observer. When a player makes a guess, the game notifies all players about the guess, and each player updates its state accordingly.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Feel free to fork, contribute, or provide feedback on this project!

guessthenumbergame's People

Contributors

iampushkar avatar

Watchers

 avatar

Forkers

anunoy10maji

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.