Giter VIP home page Giter VIP logo

tick-tack-toe-java's Introduction

Tic-Tac-Toe in Console

๐ŸŽฎ This is a simple Tic-Tac-Toe game implemented in the console.

Author

๐Ÿ‘ค Oskar Kalbarczyk

๐ŸŒ GitHub: https://github.com/oskalbarczyk

๐Ÿ“บ YouTube Channel: Code with Oskar

How to Play

  1. Run the program.
  2. The game will display a 3x3 grid representing the Tic-Tac-Toe board.
  3. The first player is always 'O', and the second player is 'X'.
  4. The players take turns to choose a field they want to cover.
  5. When prompted, enter the number of the field you want to choose (1-9).
  6. The game will validate the move and update the board accordingly.
  7. The game will continue until a player wins or the board is full.
  8. The game will display "Game Over!" when it ends.

Gameplay

The game uses the numbers 1-9 to represent the fields on the board. The grid is displayed as follows:

|1|2|3| |4|5|6| |7|8|9|

When it's your turn, select the field number you want to cover. For example, if you want to cover the top-right corner, enter '3'.

Winning Conditions

The game checks for the following winning conditions:

  • Rows: If a player covers all fields in a row, they win.
  • Columns: If a player covers all fields in a column, they win.
  • Diagonals: If a player covers all fields in a diagonal, they win.

Building the Project

To compile and run the project, ensure you have Java installed on your system. Then follow these steps:

  1. Save the code into a file named Main.java.
  2. Open a command prompt or terminal window.
  3. Navigate to the directory where you saved the file.
  4. Compile the code by running the command: javac Main.java
  5. Run the program using the command: java Main

Enjoy playing Tic-Tac-Toe in the console! ๐ŸŽ‰

tick-tack-toe-java's People

Contributors

okdotdev 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.