What challenge did i do? Check out the live version and the source code of Tic Tac Toe .
The story:
Iām already doing the 100 days challenge , With the goal of getting a job , in the same time to get the best out of myself and to do the best i can do . My first project is done , and now it is time for the second project which i wanted to be a challenge .
The challenge :
The challenge was making the project afap with a deadline of a week . got the idea of making a tic tac toe since it seems a cool thing to make , and it has many parts and logic (means that it is good for showing the ability ) .
The game:
The stack :
For building the game i used react js and bootsrap .
The logic :
first there is a square which is the big array every array inside is a row and every element inside is a column, it looks like this :
[['','',''],['','',''],['','','']]
When you play your turn , it looks like this e.g :
[['x','',''],['','',''],['','','']]
There is a function that detects the winner , the winner counter increase and a notification of who won is shown .
Single Player mode :
i used math.random() to generate two number between 0 and 2 , the first number represents the row and the second represents the column . it checks if the element is empty if not it generates two numbers again .
The results :
Made it in 5 days , it has two modes : single player and multi player . it shows you the winner and it has a counter for every player and for how many times each one of them won .
Follow me on twitter
Top comments (0)