I am starting JavaScript and need advice on coding habits: Roast my code!

Hi guys,

I just finished coding this puzzle and I need some criticism: http://codepen.io/jedidreyfus/pen/wWvyxd

I had already programmed it when I first started learning JS but since then, I learned Python and read the first part of The Definitive Guide for JS. My goal with this puzzle was not to use an array to represent my board since I have coded several games with 2D arrays (Reversi, Tic Tac Toe, etc.), including the same game when I first made it, and I wanted to do this with a new way.

I am putting my code here because I want you guys to point out everything that is wrong concerning coding habits and that could be done in a better way concerning my algorithms. Improvements I know I want to make are: a more efficient mixing algorithm, less specific functions (adding parameters that would make it easy to export the functions to another program).

If you guys have any advice on anything else, it is welcome as well.

In a near future, I'd like to design an AI that solves this puzzle using Machine Learning. I am pretty sure I can't do it from scratch (I begin uni in fall so I don't have any of the prerequisite math classes for ML) but I wanted to see if you know some libraries that I can use for this.

Thanks everyone !

Posted May 29, 2016, 7:27 PM UTC

1315
Loading comments…