Skip to content

Instantly share code, notes, and snippets.

@niyazpk
Created December 27, 2011 20:08
Show Gist options
  • Save niyazpk/1524996 to your computer and use it in GitHub Desktop.
Save niyazpk/1524996 to your computer and use it in GitHub Desktop.
function drawBoard(board){
var str = '';
for( var i = 0 ; i < 8 ; i++ ){
str += '<div class="row">';
for( var j = 0 ; j < 8 ; j++ ){
str += '<div class="column ' +
( (i + j) % 2 === 0 ? 'light': 'dark') + '">' +
'<div class="' + getPieceName(board[i][j]) + '"></div>' +
'</div>';
}
str += '</div>';
}
$('#board').append(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment