/tic_tac_toe

Primary LanguageJavaScript

tic_tac_toe

The Odin Project: Tic tac toe

I was able to get the basic tic-tac toe game working with two human players. Support for AI has not been added.

I checked out top submissions of this project and here are the points where I can improve my code.

  1. Creating start page elements with javascript -> There is no need to create elements of start page using javascript. These elements can be created using html and we can use location.reload to go back to start page.

  2. Organization of code -> This was my first attempt at using modules and factory functions in my projects. I see that my attempt is haphazard with no structure. If have to add new features or functionality, a lot of re-write will be required. I observed that the top submissions have a very neat and well organized code where each functionality is broken down as much as possible and objects or factory functions are created out it. Also, inbuilt library methods are used as much as possible to navigate and manipulate html elements, as opposed to creation of multiple local variables to achieve the same that I am doing.

3.Usage of loops-> for loops and while loops are used as less as possible. Instead, array manipulation methods like map(),filter() etc are preferred.

4.Comments-> I see that I add very less comments due to which I lose the flow of code. Its 10x difficult for someone else looking at my code. I need to start adding more comments to my code.

I will come back to this project later and do the above necessary improvements.