A bulletproof, console-based Tic-Tac-Toe game built in Java. The project showcases solid programming practices, focusing on Clean Code, Modularity, and Defensive Programming.
- Defensive Input Validation: Utilizes Regular Expressions (
[1-9]) coupled with short-circuit evaluation (||) to prevent system crashes (NumberFormatException) regardless of malicious or accidental user inputs (e.g., characters, symbols, out-of-bounds numbers). - DRY Principle (Don't Repeat Yourself): Avoided redundant logic for Player 1 and Player 2 by implementing a dynamic, loop-driven turn mechanism using ternary operators.
- High Modularity: Code is decoupled into single-responsibility methods (
checkInput,can,win,display) making it highly maintainable and readable. - Resource Management: Explicitly handles
Scannerleaks by ensuring proper closure upon game termination.
- Java Development Kit (JDK) 8 or higher installed.
- Clone the repository:
git clone https://github.com/Banda-11/Console-Tic-Tac-Toe-Java.git