A Java implementation of the classic Noughts and Crosses (Tic-Tac-Toe) game, built using JavaFX, developed for the COMP1322 course. This project was designed to demonstrate object-oriented programming (OOP) principles, clean architecture, and GUI interaction.
- About
- Features
- Design & OOP Principles
- Prerequisites
- Running the Project
- Usage
- Project Structure
- How to Play
- Future Enhancements
- Known Issues
- Credits
This is a GUI-based Noughts & Crosses game where two players can take turns to place X or O on a 3×3 grid. The game uses JavaFX for UI, and the core logic is structured around object-oriented design, making it modular, extensible, and understandable.
- Intuitive graphical user interface using JavaFX
- Game state management (win, draw, ongoing)
- Turn-based play (two players)
- Clean separation between UI and game logic
- Demonstrates core OOP concepts: encapsulation, inheritance, polymorphism, and modularity
This project emphasises understanding and applying:
Game logic (board, players, win checking) is separated from UI code.
Each class handles a single responsibility, making the code easy to maintain.
The architecture allows plugging in new player types (e.g., AI players).
While not pure MVC, the structure separates:
- Model — game logic
- Controller/UI — user interface interactions
You will need:
- JDK 11+
- JavaFX SDK (if not bundled with your IDE)
- An IDE such as IntelliJ IDEA, Eclipse, or NetBeans
- Git (optional)
git clone https://github.com/TomNguyennn/JavaNoughtsAndCrosses.git
cd JavaNoughtsAndCrosses- Open the project in your IDE
- Ensure JavaFX is configured in the project SDK/module path
- Run
Main.java
- Launch the application
- Choose grid size
- Player X goes first
- Click a grid cell to place your symbol
- The game automatically checks for wins and draws
- Restart or close when finished (depending on implemented features)
src/
├── application/ # JavaFX controllers, UI logic
├── model/ # Game logic classes (Player, Board, Cell)
├── util/ # Optional helper classes
└── Main.java # Application entry point
- Two players take turns clicking squares on the 3×3 board
- First player to get 3 symbols in a line (row/column/diagonal) wins
- If all squares are filled without a winner → draw
- AI opponent (minimax algorithm)
- Larger boards (4×4, 5×5…)
- Scoreboard / match history
- Restart button or menu options
- Visual animations or themes
- Multiplayer over a network
(Add any that apply; examples:)
- Restart button may not be implemented
- Layout may not scale on all displays
- Game state isn't saved between sessions
- Developer: Tom Nguyen
- Course: COMP1322
- Framework: JavaFX
GitHub: TomNguyennn