|
|
|
@ -49,11 +49,11 @@ export class BoardGameComponent extends HTMLElement { |
|
|
|
|
for (const tbodyUntyped of this.querySelectorAll("tbody.game-board")) { |
|
|
|
|
const tbody = tbodyUntyped as HTMLTableSectionElement; |
|
|
|
|
|
|
|
|
|
for (let rowNumberToRemove = gameState.rows; rowNumberToRemove < tbody.rows.length; rowNumberToRemove++) { |
|
|
|
|
tbody.rows[rowNumberToRemove]?.remove(); |
|
|
|
|
while (gameState.rows < tbody.rows.length) { |
|
|
|
|
tbody.rows[0]?.remove(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (let rowNumberToAdd = tbody.rows.length; rowNumberToAdd < gameState.rows; rowNumberToAdd++) { |
|
|
|
|
while (gameState.rows > tbody.rows.length) { |
|
|
|
|
tbody.insertRow(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -63,15 +63,11 @@ export class BoardGameComponent extends HTMLElement { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for ( |
|
|
|
|
let columnNumberToRemove = gameState.columns; |
|
|
|
|
columnNumberToRemove < row.cells.length; |
|
|
|
|
columnNumberToRemove++ |
|
|
|
|
) { |
|
|
|
|
row.cells[columnNumberToRemove]?.remove(); |
|
|
|
|
while (gameState.columns < row.cells.length) { |
|
|
|
|
row.cells[0]?.remove(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (let columnNumberToAdd = row.cells.length; columnNumberToAdd < gameState.columns; columnNumberToAdd++) { |
|
|
|
|
while (gameState.columns > row.cells.length) { |
|
|
|
|
row.insertCell(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|