Atlassian frontend interview - Implement Tic Tac Toe Game

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-03-12Added By Anonymous
Source: Link

Create a React component that implements a fully functional Tic Tac Toe game.


The game should:

Display a 3x3 grid of squares

Allow two players (X and O) to take turns

Indicate whose turn it is

Detect when a player has won or when the game ends in a draw

Allow restarting the game


Requirements:

•Create a TicTacToe component that manages the game state
•Track the state of the board using React state
•Handle player moves and turn switching
•Implement win detection logic for all possible win conditions:
•3 in a row horizontally
•3 in a row vertically
•3 in a row diagonally
•Display a message when a player wins or when the game ends in a draw
•Include a "Reset Game" button to start over
•Style the game board appropriately


Found similar question on PrepareFrontend platform

Comments