A simple Java implementation of the classic Hand Cricket game that children love to play with their friends. This digital version recreates the fun experience with random number generation and interactive gameplay.
Hand Cricket is a popular game played by children where players choose numbers and try to score runs while avoiding getting "out" when both players show the same number. This Java version brings that nostalgic experience to your computer!
-
Toss Phase:
- Player 1 chooses even or odd
- Both players enter a number
- The sum determines who wins the toss (even/odd)
-
Choice Phase:
- Toss winner chooses to bat or bowl first
-
Batting Phase:
- Batsman scores runs based on randomly generated numbers (1-6)
- Bowler tries to get the batsman out by matching the same number
- Maximum 6 balls per innings
- Game ends if batsman gets out or completes 6 balls
-
Bowling/Chasing Phase:
- Second player tries to chase the target set by first player
- Same rules apply: avoid matching numbers, score more than target
-
Winning:
- Batting first: Set a target for opponent
- Chasing: Score more runs than the target to win
- Match result: Win, lose, or draw
- Java Development Kit (JDK) 8 or higher
- Any Java IDE or command line interface
-
Clone the repository:
git clone https://github.com/Jyotibrat/Hand-Cricket-Simulator.git cd src
-
Compile the Java file:
javac HandCricket.java
-
Run the game:
java -cp src HandCricket
- Enter names for Player 1 and Player 2
- Player 1 chooses even (1) or odd (2) for the toss
- Both players enter numbers for the toss
- Winner of toss chooses batting (1) or bowling (2)
- Follow the prompts to enter numbers during gameplay
- Enjoy the match!
Hand-Cricket-Simulator/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_report.md
│ │
│ ├── CODE_OF_CONDUCT.md
│ └── README.md
│
├── src/
│ └── HandCricket.java
│
└── LICENSE
- Interactive Console Interface: Easy-to-follow prompts and messages
- Random Number Generation: Fair gameplay with random numbers (1-6)
- Two-Player Support: Play with a friend locally
- Complete Cricket Experience: Toss, batting, bowling, and match results
- Multiple Game Scenarios: Different outcomes based on player choices
- Language: Java
- Input: Scanner for user input
- Random Generation: Math.random() for number generation (1-6)
- Game Logic: Nested loops and conditional statements
- Output: Console-based display
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Improving code structure
- Adding better user interface
- Writing tests
This project is open source and available under the MIT License.
Enjoy playing Hand Cricket! 🏏✨
Relive your childhood memories with this digital version of the classic game.