← 全部工具

ParthAhuja14/odd_even

热度 75 更新于 开发与构建

Command-line Odd-Even Cricket game built in Python featuring toss mechanics, batting & bowling simulation, score chasing, unit tests, and replayable match logic.

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

🏏 Odd-Even Cricket

A command-line cricket game based on the classic "odd or even" playground game. Win the toss, choose to bat or bowl, and try to out-score the computer over a full match.

How It Works

  • Toss: Pick odd or even, then both you and the computer pick a number

from 1–10. If the sum is odd, "odd" wins; if even, "even" wins.

  • Batting: The batter picks a number from 1–10 each ball; the bowler's

number is random. If they match, the batter is out. Otherwise, the batter's number is added to their score as runs.

  • Chasing: The second team to bat only needs to beat the first team's

score — their innings ends as soon as they pass the target.

  • Winner: Whoever scores more runs wins the match. After each match, the

loser bowls first next time (unless it's a tie), and you can keep playing as many matches as you like.

Requirements

  • Python 3.6+
  • No external dependencies (uses only the Python standard library)

Getting Started

  • Clone the repository:
   git clone https://github.com/<your-username>/odd-even-cricket.git
   cd odd-even-cricket
  • Run the game:
   python odd_even_cricket.py