@dxos/react-ui-gameboard 0.8.3 → 0.8.4-main.1da679c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/lib/browser/index.mjs +522 -435
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +522 -435
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Chessboard/Chessboard.d.ts +20 -0
  8. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  9. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +31 -0
  10. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  11. package/dist/types/src/components/Chessboard/chess.d.ts +59 -0
  12. package/dist/types/src/components/Chessboard/chess.d.ts.map +1 -0
  13. package/dist/types/src/components/Chessboard/chess.test.d.ts +2 -0
  14. package/dist/types/src/components/Chessboard/chess.test.d.ts.map +1 -0
  15. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  16. package/dist/types/src/components/Gameboard/Gameboard.d.ts +38 -0
  17. package/dist/types/src/components/Gameboard/Gameboard.d.ts.map +1 -0
  18. package/dist/types/src/{Board → components/Gameboard}/Piece.d.ts +3 -2
  19. package/dist/types/src/components/Gameboard/Piece.d.ts.map +1 -0
  20. package/dist/types/src/components/Gameboard/Square.d.ts.map +1 -0
  21. package/dist/types/src/components/Gameboard/index.d.ts +4 -0
  22. package/dist/types/src/components/Gameboard/index.d.ts.map +1 -0
  23. package/dist/types/src/{Board → components/Gameboard}/types.d.ts +3 -1
  24. package/dist/types/src/components/Gameboard/types.d.ts.map +1 -0
  25. package/dist/types/src/components/Gameboard/util.d.ts.map +1 -0
  26. package/dist/types/src/components/index.d.ts +3 -0
  27. package/dist/types/src/components/index.d.ts.map +1 -0
  28. package/dist/types/src/index.d.ts +1 -2
  29. package/dist/types/src/index.d.ts.map +1 -1
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +20 -15
  32. package/src/{Chessboard → components/Chessboard}/Chessboard.stories.tsx +30 -27
  33. package/src/components/Chessboard/Chessboard.tsx +199 -0
  34. package/src/components/Chessboard/chess.test.ts +19 -0
  35. package/src/components/Chessboard/chess.ts +322 -0
  36. package/src/components/Gameboard/Gameboard.tsx +140 -0
  37. package/src/{Board → components/Gameboard}/Piece.tsx +25 -22
  38. package/src/{Board → components/Gameboard}/Square.tsx +4 -4
  39. package/src/components/Gameboard/index.ts +8 -0
  40. package/src/{Board → components/Gameboard}/types.ts +4 -1
  41. package/src/components/index.ts +6 -0
  42. package/src/index.ts +1 -2
  43. package/dist/lib/node/index.cjs +0 -1039
  44. package/dist/lib/node/index.cjs.map +0 -7
  45. package/dist/lib/node/meta.json +0 -1
  46. package/dist/types/src/Board/Board.d.ts +0 -15
  47. package/dist/types/src/Board/Board.d.ts.map +0 -1
  48. package/dist/types/src/Board/Container.d.ts +0 -14
  49. package/dist/types/src/Board/Container.d.ts.map +0 -1
  50. package/dist/types/src/Board/Piece.d.ts.map +0 -1
  51. package/dist/types/src/Board/Square.d.ts.map +0 -1
  52. package/dist/types/src/Board/context.d.ts +0 -10
  53. package/dist/types/src/Board/context.d.ts.map +0 -1
  54. package/dist/types/src/Board/index.d.ts +0 -8
  55. package/dist/types/src/Board/index.d.ts.map +0 -1
  56. package/dist/types/src/Board/types.d.ts.map +0 -1
  57. package/dist/types/src/Board/util.d.ts.map +0 -1
  58. package/dist/types/src/Chessboard/Chessboard.d.ts +0 -14
  59. package/dist/types/src/Chessboard/Chessboard.d.ts.map +0 -1
  60. package/dist/types/src/Chessboard/Chessboard.stories.d.ts +0 -16
  61. package/dist/types/src/Chessboard/Chessboard.stories.d.ts.map +0 -1
  62. package/dist/types/src/Chessboard/chess.d.ts +0 -40
  63. package/dist/types/src/Chessboard/chess.d.ts.map +0 -1
  64. package/dist/types/src/Chessboard/index.d.ts.map +0 -1
  65. package/src/Board/Board.tsx +0 -86
  66. package/src/Board/Container.tsx +0 -25
  67. package/src/Board/context.ts +0 -22
  68. package/src/Board/index.ts +0 -12
  69. package/src/Chessboard/Chessboard.tsx +0 -190
  70. package/src/Chessboard/chess.ts +0 -213
  71. /package/dist/types/src/{Chessboard → components/Chessboard}/index.d.ts +0 -0
  72. /package/dist/types/src/{Board → components/Gameboard}/Square.d.ts +0 -0
  73. /package/dist/types/src/{Board → components/Gameboard}/util.d.ts +0 -0
  74. /package/src/{Chessboard → components/Chessboard}/index.ts +0 -0
  75. /package/src/{Board → components/Gameboard}/util.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-gameboard",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.1da679c",
4
4
  "description": "Game board.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -9,12 +9,16 @@
9
9
  "type": "module",
10
10
  "exports": {
11
11
  ".": {
12
+ "source": "./src/index.ts",
12
13
  "types": "./dist/types/src/index.d.ts",
13
14
  "browser": "./dist/lib/browser/index.mjs",
14
15
  "node": "./dist/lib/node-esm/index.mjs"
15
16
  }
16
17
  },
17
18
  "types": "dist/types/src/index.d.ts",
19
+ "typesVersions": {
20
+ "*": {}
21
+ },
18
22
  "files": [
19
23
  "dist",
20
24
  "src"
@@ -24,13 +28,14 @@
24
28
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
25
29
  "@preact-signals/safe-react": "^0.9.0",
26
30
  "@preact/signals-core": "^1.9.0",
27
- "chess.js": "^1.0.0",
31
+ "@radix-ui/react-context": "1.1.1",
32
+ "chess.js": "^1.4.0",
28
33
  "react-resize-detector": "^11.0.1",
29
- "@dxos/debug": "0.8.3",
30
- "@dxos/invariant": "0.8.3",
31
- "@dxos/log": "0.8.3",
32
- "@dxos/node-std": "0.8.3",
33
- "@dxos/util": "0.8.3"
34
+ "@dxos/debug": "0.8.4-main.1da679c",
35
+ "@dxos/invariant": "0.8.4-main.1da679c",
36
+ "@dxos/log": "0.8.4-main.1da679c",
37
+ "@dxos/node-std": "0.8.4-main.1da679c",
38
+ "@dxos/util": "0.8.4-main.1da679c"
34
39
  },
35
40
  "devDependencies": {
36
41
  "@svgr/cli": "^8.1.0",
@@ -40,16 +45,16 @@
40
45
  "lodash.defaultsdeep": "^4.6.1",
41
46
  "react": "~18.2.0",
42
47
  "react-dom": "~18.2.0",
43
- "vite": "5.4.7",
44
- "@dxos/react-ui": "0.8.3",
45
- "@dxos/storybook-utils": "0.8.3",
46
- "@dxos/react-ui-theme": "0.8.3"
48
+ "vite": "7.1.1",
49
+ "@dxos/react-ui": "0.8.4-main.1da679c",
50
+ "@dxos/react-ui-theme": "0.8.4-main.1da679c",
51
+ "@dxos/storybook-utils": "0.8.4-main.1da679c"
47
52
  },
48
53
  "peerDependencies": {
49
54
  "react": "~18.2.0",
50
55
  "react-dom": "~18.2.0",
51
- "@dxos/react-ui": "0.8.3",
52
- "@dxos/react-ui-theme": "0.8.3"
56
+ "@dxos/react-ui": "0.8.4-main.1da679c",
57
+ "@dxos/react-ui-theme": "0.8.4-main.1da679c"
53
58
  },
54
59
  "publishConfig": {
55
60
  "access": "public"
@@ -57,7 +62,7 @@
57
62
  "scripts": {
58
63
  "gen:pieces": "pnpm gen:pieces:chess",
59
64
  "gen:pieces:chess": "pnpm gen:pieces:chess:alpha && pnpm gen:pieces:chess:cburnett",
60
- "gen:pieces:chess:alpha": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/alpha ./assets/pieces/chess/alpha",
61
- "gen:pieces:chess:cburnett": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/cburnett ./assets/pieces/chess/cburnett"
65
+ "gen:pieces:chess:alpha": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/alpha ./assets/pieces/chess/alpha > /dev/null",
66
+ "gen:pieces:chess:cburnett": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/cburnett ./assets/pieces/chess/cburnett > /dev/null"
62
67
  }
63
68
  }
@@ -4,29 +4,30 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import type { Meta, StoryObj } from '@storybook/react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
9
9
 
10
- import { log } from '@dxos/log';
11
10
  import { Button, Toolbar } from '@dxos/react-ui';
12
11
  import { withLayout, withTheme } from '@dxos/storybook-utils';
13
12
 
14
- import { Chessboard, type ChessboardProps } from './Chessboard';
13
+ import { Gameboard, type GameboardRootProps, type Move, type Player } from '../Gameboard';
14
+
15
15
  import { ChessModel } from './chess';
16
- import { Board, type BoardRootProps, type Player, type Move } from '../Board';
16
+ import { Chessboard, type ChessboardProps } from './Chessboard';
17
17
 
18
- type RenderProps = Pick<ChessboardProps, 'orientation' | 'showLabels' | 'debug'> & {
19
- fen: string;
18
+ type DefaultStoryProps = Pick<ChessboardProps, 'orientation' | 'showLabels' | 'debug'> & {
19
+ pgn?: string;
20
20
  };
21
21
 
22
- const DefaultStory = ({ fen, orientation: _orientation, ...props }: RenderProps) => {
23
- const model = useMemo(() => new ChessModel(fen), [fen]);
22
+ const DefaultStory = ({ orientation: _orientation, pgn, ...props }: DefaultStoryProps) => {
23
+ const model = useMemo(() => new ChessModel(pgn), [pgn]);
24
24
  const [orientation, setOrientation] = useState<Player | undefined>(_orientation);
25
25
 
26
- const handleDrop = useCallback<NonNullable<BoardRootProps['onDrop']>>(
26
+ const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(
27
27
  (move: Move) => {
28
- log.info('handleDrop', { move });
29
- return model.makeMove(move);
28
+ const result = model.makeMove(move);
29
+ console.log(model.pgn);
30
+ return result;
30
31
  },
31
32
  [model],
32
33
  );
@@ -34,7 +35,7 @@ const DefaultStory = ({ fen, orientation: _orientation, ...props }: RenderProps)
34
35
  return (
35
36
  <div className='flex flex-col grow gap-2 overflow-hidden'>
36
37
  <Toolbar.Root>
37
- <Button onClick={() => model.initialize()}>Reset</Button>
38
+ <Button onClick={() => model.update()}>Reset</Button>
38
39
  <Button onClick={() => model.makeRandomMove()}>Move</Button>
39
40
  <div className='grow'></div>
40
41
  <Button
@@ -43,14 +44,16 @@ const DefaultStory = ({ fen, orientation: _orientation, ...props }: RenderProps)
43
44
  Toggle
44
45
  </Button>
45
46
  </Toolbar.Root>
46
- <Board.Root model={model} onDrop={handleDrop}>
47
- <Chessboard orientation={orientation} {...props} />
48
- </Board.Root>
47
+ <Gameboard.Root model={model} onDrop={handleDrop}>
48
+ <Gameboard.Content grow contain>
49
+ <Chessboard orientation={orientation} {...props} />
50
+ </Gameboard.Content>
51
+ </Gameboard.Root>
49
52
  </div>
50
53
  );
51
54
  };
52
55
 
53
- const Grid = (props: RenderProps) => {
56
+ const GridStory = () => {
54
57
  const models = useMemo(() => Array.from({ length: 9 }).map(() => new ChessModel()), []);
55
58
  useEffect(() => {
56
59
  const i = setInterval(() => {
@@ -65,9 +68,9 @@ const Grid = (props: RenderProps) => {
65
68
  <div className='grid grid-cols-3 gap-2'>
66
69
  {models.map((model, i) => (
67
70
  <div key={i} className='aspect-square'>
68
- <Board.Root model={model}>
71
+ <Gameboard.Root model={model}>
69
72
  <Chessboard />
70
- </Board.Root>
73
+ </Gameboard.Root>
71
74
  </div>
72
75
  ))}
73
76
  </div>
@@ -75,34 +78,34 @@ const Grid = (props: RenderProps) => {
75
78
  );
76
79
  };
77
80
 
78
- const meta: Meta<typeof DefaultStory> = {
81
+ const meta = {
79
82
  title: 'ui/react-ui-gameboard/Chessboard',
80
83
  component: Chessboard,
81
84
  render: DefaultStory,
82
85
  decorators: [withTheme, withLayout({ fullscreen: true, classNames: '' })],
83
- };
86
+ } satisfies Meta<typeof Chessboard>;
84
87
 
85
88
  export default meta;
86
89
 
87
- type Story = StoryObj<typeof DefaultStory>;
90
+ type Story = StoryObj<typeof meta>;
88
91
 
89
92
  export const Default: Story = {};
90
93
 
91
94
  export const Promotion: Story = {
92
95
  args: {
93
- fen: '4k3/7P/8/8/8/8/1p6/4K3 w - - 0 1',
96
+ pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Kf8 16. e7+ Kg8 *',
94
97
  },
95
98
  };
96
99
 
97
100
  export const Debug: Story = {
98
101
  args: {
99
- debug: true,
100
- showLabels: true,
102
+ pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
101
103
  orientation: 'black',
102
- fen: 'q3k1nr/1pp1nQpp/3p4/1P2p3/4P3/B1PP1b2/B5PP/5K2 b k - 0 17',
104
+ showLabels: true,
105
+ debug: true,
103
106
  },
104
107
  };
105
108
 
106
- export const Nine: Story = {
107
- render: Grid,
109
+ export const Grid = {
110
+ render: GridStory,
108
111
  };
@@ -0,0 +1,199 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren, forwardRef, memo, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { useResizeDetector } from 'react-resize-detector';
7
+
8
+ import { type ThemedClassName, useForwardedRef, useTrackProps } from '@dxos/react-ui';
9
+ import { mx } from '@dxos/react-ui-theme';
10
+ import { isNotFalsy } from '@dxos/util';
11
+
12
+ import {
13
+ type DOMRectBounds,
14
+ Gameboard,
15
+ type Location,
16
+ type PieceRecord,
17
+ type Player,
18
+ getRelativeBounds,
19
+ locationToString,
20
+ useGameboardContext,
21
+ } from '../Gameboard';
22
+
23
+ import { type ChessModel, type ChessPiece, ChessPieces, boardStyles, getSquareColor, locationToPos } from './chess';
24
+
25
+ export type ChessboardProps = ThemedClassName<
26
+ PropsWithChildren<{
27
+ orientation?: Player;
28
+ showLabels?: boolean;
29
+ debug?: boolean;
30
+ rows?: number;
31
+ cols?: number;
32
+ }>
33
+ >;
34
+
35
+ /**
36
+ * Chessboard layout.
37
+ */
38
+ const ChessboardComponent = forwardRef<HTMLDivElement, ChessboardProps>(
39
+ ({ classNames, orientation, showLabels, debug, rows = 8, cols = 8 }, forwardedRef) => {
40
+ useTrackProps({ orientation, showLabels, debug }, Chessboard.displayName, false);
41
+ const targetRef = useForwardedRef(forwardedRef);
42
+ const { width, height } = useResizeDetector({ targetRef, refreshRate: 200 });
43
+ const { model, promoting, onPromotion } = useGameboardContext<ChessModel>(Chessboard.displayName!);
44
+
45
+ // Board squares.
46
+ const squares = useMemo<Location[]>(() => {
47
+ return Array.from({ length: rows }, (_, i) => (orientation === 'black' ? i : rows - 1 - i)).flatMap((row) =>
48
+ Array.from({ length: cols }).map((_, col) => [row, col] as Location),
49
+ );
50
+ }, [orientation, rows, cols]);
51
+
52
+ // Use DOM grid layout to position squares.
53
+ const layout = useMemo(() => {
54
+ return squares.map((location) => {
55
+ return (
56
+ <div
57
+ key={locationToString(location)}
58
+ {...{
59
+ ['data-location' as const]: locationToString(location),
60
+ }}
61
+ />
62
+ );
63
+ });
64
+ }, [squares]);
65
+
66
+ // Build map of square locations to bounds.
67
+ const [grid, setGrid] = useState<Record<string, DOMRectBounds>>({});
68
+ const gridRef = useRef<HTMLDivElement>(null);
69
+ useEffect(() => {
70
+ setGrid(
71
+ squares.reduce(
72
+ (acc, location) => {
73
+ const square = getSquareLocation(gridRef.current!, location)!;
74
+ const bounds = getRelativeBounds(gridRef.current!, square);
75
+ return { ...acc, [locationToString(location)]: bounds };
76
+ },
77
+ {} as Record<string, DOMRectBounds>,
78
+ ),
79
+ );
80
+ }, [squares, width, height]);
81
+
82
+ // Get the bounds of each square and piece.
83
+ const positions = useMemo<{ piece: PieceRecord; bounds: DOMRectBounds }[]>(() => {
84
+ if (!gridRef.current) {
85
+ return [];
86
+ }
87
+
88
+ return Object.values(model?.pieces.value ?? {})
89
+ .map((piece) => {
90
+ if (piece.id === promoting?.id) {
91
+ return null;
92
+ }
93
+
94
+ const bounds = grid[locationToString(piece.location)];
95
+ return { piece, bounds };
96
+ })
97
+ .filter(isNotFalsy);
98
+ }, [grid, model?.pieces.value, promoting]);
99
+
100
+ return (
101
+ <div ref={targetRef} tabIndex={0} className={mx('relative outline-none', classNames)}>
102
+ {/* DOM Layout. */}
103
+ <div ref={gridRef} className='grid grid-rows-8 grid-cols-8 aspect-square select-none'>
104
+ {layout}
105
+ </div>
106
+ {/* Squares. */}
107
+ <div>
108
+ {squares.map((location) => (
109
+ <Gameboard.Square
110
+ key={locationToString(location)}
111
+ location={location}
112
+ label={showLabels ? locationToPos(location) : undefined}
113
+ bounds={grid[locationToString(location)]}
114
+ classNames={getSquareColor(location)}
115
+ />
116
+ ))}
117
+ </div>
118
+ {/* Pieces. */}
119
+ <div className={mx(promoting && 'opacity-50')}>
120
+ {positions.map(({ bounds, piece }) => (
121
+ <Gameboard.Piece
122
+ key={piece.id}
123
+ piece={piece}
124
+ bounds={bounds}
125
+ label={debug ? piece.id : undefined}
126
+ orientation={orientation}
127
+ Component={ChessPieces[piece.type as ChessPiece]}
128
+ />
129
+ ))}
130
+ </div>
131
+ {/* Promotion selector. */}
132
+ {promoting && (
133
+ <PromotionSelector
134
+ grid={grid}
135
+ piece={promoting}
136
+ onSelect={(piece) => {
137
+ onPromotion({
138
+ from: Object.values(model.pieces.value).find((p) => p.id === promoting.id)!.location,
139
+ to: piece.location,
140
+ piece: promoting.type,
141
+ promotion: piece.type,
142
+ });
143
+ }}
144
+ />
145
+ )}
146
+ </div>
147
+ );
148
+ },
149
+ );
150
+
151
+ ChessboardComponent.displayName = 'Chessboard';
152
+
153
+ export const Chessboard = memo(ChessboardComponent);
154
+
155
+ const PromotionSelector = ({
156
+ grid,
157
+ piece,
158
+ onSelect,
159
+ }: {
160
+ grid: Record<string, DOMRectBounds>;
161
+ piece: PieceRecord;
162
+ onSelect: (piece: PieceRecord) => void;
163
+ }) => {
164
+ const positions = ['Q', 'N', 'R', 'B'].map((pieceType, i) => {
165
+ const location = [piece.location[0] + (piece.location[0] === 0 ? i : -i), piece.location[1]] as Location;
166
+ return {
167
+ piece: {
168
+ id: `promotion-${pieceType}`,
169
+ type: (piece.side === 'black' ? 'B' : 'W') + pieceType,
170
+ side: piece.side,
171
+ location,
172
+ },
173
+ bounds: grid[locationToString(location)],
174
+ };
175
+ });
176
+
177
+ const handleSelect = (selected: PieceRecord) => {
178
+ onSelect({ ...piece, type: selected.type });
179
+ };
180
+
181
+ return (
182
+ <>
183
+ {positions.map(({ piece, bounds }) => (
184
+ <Gameboard.Piece
185
+ key={piece.id}
186
+ classNames={mx('border-2 border-neutral-700 rounded-full', boardStyles.promotion)}
187
+ piece={piece}
188
+ bounds={bounds}
189
+ Component={ChessPieces[piece.type as ChessPiece]}
190
+ onClick={() => handleSelect(piece)}
191
+ />
192
+ ))}
193
+ </>
194
+ );
195
+ };
196
+
197
+ const getSquareLocation = (container: HTMLElement, location: Location): HTMLElement | null => {
198
+ return container.querySelector(`[data-location="${locationToString(location)}"]`);
199
+ };
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Chess as ChessJS } from 'chess.js';
6
+ import { describe, it } from 'vitest';
7
+
8
+ import { createPieceMap } from './chess';
9
+
10
+ describe('ChessModel', () => {
11
+ it('should update pieces', ({ expect }) => {
12
+ const chess = new ChessJS();
13
+ chess.loadPgn(
14
+ '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
15
+ );
16
+ const pieces = createPieceMap(chess);
17
+ expect(pieces).to.exist;
18
+ });
19
+ });