Giter Site home page Giter Site logo

tictactoe-game's Introduction

TicTacToe-Game

Certainly! Below is the TicTacToe game implemented in Java, formatted as a README file:

TicTacToe Game in Java

This is a simple implementation of the classic TicTacToe game in Java. It allows two players to take turns and play on a 3x3 grid.

How to Play

  1. Open a Java IDE or command-line environment to run the game.

  2. When the game starts, an empty 3x3 grid will be displayed.

  3. Players will take turns to enter their moves on the grid.

  4. Each player is represented by either 'X' or 'O'.

  5. To make a move, players need to enter the row and column indices of their desired cell (0 to 2) through the console.

  6. The game will check if the chosen cell is empty. If it is, the player's move will be placed on the grid.

  7. The game will continue until one of the players wins or the entire board is filled, resulting in a draw.

  8. If a player manages to get three of their symbols in a row (horizontally, vertically, or diagonally), they win the game.

Running the Game

  1. Copy the Java code provided in the Main.java file.

  2. Paste the code into a Java IDE or a text editor.

  3. Save the file with the name Main.java.

  4. Compile and run the program to start the TicTacToe game.

Example Gameplay

-------------
|   |   |   |
-------------
|   |   |   |
-------------
|   |   |   |
-------------

Player X enter: 1 1

-------------
|   |   |   |
-------------
|   | X |   |
-------------
|   |   |   |
-------------

Player O enter: 0 0

-------------
| O |   |   |
-------------
|   | X |   |
-------------
|   |   |   |
-------------

Player X enter: 0 1

-------------
| O | X |   |
-------------
|   | X |   |
-------------
|   |   |   |
-------------

Player O enter: 2 0

-------------
| O | X |   |
-------------
|   | X |   |
-------------
| O |   |   |
-------------

Player X enter: 0 2

-------------
| O | X | X |
-------------
|   | X |   |
-------------
| O |   |   |
-------------

Player O enter: 1 0

-------------
| O | X | X |
-------------
| O | X |   |
-------------
| O |   |   |
-------------

Player O has won!

Enjoy playing TicTacToe with a friend!

tictactoe-game's People

Contributors

sandipmalii avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.