From a2cb58d2486e15d724706258bd11f08ebc6412d6 Mon Sep 17 00:00:00 2001 From: Aaron Dalton Date: Tue, 10 Sep 2024 16:43:26 -0600 Subject: [PATCH] Add squares-diamonds board --- CHANGELOG.md | 6 ++++++ package-lock.json | 39 ++++++++++++---------------------- package.json | 4 ++-- src/components/Annotate.svelte | 15 ++++++++++--- src/components/Board.svelte | 27 +++++++++++++++++++++++ src/components/Play.svelte | 4 ++++ 6 files changed, 65 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13fa8cb..847fe46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.1] - 2024-09-10 + +### Added + +- Added support for the new `squares-diamonds` board. Flood-fill only. + ## [1.4.0] - 2024-08-18 ### Added diff --git a/package-lock.json b/package-lock.json index 2b76431..67755e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "abstractplay-designer", "version": "1.4.0", "dependencies": { - "@abstractplay/renderer": "latest", + "@abstractplay/renderer": "^1.0.0-ci-10801591922.0", "nanoid": "^4.0.2", "peerjs": "^1.4.7", "rfdc": "^1.3.0" @@ -29,9 +29,9 @@ } }, "node_modules/@abstractplay/renderer": { - "version": "1.0.0-ci-10392533066.0", - "resolved": "https://npm.pkg.github.com/download/@abstractplay/renderer/1.0.0-ci-10392533066.0/47d2c3b4de76f7540fce217591a38c9c0f5cb635", - "integrity": "sha512-eAOUGAnkS/Zana+NKpXrn0W2YH/e6VpnArKEBTHZCe2WuwJC4Mf6tHLc1kU5O3CbdURw//seH/xnPIHnW3EX0Q==", + "version": "1.0.0-ci-10801591922.0", + "resolved": "https://npm.pkg.github.com/download/@abstractplay/renderer/1.0.0-ci-10801591922.0/e06904669c7d5622e6ed5c28e376e3c4d13758f6", + "integrity": "sha512-i80skREjE+LzIry5aQnrHipzvgE5xG1ohDGT1wcT3T0HyibSPAEm3bR+veeEKgDGWczkzHDoZWbYEUU7oSwRtw==", "license": "MIT", "dependencies": { "@svgdotjs/svg.js": "3.2.0", @@ -819,14 +819,14 @@ } }, "node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -1931,6 +1931,11 @@ "node": ">=8.6.0" } }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -3333,14 +3338,6 @@ "once": "^1.3.1" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -4208,14 +4205,6 @@ "type": "^2.5.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index ea815e2..25990f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "abstractplay-designer", "private": true, - "version": "1.4.0", + "version": "1.4.1", "type": "module", "scripts": { "dev": "vite", @@ -29,7 +29,7 @@ "vite": "^4.4.5" }, "dependencies": { - "@abstractplay/renderer": "latest", + "@abstractplay/renderer": "^1.0.0-ci-10801591922.0", "nanoid": "^4.0.2", "peerjs": "^1.4.7", "rfdc": "^1.3.0" diff --git a/src/components/Annotate.svelte b/src/components/Annotate.svelte index d1e2b1d..4329141 100644 --- a/src/components/Annotate.svelte +++ b/src/components/Annotate.svelte @@ -10,11 +10,16 @@ const boardClick = (row: number, col: number, piece: string) => { console.log(`Row: ${row}, Col: ${col}, Piece: ${piece}`); - const idx = currentTargets.findIndex(t => t[0] === col && t[1] === row); + const idx = currentTargets.findIndex( + (t) => t[0] === col && t[1] === row + ); if (idx === -1) { currentTargets = [...currentTargets, [col, row]]; } else { - currentTargets = [...currentTargets.slice(0, idx), ...currentTargets.slice(idx+1)]; + currentTargets = [ + ...currentTargets.slice(0, idx), + ...currentTargets.slice(idx + 1), + ]; } return false; }; @@ -217,7 +222,11 @@ {/if}
-

Targets (click to add/remove):

+

+ Targets (click to add/remove): +

    {#each currentTargets as target}
  • {target[0]}, {target[1]}
  • diff --git a/src/components/Board.svelte b/src/components/Board.svelte index 9f756f9..d28525e 100644 --- a/src/components/Board.svelte +++ b/src/components/Board.svelte @@ -22,6 +22,10 @@ "snubsquare", "A unique combination of squares and triangles where most cells have five connections; pieces are placed on the vertices", ], + [ + "squares-diamonds", + "A square board where the vertices are also spaces. In the designer, pieces cannot be placed anywhere. You can only use flood fill.", + ], [ "vertex", "A grid of squares, no shading, with pieces placed on the vertices of the lines", @@ -96,6 +100,7 @@ let symmetryLocked = true; let invertOrientation = false; let canInvertOrientation = false; + let startDiamonds = false; const initVars = () => { canBlock = false; canAlternate = false; @@ -159,6 +164,16 @@ } }; + const handleSDChange = () => { + if ($state.board.style === "squares-diamonds") { + if (startDiamonds) { + $state.board.sdStart = "D"; + } else { + $state.board.sdStart = "S"; + } + } + }; + const handleStyleChange = () => { if ($state.board.style === undefined) { $state.board = { style: undefined }; @@ -425,6 +440,18 @@
{/if} + {#if $state.board.style === "squares-diamonds"} +
+ +
+ {/if} {#if canAlternate}