A game named TikTacToe developed using Java.

Overview

Project_TicTakToe

This is a game named TikTacToe developed using Java.

TIC-TAC-TOE

Introduction:

In this oop project , we worked on a small game called tic-tac-toe .Tic-tac-toe is played on a three-by-three grid by two players, who alternately place the marks X and O in one of the nine spaces in the grid.There is no universally-agreed rule as to who plays first however, tic-tac-toe is often played by young children who may not have discovered the optimal strategy. Here below we shall discuss the code flow and explain how our game operates.

Project overview and manual:

The tic tac toe consists of a stand 3x3, row and column, the game starts as soon as one person clicks a button in the grid. If the player has two in a row, they can place a third to get three in a row or column or diagonal,that player will win the game.This game requires some use of strategy, If the opponent has two in a row or column or diagonal the player must play the third themselves to block the opponent. The game can be generalized as two players alternate placing x or 0 of their own color on a 2d board with the goal of getting the same symbol on the same rows.

Code Documentation:

The interesting java project will be built using the AWT and Swings libraries. We will be explaining all the steps as well as methods that are used in this project. Swings is a popular java library that is used to develop beautiful GUI applications.We used an IDE named NetBeans 8.2. We declared a main method and created an object of the “TicTacToe” class. “TicTacToe” class has implemented an “ActionListener” interface which has a method called “actionPerformed” method. For making a window , we created an objects of “Frame” , “Panel”, “Button” classes.After which we added some functionality of our window by creating a constructor , such as : giving it a fixed size , creating 9 buttons , keeping those button in panels and give a title and a label to the panel ,and then add color to distinguish them between two players.Furthermore , we had to make the buttons visible and gave a grid layout to the buttons.There is a method “firstTurn()” inside the constructor which controls the exception and helps to handle the “interrupt exception”. First turn player will be denoted by x turn and the second player will be denoted by o turn,between each time the program will sleep for 2000 millisecond. In the actionPerformed method as soon as one player has clicked a button , his turn will end and his turn wll signify with a text color . After the player pressed one button and after which the “check” method will be called .The check method will check x condition and will check all possible options to win . X will only be able to win if the required options meet .If player one turn is over the text will be set as O and the player two turns will begin and it will work the same way as the player one and at the end it will rewrite the settext as X . When checking the x options that if x wins or not it will check all the options within the if-else condition . If one player hits 3 buttons and the condition meets , it will call upon a method called xwin() or owin() with a given set of parameters . Once a player wins the method will fetch parameters for the button that will turn them green and after which “thebuttons[i].setEnabled(false)” will become false and the button's won't work after anyone win the game and it will show a text that which player wins.

Conclusion:

We have successfully developed a simple tic tac toe game in java. The Tic Tac Toe game is most familiar among all the age groups.Intelligence can be a property of purpose-driven decision makers. Overall the system works without any bugs.It is easy to play between two players.It is straightforward to write a computer program to play tic-tac-toe perfectly or to enumerate the 765 essentially different positions or the 26,830 possible games up to rotations and reflections in this space.This basic idea has been suggested many times. An algorithm of playing Tic Tac Toe has been presented and tested that works in an efficient way.If the players want to play the game again they can rerun the program for a second time.

You might also like...

Jetserver is a high speed nio socket based multiplayer java game server written using Netty and Mike Rettig's Jetlang.It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

Note New version of Jetserver is called Nadron and is in a new netty 4 branch of this same repo. JetServer is a java nio based server specifically des

Dec 14, 2022

Good ol' PacMan game using Java

Good ol' PacMan game using Java

Table of contents General info Technologies Setup General info Good ol' PacMan. To play, you just need to use the arrow keys on your keyboard ◀️ ▶️ 🔼

Dec 28, 2022

2048FX - The game 2048, built using JavaFX and Java 11

2048FX - The game 2048, built using JavaFX and Java 11

The game 2048 built using JavaFX 16 and Java 17.

Dec 28, 2022

An arcade game project which made using java and swing for graphics

An arcade game project which made using java and swing for graphics

Arcade_Game_Development This is an arcade game project which made using java and swing for graphics. Meteor Dodge Here you have to dodge the meteor an

May 25, 2022

It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java.

Java-terminal-game It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java. The ga

Jan 20, 2022

A Java Game Engine created in Java with LWJGL!

💬 Suffler Engine Suffler Game Engine is an engine created in java using OpenGL to Graphics. Currently being developed at Eclipse, and Visual Studio C

Jul 23, 2022

Desktop/Android/HTML5/iOS Java game development framework

Desktop/Android/HTML5/iOS Java game development framework

Cross-platform Game Development Framework libGDX is a cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux

Jan 1, 2023

A complete 3D game development suite written purely in Java.

A complete 3D game development suite written purely in Java.

jMonkeyEngine jMonkeyEngine is a 3-D game engine for adventurous Java developers. It’s open-source, cross-platform, and cutting-edge. 3.2.4 is the lat

Dec 31, 2022

Java / JavaFX / Kotlin Game Library (Engine)

Java / JavaFX / Kotlin Game Library (Engine)

About JavaFX Game Development Framework Why FXGL? No installation or setup required "Out of the box": Java 8-15, Win/Mac/Linux/Android 8+/iOS 11.0+/We

Jan 2, 2023
Owner
Mahmudur Rahman Tushar
Studies BSc in Computer Science & Engineering (CSE) at United International University (UIU) Dhaka, Bangladesh.
Mahmudur Rahman Tushar
The Ludii general game system, developed as part of the ERC-funded Digital Ludeme Project.

The Ludii General Game System Ludii is a general game system being developed as part of the ERC-funded Digital Ludeme Project (DLP). This repository h

Digital Ludeme Project 49 Dec 25, 2022
Othello PvP (2-Player) Game Application created in Java using Swing and AWT, for playing the Othello game

Othello PvP (2-Player) Game Application created in Java using Swing and AWT, for playing the Othello game, a simple game that played on an 8 by 8 checkered board with 64 double-sided black and white discs. The game is easy to learn, but it takes time to master and develop winning strategies.

Soumyadeep Pal 1 Feb 28, 2022
Minecraft Utility Mod for the latest release of Minecraft developed by Cypphi.

Minecraft Utility Mod for the latest release of Minecraft developed by Cypphi.

Haze 18 Jan 1, 2023
BattleShip-Game - This repository contains the code of the BattleShip (Bataille Navale) game programmed in Java.

Bataille Navale Auteur : SABIL Mohamed Amine Comment générer la documentation ? Placez vous dans le sous-dossier src : pour générer la documentation d

Mohamed Amine SABIL 1 Jan 4, 2022
Snake-Game - A simple snake game written in java.

What's this? A simple snake game written in java. How to play Download the latest release. Ensure that a compatible java runtime is installed (optimal

Patrick260 4 Oct 31, 2022
Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API)

Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API), so no external libraries required. Video: https://youtu.be/uevIVLNhQqs

Leo 101 Jul 21, 2022
My Game Engine tested via my Cubecraft Game

My Game Engine tested via my Cubecraft Game Install: mvn -P {your OS name} clean install mvn -P mac clean install mvn -P linux clean install mvn -P wi

null 30 Oct 3, 2022
The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

Ravi Mandal 7 Sep 11, 2022
A simple puzzle game made with Unity to practice the game engine

A simple puzzle game made with Unity to practice the game engine.

Eyüb Salih Özdemir 1 Mar 30, 2022
A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata

Game-Of-Life-Basic A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata. A cellular automaton is a

Nikhil Narayanan 5 Oct 27, 2022