Skip to content

harkrishen-matta/TicTacToeR3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Game

A Java based Tic Tac Toe Console based game.

Getting Started

To run this game, please execute the Main class which will initialize the game.

Example Runs

The player placing "crosses" (X) has won


-------------------
| 0,0 | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,0
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 1,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
| 1,0 |  x  | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,2
-------------------
|  x  |  o  |  o  | 
-------------------
| 1,0 |  x  | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 2,2
-------------------
|  x  |  o  |  o  | 
-------------------
| 1,0 |  x  | 1,2 | 
-------------------
| 2,0 | 2,1 |  x  | 
-------------------

Player x wins the game!

The player placing "crosses" (O) has won


-------------------
| 0,0 | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,0
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 1,0
-------------------
|  x  |  o  | 0,2 | 
-------------------
|  x  | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 1,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
|  x  |  o  | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 2,2
-------------------
|  x  |  o  | 0,2 | 
-------------------
|  x  |  o  | 1,2 | 
-------------------
| 2,0 | 2,1 |  x  | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 2,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
|  x  |  o  | 1,2 | 
-------------------
| 2,0 |  o  |  x  | 
-------------------

Player o wins the game!

The outcome of the game is yet to be decided - Draw.


-------------------
| 0,0 | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,0
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,1
-------------------
|  x  |  o  | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,2
-------------------
|  x  |  o  |  x  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 1,0
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 1,2
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  | 1,1 |  x  | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 2,2
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  | 1,1 |  x  | 
-------------------
| 2,0 | 2,1 |  o  | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 2,1
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  | 1,1 |  x  | 
-------------------
| 2,0 |  x  |  o  | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 1,1
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  |  o  |  x  | 
-------------------
| 2,0 |  x  |  o  | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 2,0
-------------------
|  x  |  o  |  x  | 
-------------------
|  o  |  o  |  x  | 
-------------------
|  x  |  x  |  o  | 
-------------------

We have a draw!

Valid coordinate input check

  • Bound Check
  • Coordinate expression check

-------------------
| 0,0 | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,1
-------------------
| 0,0 |  x  | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,2
-------------------
| 0,0 |  x  |  o  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,3
Please enter a valid coordinate
-------------------
| 0,0 |  x  |  o  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0.5
Please enter a valid coordinate
-------------------
| 0,0 |  x  |  o  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: fafa
Please enter a valid coordinate
-------------------
| 0,0 |  x  |  o  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: -,-
Please enter a valid coordinate
-------------------
| 0,0 |  x  |  o  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 

Cell value validation - Not Empty


-------------------
| 0,0 | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,0
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 | 2,2 | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 2,2
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 |  o  | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 2,2
That cell has already been taken, please choose another cell
-------------------
|  x  | 0,1 | 0,2 | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 |  o  | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 0,2
-------------------
|  x  | 0,1 |  x  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 |  o  | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 0,2
That cell has already been taken, please choose another cell
-------------------
|  x  | 0,1 |  x  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
| 2,0 | 2,1 |  o  | 
-------------------

Player ' o ' input the coordinate where you want to place your mark: 2,0
-------------------
|  x  | 0,1 |  x  | 
-------------------
| 1,0 | 1,1 | 1,2 | 
-------------------
|  o  | 2,1 |  o  | 
-------------------

Player ' x ' input the coordinate where you want to place your mark: 

Authors

Harkrishen Singh Matta

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages