Giter VIP home page Giter VIP logo

tictactoe_javaswing's Introduction

A Classic TicTacToe game using Java Swing.


The user is initially displayed with an option to choose your opponent, either against the computer or a friend.

Project Demo: Tic Tac Toe

Capture_ticTacToe_MainMenu


Play alternates between the user(player1) who initially is X and the player2/CPU which is O.

Image displaying a game between the user and CPU:

Capture_TicTacToe_vsComputer


After the game ends a dialog box is displayed announcing the result and the score. The user is given an option for a re-match(play again).

Capture_TicTacToe_vsComputerMessage


If the user selects 'Yes' on the Play again option, a new game starts, but now the user (player 1) is O and the cpu/player2 is X. The mark ('X' and 'O') alternates every new game. X always plays first.

Capture_TicTacToe_vsComputer_2

Capture_TicTacToe_vsComputerMessage_2


When the option of playing against the computer is selected, the program automatically plays its turn. Initially the user is X and CPU is O.

The computer's strategy is first to complete 3 O's in a row, or if that is not possible, to block a row of 3 X's, or if that is not possible, to move randomly.


Image displaying a game between Player 1 & Player 2 (vs Friend):

Capture_TicTacToe_vsFriend

Capture_TicTacToe_vsFriendMessage


The score between the two players is also recorded and displayed at the bottom, it updates after every game.

After the end of a game, if the user selects 'No' on the Play again option, the frame resets to the main menu of options and all the scores are reseted.

Top panel displays labels which indicate the turn of each player and their corresponding mark (either X or O).

tictactoe_javaswing's People

Contributors

04xraynal avatar

Stargazers

 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.