Skip to content

Jacobshin04/1a1b

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

1a1b Number Guessing Game

Overview

This is the first game I developed using C++ in a Linux Ubuntu environment!


1a1b is a two-player number guessing game where players try to guess each other’s 4-digit secret number. The game provides hints after each guess using 'a' and 'b':

  • 'a' indicates that both the number and its position are correct.
  • 'b' indicates that the number is correct but in the wrong position.

Players continue guessing until one correctly identifies the opponent’s number.

How to Play

  1. The game starts with a "1a1b" background screen.

image

  1. Each player enters their name and 4-digit secret number.

image

  1. Players take turns guessing the opponent's number.

  2. After each guess, the program provides hints:

    • Example:
      • Jacob’s secret number: 1234
      • Vernessa’s secret number: 5678

    Turn 1

    • Jacob guesses 8765 → 0a 4b (all digits correct but misplaced)
    • Vernessa guesses 1256 → 2a 0b (two digits correct in the right place)

    Turn 2

    • Jacob guesses 5679 → 3a 0b (three digits correct in the right place)

    • Vernessa guesses 5687 → 0a 0b (all numbers incorrect)

      image

  3. The game continues until a player guesses the correct number.

image

  1. The program asks if players want to restart the game or exit.

Features

  • Two-player mode with interactive turn-based gameplay.
  • Hint system to guide players toward the correct number.
  • Replay option after each round.

Installation & Usage

  1. Clone the repository:
    git clone https://github.com/Jacobshin04/1a1b-Number-Guessing-Game.git
    cd 1a1b-Number-Guessing-Game

Compile the program using g++:

g++ 1a1b.cpp -o 1a1b

Run the game:

./1a1b


Future Improvements

Implementing a single-player mode with an AI opponent.

Adding a score-tracking system to track wins and losses.

Introducing customizable number lengths (e.g., 3-digit or 5-digit mode).

Have fun playing 1a1b and challenge your friends! 🎮

Let me know if you’d like any changes! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages