Skip to content

Commit

Permalink
chore: add required shortest and longest word in crossword (#573)
Browse files Browse the repository at this point in the history
* chore: remove duplicated closed from crossword generator

* chore: add required shortest and longest word in crossword
  • Loading branch information
AyadLaouissi authored Jun 17, 2024
1 parent af85e40 commit 4d4fe4f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/board_generator_playground/lib/src/crossword.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ typedef CharacterMap = Map<Location, CharacterData>;
class Crossword {
/// {@macro crossword}
Crossword({
required this.largestWordLength,
required this.shortestWordLength,
this.bounds,
this.largestWordLength = 18,
this.shortestWordLength = 3,
});

/// {@macro character_map}
Expand Down
15 changes: 12 additions & 3 deletions packages/board_generator_playground/test/src/crossword_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ void main() {
group('$Crossword', () {
group('add', () {
test('adds a down word to the character map', () {
final board = Crossword();
final board = Crossword(
largestWordLength: 18,
shortestWordLength: 3,
);

final url = WordEntry(
word: 'url',
Expand Down Expand Up @@ -40,7 +43,10 @@ void main() {
});

test('adds an across word to the character map', () {
final board = Crossword();
final board = Crossword(
largestWordLength: 18,
shortestWordLength: 3,
);

final url = WordEntry(
word: 'url',
Expand Down Expand Up @@ -80,7 +86,10 @@ void main() {
direction: Direction.across,
);

final board = Crossword()
final board = Crossword(
largestWordLength: 18,
shortestWordLength: 3,
)
..add(behan)
..add(albus);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import 'package:board_generator_playground/src/models/models.dart';
class Crossword1 extends Crossword {
/// {@macro crossword1}
Crossword1({
super.largestWordLength = 18,
super.shortestWordLength = 3,
super.bounds,
super.largestWordLength,
}) {
add(
WordEntry(
Expand Down Expand Up @@ -50,7 +51,10 @@ class Crossword1 extends Crossword {
/// {@endtemplate}
class Crossword2 extends Crossword {
/// {@macro crossword2}
Crossword2() {
Crossword2({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'behan',
Expand Down Expand Up @@ -89,7 +93,10 @@ class Crossword2 extends Crossword {
/// {@endtemplate}
class Crossword3 extends Crossword {
/// {@macro crossword3}
Crossword3() {
Crossword3({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'behan',
Expand Down Expand Up @@ -135,7 +142,10 @@ class Crossword3 extends Crossword {
/// {@endtemplate}
class Crossword4 extends Crossword {
/// {@macro crossword4}
Crossword4() {
Crossword4({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'behan',
Expand Down Expand Up @@ -175,7 +185,10 @@ class Crossword4 extends Crossword {
/// {@endtemplate}
class Crossword5 extends Crossword {
/// {@macro crossword5}
Crossword5() {
Crossword5({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'behan',
Expand Down Expand Up @@ -234,7 +247,10 @@ class Crossword5 extends Crossword {
/// {@endtemplate}
class Crossword6 extends Crossword {
/// {@macro crossword6}
Crossword6() {
Crossword6({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'orchardbankcom',
Expand Down Expand Up @@ -322,7 +338,10 @@ class Crossword6 extends Crossword {
/// {@endtemplate}
class Crossword7 extends Crossword {
/// {@macro crossword7}
Crossword7() {
Crossword7({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'libexec',
Expand Down Expand Up @@ -401,7 +420,10 @@ class Crossword7 extends Crossword {
/// {@endtemplate}
class Crossword8 extends Crossword {
/// {@macro crossword8}
Crossword8() {
Crossword8({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'superman',
Expand Down Expand Up @@ -446,7 +468,10 @@ class Crossword8 extends Crossword {
/// {@endtemplate}
class Crossword9 extends Crossword {
/// {@macro crossword9}
Crossword9() {
Crossword9({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'interchangeability',
Expand Down Expand Up @@ -499,7 +524,10 @@ class Crossword9 extends Crossword {
/// {@endtemplate}
class Crossword10 extends Crossword {
/// {@macro crossword8}
Crossword10() {
Crossword10({
super.largestWordLength = 18,
super.shortestWordLength = 3,
}) {
add(
WordEntry(
word: 'sos',
Expand Down

0 comments on commit 4d4fe4f

Please sign in to comment.