Created
January 8, 2019 01:19
-
-
Save mohsenheydari/de9c4a7a8c67689e09d1e392e3237712 to your computer and use it in GitHub Desktop.
Draw Tic Tac Toe board cells based on array of states
This file contains 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
drawCells(boardState){ | |
boardState.forEach(function(el, i){ | |
let x = (i % 3) * this.cellSize; | |
let y = Math.floor(i/3) * this.cellSize; | |
if(el === 1){ | |
this.drawX(x, y); | |
} else if(el === 2){ | |
this.drawO(x, y); | |
} | |
}, this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment