Created
March 6, 2017 05:14
-
-
Save Underdoge/48a1022491ff48495ecf263ddeff240d to your computer and use it in GitHub Desktop.
chessBoardCellColor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chessBoardCellColor(cell1, cell2) { | |
if((cell1.charCodeAt(0)-64)%2==0&&(cell2.charCodeAt(0)-64)%2==0) | |
if((cell1.charCodeAt(1)%2!=0&&cell2.charCodeAt(1)%2!=0)||(cell1.charCodeAt(1)%2==0&&cell2.charCodeAt(1)%2==0)) | |
return true; | |
else | |
return false; | |
else | |
if((cell1.charCodeAt(0)-64)%2!=0&&(cell2.charCodeAt(0)-64)%2!=0) | |
if((cell1.charCodeAt(1)%2==0&&cell2.charCodeAt(1)%2==0)||(cell1.charCodeAt(1)%2!=0&&cell2.charCodeAt(1)%2!=0)) | |
return true; | |
else | |
return false; | |
else | |
if((cell1.charCodeAt(0)-64)%2!=0&&(cell2.charCodeAt(0)-64)%2==0) | |
if((cell1.charCodeAt(1)%2!=0&&cell2.charCodeAt(1)%2==0)||(cell1.charCodeAt(1)%2!=0&&cell2.charCodeAt(1)%2==0)) | |
return true; | |
else | |
return false; | |
} |
abhilash007
commented
Jun 12, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment