summaryrefslogtreecommitdiff
path: root/public/sync_board.js
diff options
context:
space:
mode:
authorIgrisBRC <[email protected]>2024-07-14 13:43:36 +0530
committerIgrisBRC <[email protected]>2024-07-14 13:43:36 +0530
commit4194b03e980ac68e0fd07e183189fbe93dfefdce (patch)
tree79bbce279fa277aa34cc53e4818eca59b54f8963 /public/sync_board.js
parent0f1250b0f879eb764559d80bbc8a54d53c221f68 (diff)
finnnallyyyy... added make move to the game, its a bit shitty, i'll make it prettier later
Diffstat (limited to 'public/sync_board.js')
-rw-r--r--public/sync_board.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/public/sync_board.js b/public/sync_board.js
index 629cae6..c56cb77 100644
--- a/public/sync_board.js
+++ b/public/sync_board.js
@@ -1,16 +1,18 @@
-function sync_board(){
- let table = {1:'K', 2:'Q', 3:'R', 4:'B', 5:'N', 6:'p'}
+function sync_board() {
+
+ let table = { 1: 'K', 2: 'Q', 3: 'R', 4: 'B', 5: 'N', 6: 'p' }
- for(let i = 0; i < 8; i++){
- for(let j = 0; j < 8; j++){
- if(board[i][j] == 0) continue
+ for (let i = 0; i < 8; i++) {
+ for (let j = 0; j < 8; j++) {
+ if (board[i][j] == 0) continue
let square = document.getElementById(`${alphabet.charAt(j)}${8 - i}`)
let piece = document.createElement('p')
- piece.classList.add(board[i][j] > 0 ? 'w' : 'b')
+ piece.classList.add(board[i][j] > 0 ? 'w' : 'b', 'piece')
square.append(piece)
piece.append(table[Math.abs(board[i][j])])
}
}
-} \ No newline at end of file
+ console.log(board)
+}