Instructions and introduction - MartinReinsalu/TicTacToe-TripsTrapsTrull GitHub Wiki
Quick overview
Classic Tic-Tac-Toe game. User - "X", Opponent "O". 2-dimensional tic-tac-toe on a 3×3 board. If one player gets a row of three "X" or three "O", wins the game. Otherwise, when all the 9 zones are occupied and nobody didn't get a row, the result is a Draw.
Google Chrome, Mozilla Firefox and Microsoft Edge are the only supporting browsers (Internet Explorer issue known). When the game is launched, the User sees "Alusta mängu" button and white stripes on the specific background.
AI algorithms are based on Math.random(). The easiest difficulty level makes the Opponent's moves as random to an available area, regardless of User's moves. The hardest level considers User's moves as ceratin combinations and makes the Opponent's move as random to an available area.
The following steps are necessary to start the game:
- Press "Alusta mängu"
- Choose the difficulty level radio button. Either "Kerge" ("Easy") or "Raske" ("Hard"). It is unable to start the game if one of the radio buttons isn't chosen and in that case an alert will pop up with the message "Vali raskustase!" (Choose the difficulty level!").
- When the previous step is done correctly, the User has to press "Mängi!" ("Play!") button.
- After completing step 3., only white strips on the background will remain.
How to play?
- The User always makes the first move and then AI (the Opponent) will make their move.
- The User's token is "X", the Opponent has "O". To mark a token, left mouse-click on one of the 9 areas is needed.
- After click, a yellow "X" and black "O" will appear.
- If the User or Opponent manages to succeed in placing three of their marks in a horizontal, vertical, or diagonal row, has won the game.
- Red line will appear above the winning row and an alert will pop up with the message, either "Palju õnne, võitsid!" ("Congratulations, you won!") or "Kahjuks kaotasid!" ("Unfortunately you lost!").
- If neither the User or opponent manages to make a row, no red line will appear and "Mäng jäi viiki!" ("The game ended as a draw!") as an alert message will pop up.
- Either win, lost or draw, when clicking "OK" in the alert message box, the alert box will disappear, the game will launch again after 3 second and "Alusta mängu!" button will be visible. The difficulty level radio button is set the same as chosen before - the User can choose another one.
- The User clicks "Mängi!" again to start the game.