function drawGame() {
  const tiles = getTileLocs();
  for (let key in tiles) {
    const tileLoc = tiles[key];

    if (tileLoc >= 0) {
      // only attempt to draw tile if it has a location
      const gridColumnStart = (tileLoc % 5) + 1;
      const gridRowStart = Math.floor(tileLoc / 5) + 1;

      const tile = document.getElementById(key);
      tile.style.gridColumn = `${gridColumnStart} / ${gridColumnStart + 1}`;
      tile.style.gridRow = `${gridRowStart} / ${gridRowStart + 1}`;
    }
  }
}
// Given the current board state, draw all the tiles on the grid at the right spots
Given the current board state, draw all the tiles on the grid at the right spots
Given the current board state draw all the tiles on the grid at the right spots
function drawGame() {
  const tiles = getTileLocs();
  for (let key in tiles) {
    const tileLoc = tiles[key];
    if (tileLoc >= 0) {
      const gridColumnStart = (tileLoc % 5) + 1;
      const gridRowStart = Math.floor(tileLoc / 5) + 1;
      const tile = document.getElementById(key);
      tile.style.gridColumn = `${gridColumnStart} / ${gridColumnStart + 1}`;
      tile.style.gridRow = `${gridRowStart} / ${gridRowStart + 1}`;
    }
  }
}
function drawGame ( ) { const tiles = getTileLocs ( ) ; for ( let key in tiles ) { const tileLoc = tiles [ key ] ; if ( tileLoc >= 0 ) { const gridColumnStart = ( tileLoc % 5 ) + 1 ; const gridRowStart = Math . floor ( tileLoc / 5 ) + 1 ; const tile = document . getElementById ( key ) ; tile . style . gridColumn = ` ${ gridColumnStart } ${ gridColumnStart + 1 } ` ; tile . style . gridRow = ` ${ gridRowStart } ${ gridRowStart + 1 } ` ; } } }
Given the current board state, draw all the tiles on the grid at the right spots
Given the current board state draw all the tiles on the grid at the right spots
// only attempt to draw tile if it has a location