Skip to content

Commit

Permalink
fix bug where largest custom was disallowed
Browse files Browse the repository at this point in the history
  • Loading branch information
skedwards88 committed Aug 26, 2024
1 parent 250293e commit 83674c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ For screenshots:

- Use the hasVisited state to announce
- add some custom daily puzzles
- consolidate control buttons into hamburger menu (and add share button)

- // todo put screenshots of lexlet and blobble and wordfall ()as webp/compressed images? in MoreGames.js
- add link to sponsors?
- rules = use the icons instead of words
- rules = use line-spacing in css instead of multiple br
- relocate to new file:
- getWordValidityGrids
- countingGrid
- just rename dispatch params to dispatcher everywhere
- put arrayToGrid to common or to word-logic package
- piecesOverlapQ should use getGridFromPieces
- // todo put screenshots of lexlet and blobble and wordfall ()as webp/compressed images? in MoreGames.js
6 changes: 3 additions & 3 deletions src/logic/convertRepresentativeStringToGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export function convertRepresentativeStringToGrid(string) {
}
}

// Error if the list does not form a square grid between 8x8 and 12x12
// Error if the list does not form a square grid between 8x8 and 14x14
const dimension = Math.sqrt(list.length);
if (dimension % 1 !== 0) {
throw new Error("Input string does not form a square grid");
}
if (dimension < 8 || dimension > 12) {
throw new Error("Input string must form a grid between 8x8 and 12x12");
if (dimension < 8 || dimension > 14) {
throw new Error("Input string must form a grid between 8x8 and 14x14");
}

// I'm assuming that people won't build custom query strings outside of the UI,
Expand Down
8 changes: 4 additions & 4 deletions src/logic/convertRepresentativeStringToGrid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ describe("convertRepresentativeStringToGrid", () => {
test("throws an error if the resulting grid is smaller than 8x8", () => {
const input = "0AB2EF3";
expect(() => convertRepresentativeStringToGrid(input)).toThrow(
"Input string must form a grid between 8x8 and 12x12",
"Input string must form a grid between 8x8 and 14x14",
);
});

test("throws an error if the resulting grid is larger than 12x12", () => {
const input = "0AB165CD";
test("throws an error if the resulting grid is larger than 14x14", () => {
const input = "0AB221CD";
expect(() => convertRepresentativeStringToGrid(input)).toThrow(
"Input string must form a grid between 8x8 and 12x12",
"Input string must form a grid between 8x8 and 14x14",
);
});
});

0 comments on commit 83674c0

Please sign in to comment.