Skip to content

dalouc/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game

A command-line Tic-Tac-Toe game implemented in Java, featuring multiple game modes including single-player against CPU and customizable player symbols.

Features

  • Three distinct game modes: Basic, Advanced, and CPU
  • Customizable player names and symbols
  • Single-player mode with computer opponent
  • Score tracking across multiple games
  • Input validation with helpful error messages
  • Clean console-based interface

Requirements

  • Java Development Kit (JDK) 8 or higher

To verify your Java installation:

java -version
javac -version

Installation

  1. Clone the repository:

    git clone https://github.com/dalouc/tic-tac-toe.git
    cd tic-tac-toe
  2. Compile the source code:

    cd src
    javac *.java
  3. Run the game:

    java TicTacToe

Usage

Upon launching, select a game mode by entering the corresponding number:

Select the game configuration:
  Basic (0)
  Advanced (1)
  CPU (2)

After each game, you can choose to play again. The program tracks wins and draws across sessions.

Game Modes

Mode Description
Basic (0) Classic two-player game with default names and symbols (X and 0)
Advanced (1) Two-player game with custom names and selectable symbols
CPU (2) Play against the computer or use advanced mode for two players

CPU Mode Options

When selecting CPU mode, choose between:

  • 1-player (0): Play against the computer. You can set your name and symbol.
  • 2-player (1): Defaults to Advanced mode with full customization for both players.

Available Symbols

In Advanced and CPU modes, players can choose from:

X 0 A B C D E F G H I J K L M N O P Q R S T U V W Y Z + * - @ 1

Note: Once selected, symbols cannot be changed during the game session.

Input Format

Positions are entered using coordinate notation:

(row,column)

Both rows and columns are numbered 1 to 3:

        Col 1   Col 2   Col 3
       +-------+-------+-------+
Row 1  | (1,1) | (1,2) | (1,3) |
       +-------+-------+-------+
Row 2  | (2,1) | (2,2) | (2,3) |
       +-------+-------+-------+
Row 3  | (3,1) | (3,2) | (3,3) |
       +-------+-------+-------+

Input Rules

  • Use parentheses: (row,column)
  • No spaces allowed
  • Numbers must be between 1 and 3

Examples:

Input Position
(1,1) Top-left corner
(2,2) Center
(3,3) Bottom-right corner

Invalid inputs will prompt you to re-enter the position.

Authors

Alfonso Cecilia Martínez and Daniel Lozano Uceda

About

UC3M "Programming" Final Project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages