ajax333221 / isepic-chess

♞ JavaScript chess utility library.
MIT License
16 stars 3 forks source link

Add comments? #1

Closed greduan closed 11 years ago

greduan commented 11 years ago

@ajax333221 Hi it's me, Eduan from StackOverflow. Thanks for pointing me to this repo, I really appreciate it, will learn lots from it I'm sure. :)

I started studying the code, and I think I can figure out what a very small amount of things do and mean.

For the sake of preventing confusion, could you please add comments to all the code? Otherwise I can't figure anything out, and only persons that know lots of code would, even them would have problems though I think.

Just think, in 2 years when you revisit, would you like to re-learn the code? Or have these beautiful comments that tell you everything? :wink:

ajax333221 commented 11 years ago

I will work on that part, I agree my code is near impossible to fully understand without comments, there are things that you can't simply know without key things like this v:

Movement direction:
                     8__  __1
        8 1 2       7   ||   2
         \|/         |__][__|
       7--X--3       |--][--|
         /|\        6 __||__ 3
        6 5 4        5      4
       (normal)     (knights)

I can't promise I will have this ready soon, but I will definitely look into this. The reason I didn't write comments from the start is because I understand my code even if it is old code, but this is unfair since only me would understand it.

greduan commented 11 years ago

@ajax333221 Ah I see, so you determine the direction with numbers, yeah? How do you determine the distance in pieces that can move in long ranges? Like rooks.

ajax333221 commented 11 years ago

@Greduan with "num_squares" but I will explain the code throughfully later

greduan commented 11 years ago

@ajax333221 Oh OK. Thanks! :)

ajax333221 commented 11 years ago

@Greduan I commented around 50% today, the changes will be in a separated file at https://github.com/ajax333221/Isepic-Chess/blob/master/isepic-chess_COMMENTED.js

greduan commented 11 years ago

@ajax333221 I really appreciate it! Thanks!

My colleague and I thought of a system to make the board and make the pieces move, similar to yours using the X and Z coordinates ([0,0]).

Your system looks like will really give us a big break, thanks. :)