Note
An interactive, turn-based text simulation game written in Java that models realistic football mechanics using clean Object-Oriented Programming (OOP) paradigms.
-
🛡️ Squad Creation & Strict Data Validation:
- Build two squads: Home and Away.
- Exactly 3 field players (Striker
St, MidfielderCm, DefenderCb) and 1 Goalkeeper per team. - Strict input boundary loops for Age (16–42), Jersey Numbers (1–99), and Ratings (1–99).
- Position locking ensures no duplicate positions are assigned within the same squad.
-
🔄 Two-Tier Interactive Decision Loops:
- Decision-level error handling prevents wasted turns if a user enters an invalid tactical command or player index.
-
⏱️ Dynamic Match Timeline:
- 90-minute game loop evaluated at 15-minute intervals (Minutes 15, 30, 45, 60, 75, 90).
- Procedural pitch distance generation (0–100 meters).
- Built-in Half-time (Minute 45) and Full-time (Minute 90) milestones.
-
🧤 Interactive Goalkeeper Duel System:
- Shot success is dynamically calculated using shooting distance, player
shootingRating, and opposing goalkeeperreflexRating. - Goalkeeper
handlingRatingdetermines whether a saved shot is securely caught or deflected out for a corner kick.
- Shot success is dynamically calculated using shooting distance, player
┌───────────────────────────┐
│ Athlete │
│ (Base Class: Stats & Core)│
└─────────────┬─────────────┘
│
┌────────────────┴────────────────┐
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ FootballPlayer │ │ GoalKeeper │
│ - position │ │ - reflexRating │
│ - passingRating │ │ - handlingRating │
│ - shootingRating │ └──────────────────┘
└──────────────────┘
Important
Core OOP Principles Applied:
- Inheritance:
FootballPlayerandGoalKeeperinherit identity attributes fromAthlete. - Polymorphism: Subclasses override
play()for role-specific pitch behavior. - Encapsulation: Private attributes guarded by explicit getter/setter methods.
- Cross-Entity Interaction: Attackers interact dynamically with the opposing squad's goalkeeper instance.
+ Goal Scored: Shot accuracy test succeeds against goalkeeper reflex rating.
- Save / Corner: Shot missed; goalkeeper handling rating determines catch or corner.| Distance Range | Required Rating | Accuracy (Shooter < GK Reflex) | Accuracy (Shooter == GK Reflex) | Accuracy (Shooter > GK Reflex) | Handling Threshold (Corner vs Catch) |
|---|---|---|---|---|---|
| 0 – 30 m | 26% | 47% | 65% |
|
|
| 31 – 50 m | 30% | 50% | 70% |
|
|
| 51 – 70 m | 30% | 38% | 45% |
|
|
| 71 – 100 m | 37% | 40% | 47% |
|
| Distance Range | Required Pass Rating | Pass Success Rate |
|---|---|---|
| 0 – 30 m | 70% | |
| 31 – 50 m | 70% | |
| 51 – 70 m | 70% | |
| 71 – 100 m | 90% |
FootballManager/
├── src/
│ ├── Athlete.java # Base entity class with common attributes and getters/setters
│ ├── FootballPlayer.java # Field player implementation (passing & shooting math)
│ ├── GoalKeeper.java # Goalkeeper entity with reflex and handling ratings
│ ├── Team.java # Team entity managing player roster via ArrayList
│ └── Main.java # Game loop, input validation, match engine, and UI
└── README.md
Tip
You can run this project directly from any terminal without an IDE using the steps below:
# Step 1: Clone the repository to your local machine
+ git clone https://github.com/YOUR_USERNAME/FootballManager.git
+ cd FootballManager
# Step 2: Compile all Java sources into a 'bin' directory
+ javac -d bin src/*.java
# Step 3: Run the compiled application
+ java -cp bin Main(Alternatively, open the project in IntelliJ IDEA, VS Code, or Eclipse and run Main.java.)
- 🏷️ Team Registration: Enter team names for both Home and Away sides.
- 👥 Squad Setup: For each team, register 3 outfield players (
St,Cm,Cb) and 1 Goalkeeper. - ⚽ Kick-Off: Type
yesto commence the match. - 🎯 Match Minutes (15, 30, 45, 60, 75, 90):
- Review possession and generated pitch distance.
- Choose your tactic: type
shootorpass. - Select the player (
1,2, or3).
- 🏆 Final Whistle: View the final scoreline at minute 90.