diff --git a/src/backend/components/boardgame.tsx b/src/backend/components/boardgame.tsx
index 232159e..76ca84b 100644
--- a/src/backend/components/boardgame.tsx
+++ b/src/backend/components/boardgame.tsx
@@ -1,13 +1,6 @@
import { sequence } from "../../shared/array-utils.ts";
-import {
- BoardgameStateType,
- CurrentOutcome,
- GameRules,
- Player,
- SquareState,
- formatSquareState,
-} from "../../shared/datatypes.ts";
-import { ClassNames, getDisplayStates } from "../../shared/display.ts";
+import { BoardgameStateType, CurrentOutcome, GameRules, Player } from "../../shared/datatypes.ts";
+import { ClassNames, getCellDisplayData, getDisplayStates } from "../../shared/display.ts";
const getClassAndDisplayAttributes = (
className: ClassNames,
@@ -37,22 +30,11 @@ const getCellHtml = ({
row: number;
column: number;
}) => {
- if (!gameState.board) {
- return (
-
- );
- }
+ const { isDisabled, nextGameState, text } = getCellDisplayData({ gameState, currentOutcome, row, column });
- const squareState = gameState.board.get(row, column);
- const nextGameState =
- squareState === SquareState.Unoccupied && currentOutcome === CurrentOutcome.Undecided
- ? gameState.withMove(row, column)
- : gameState;
return (
-