Skip to content

Commit

Permalink
add an uneven crossword for testing (#1777)
Browse files Browse the repository at this point in the history
add an uneven crossword for testing with a different number of rows and cols
  • Loading branch information
oliverabrahams authored Nov 12, 2024
1 parent 2b320e0 commit 3cf8a87
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libs/@guardian/react-crossword/src/utils/getCells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const fillSeparatorCells = ({
rows: number;
cols: number;
}): Cells => {
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
for (let i = 0; i < cols; i++) {
for (let j = 0; j < rows; j++) {
const currentCell = cells.get(`x${i}y${j}`);
if (currentCell === undefined) {
const newCell: Cell = {
Expand Down
7 changes: 6 additions & 1 deletion libs/@guardian/react-crossword/stories/Formats.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Crossword } from '../src/index';
import { Crossword } from '../src';
import { defaultTheme } from '../src/theme';
import { cryptic } from './formats/cryptic';
import { everyman } from './formats/everyman';
Expand All @@ -9,6 +9,7 @@ import { quickCryptic } from './formats/quick-cryptic';
import { quiptic } from './formats/quiptic';
import { special } from './formats/special';
import { speedy } from './formats/speedy';
import { uneven } from './formats/uneven';
import { weekend } from './formats/weekend';

const meta: Meta<typeof Crossword> = {
Expand Down Expand Up @@ -57,3 +58,7 @@ export const Speedy: Story = {
export const Weekend: Story = {
args: { data: weekend },
};

export const Uneven: Story = {
args: { data: uneven },
};
175 changes: 175 additions & 0 deletions libs/@guardian/react-crossword/stories/formats/uneven.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import type { CAPICrossword } from '../../src/@types/CAPI';

export const uneven: CAPICrossword = {
id: 'crosswords/uneven/1',
number: 1,
name: 'Uneven crossword No 1',
creator: {
name: 'Oliver',
webUrl: 'https://www.theguardian.com/profile/maskarade',
},
date: 1729900800000,
webPublicationDate: 1729897217000,
entries: [
{
id: '7-across',
number: 7,
humanNumber: '7',
clue: 'Yields to Wimbledon favourites, we’re told (5)',
direction: 'across',
length: 5,
group: ['7-across'],
position: {
x: 0,
y: 2,
},
separatorLocations: {},
solution: 'CEDES',
},
{
id: '9-across',
number: 9,
humanNumber: '9',
clue: 'Deafening noise of item of sports equipment heard (6)',
direction: 'across',
length: 6,
group: ['9-across'],
position: {
x: 0,
y: 4,
},
separatorLocations: {},
solution: 'RACKET',
},
{
id: '13-across',
number: 13,
humanNumber: '13',
clue: 'Whitish bucket is suggested (4)',
direction: 'across',
length: 4,
group: ['13-across'],
position: {
x: 0,
y: 6,
},
separatorLocations: {},
solution: 'PALE',
},
{
id: '17-across',
number: 17,
humanNumber: '17',
clue: 'Bird with the French name (5)',
direction: 'across',
length: 5,
group: ['17-across'],
position: {
x: 0,
y: 8,
},
separatorLocations: {},
solution: 'TITLE',
},
{
id: '1-down',
number: 1,
humanNumber: '1',
clue: 'Parish priest and little girl by vehicle (5)',
direction: 'down',
length: 5,
group: ['1-down'],
position: {
x: 0,
y: 0,
},
separatorLocations: {},
solution: 'VICAR',
},
{
id: '2-down',
number: 2,
humanNumber: '2',
clue: 'Extremist’s excellent in slang (7)',
direction: 'down',
length: 7,
group: ['2-down'],
position: {
x: 2,
y: 0,
},
separatorLocations: {},
solution: 'RADICAL',
},
{
id: '3-down',
number: 3,
humanNumber: '3',
clue: 'The reply is “Warne’s out!” (6)',
direction: 'down',
length: 6,
group: ['3-down'],
position: {
x: 4,
y: 0,
},
separatorLocations: {},
solution: 'ANSWER',
},
{
id: '13-down',
number: 13,
humanNumber: '13',
clue: 'Darlings step out (4)',
direction: 'down',
length: 4,
group: ['13-down'],
position: {
x: 0,
y: 6,
},
separatorLocations: {},
solution: 'PETS',
},
{
id: '16-down',
number: 16,
humanNumber: '16',
clue: 'Squint at member of the House of Lords (4)',
direction: 'down',
length: 4,
group: ['16-down'],
position: {
x: 4,
y: 7,
},
separatorLocations: {},
solution: 'PEER',
},
{
id: '18-down',
number: 18,
humanNumber: '18',
clue: 'Rubbish work on a shuttle (3)',
direction: 'down',
length: 3,
group: ['18-down'],
position: {
x: 2,
y: 8,
},
separatorLocations: {},
solution: 'TAT',
},
],
solutionAvailable: true,
dateSolutionAvailable: 1729897200000,
dimensions: {
cols: 7,
rows: 11,
},
crosswordType: 'quick-cryptic',
pdf: 'https://crosswords-static.guim.co.uk/gdn.quick-cryptic.20241026.pdf',
instructions:
'<b>TODAY’S TRICKS</b> Clues begin or end with a definition of the answer. The rest is one of these:\n<b>Anagram</b>\nAn anagram of the answer and a hint that there’s an anagram\n‘Senator arranged crime (7)’ gives TREASON\n<b>Charade</b>\nA combination of synonyms\n‘Qualify to get drink for ID (8)’ gives PASSPORT (pass + port)\n<b>Double definition</b>\nBoth halves are definitions!\n‘Search scrub (5)’ gives SCOUR\n<b>Soundalike</b>\nSomething that sounds like the answer\n‘Excited as Oscar’s announced (4)’ gives WILD',
};

0 comments on commit 3cf8a87

Please sign in to comment.