Format
This commit is contained in:
parent
a55f0890ce
commit
f11b4c935f
2 changed files with 6 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ export function renderGameBoardHtml(
|
|||
): string {
|
||||
// Check the last move, so that the stone can be highlighted
|
||||
const lastMove = game.history[game.history.length - 1];
|
||||
|
||||
|
||||
let boardHtml = '<div id="game-board" class="game-board-grid">';
|
||||
for (let row = 0; row < game.board.length; row++) {
|
||||
for (let col = 0; col < game.board[row].length; col++) {
|
||||
|
|
@ -16,7 +16,8 @@ export function renderGameBoardHtml(
|
|||
if (stone) {
|
||||
const colorClass =
|
||||
stone === 'black' ? 'stone-black-heart' : 'stone-white-heart';
|
||||
const lastMoveClass = col == lastMove.col && row == lastMove.row ? 'last-move' : '';
|
||||
const lastMoveClass =
|
||||
col == lastMove.col && row == lastMove.row ? 'last-move' : '';
|
||||
stoneHtml = `<div class="${colorClass} ${lastMoveClass}"></div>`;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue