Coders Packet

Tic-Tac-Toe Game source code in Java

By Ashlesha Laxman Aher

A Tic-Tac-Toe Game in Java where the player and the CPU can play. Result is displayed at last on console.

A Tic-Tac-Toe Game in Java Language where simply the player and the CUP can play. The player has the first preferenceto play and Cpu the second one. The player marks the position by "X". the position of the player is recorded and the CPU plays randomly. the result of the game is displayed at the end if the game is won ,lose or tie by player or CPU. 

Packages used are:

java.util.ArrayList, java.util.Arrays, java.util.List, java.util.Random, java.util.Scanner.

The Structure of Game board is created first in Main.

The Game Board id displayed in gameBoard.

The Position of Player and CPU is assigned in placePiece according to row and column.

The winning conditions are checked in checkWinner.

Download Complete Code

Comments

No comments yet