Skip to content

dxsmith244/TicTacToe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game in Java - README

Introduction

This is a simple Tic-Tac-Toe game implemented in Java. The game is designed for two players, where Player 1 uses the symbol 'X' and Player 2 uses the symbol 'O'. The players take turns to mark a 3x3 grid, aiming to place three of their symbols in a horizontal, vertical, or diagonal row.

Features

  • Two-player mode
  • Interactive command-line interface
  • Input validation to ensure valid moves
  • Automatic detection of win, loss, or draw
  • Easy-to-understand game logic and structure

Prerequisites

  • Java Development Kit (JDK) 8 or higher
  • Basic knowledge of running Java applications from the command line

How to Run

  1. Clone or Download the Repository: Clone this repository to your local machine using:

  2. Compile the Code: Open a terminal and navigate to the directory containing the Java files. Compile the code using the javac command:

    javac TicTacToe.java
  3. Run the Game: After compiling, you can start the game using the java command:

    java TicTacToe
  4. Gameplay:

    • Players take turns by entering the number corresponding to the grid position (1-9).
    • The grid positions are as follows:
      1x1 | 2x1 | 3x1
      ----------------
      1x2 | 2x2 | 3x2
      ----------------
      1x3 | 2x3 | 3x3
      
    • The game continues until a player wins or the grid is full, resulting in a draw.

Game Rules

  1. The game starts with Player 1 ('X') and alternates between Player 1 and Player 2 ('O').
  2. Players select a cell (using a X|Y coordinate) to place their mark on the board.
  3. The first player to place three of their marks in a horizontal, vertical, or diagonal line wins.
  4. If all the grid positions are filled and no player has won, the game results in a draw.

Enjoy the game!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages