Skip to content

Commit

Permalink
last move indicator for sfractional
Browse files Browse the repository at this point in the history
  • Loading branch information
merowin committed Jan 6, 2025
1 parent 261daa3 commit 9672817
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/shared/src/variants/s_fractional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {
createBoard,
createGraph,
} from "../lib/abstractBoard/boardFactory";
import { isGridBadukConfig, mapBoard, NewBadukConfig } from "./baduk_utils";
import {
equals_placement,
isGridBadukConfig,
mapBoard,
NewBadukConfig,
} from "./baduk_utils";
import { AbstractGame } from "../abstract_game";
import { Baduk, BadukBoard } from "./baduk";
import { Intersection } from "../lib/abstractBoard/intersection";
Expand Down Expand Up @@ -301,8 +306,16 @@ export class SFractional extends AbstractGame<
} {
const boardShape = isGridBadukConfig(config) ? "2d" : "flatten-2d-to-1d";

const stoneTransform = (colors: PlacementColors): MulticolorStone => {
return { colors: colors };
const stoneTransform = (
colors: PlacementColors,
idx: number | CoordinateLike,
): MulticolorStone => {
return {
colors: colors,
annotation: equals_placement(gamestate.lastMove, idx)
? "CR"
: undefined,
};
};
const scoreTransform = (color: string): string[] | null =>
color === "" ? null : [color];
Expand Down

0 comments on commit 9672817

Please sign in to comment.