Skip to content

Commit 47bd49d

Browse files
committed
Renamed square commands. Modified mirror command. TODO: Fix tests.
1 parent c931fa0 commit 47bd49d

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
lines changed

lib/src/coloring/advanced_coloring.dart

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Coloring extends BasicColoring {
196196
/// Color with a square shape from the current position.
197197
///
198198
/// Requires a list of [colors].
199-
bool squareBottomLeft(List<int> colors, [int? n]) {
199+
bool squareRightUpLeft(List<int> colors, [int? n]) {
200200
final int originalRow = move.row;
201201
final int originalColumn = move.column;
202202
if (move.right() && move.up() && move.left()) {
@@ -219,7 +219,7 @@ class Coloring extends BasicColoring {
219219
/// Color with a square shape from the current position.
220220
///
221221
/// Requires a list of [colors].
222-
bool squareBottomLeftReverse(List<int> colors, [int? n]) {
222+
bool squareUpRightDown(List<int> colors, [int? n]) {
223223
final int originalRow = move.row;
224224
final int originalColumn = move.column;
225225
if (move.up() && move.right() && move.down()) {
@@ -242,7 +242,7 @@ class Coloring extends BasicColoring {
242242
/// Color with a square shape from the current position.
243243
///
244244
/// Requires a list of [colors].
245-
bool squareBottomRight(List<int> colors, [int? n]) {
245+
bool squareUpLeftDown(List<int> colors, [int? n]) {
246246
final int originalRow = move.row;
247247
final int originalColumn = move.column;
248248
if (move.up() && move.left() && move.down()) {
@@ -265,7 +265,7 @@ class Coloring extends BasicColoring {
265265
/// Color with a square shape from the current position.
266266
///
267267
/// Requires a list of [colors].
268-
bool squareBottomRightReverse(List<int> colors, [int? n]) {
268+
bool squareLeftUpRight(List<int> colors, [int? n]) {
269269
final int originalRow = move.row;
270270
final int originalColumn = move.column;
271271
if (move.left() && move.up() && move.right()) {
@@ -288,7 +288,7 @@ class Coloring extends BasicColoring {
288288
/// Color with a square shape from the current position.
289289
///
290290
/// Requires a list of [colors].
291-
bool squareTopLeft(List<int> colors, [int? n]) {
291+
bool squareDownRightUp(List<int> colors, [int? n]) {
292292
final int originalRow = move.row;
293293
final int originalColumn = move.column;
294294
if (move.down() && move.right() && move.up()) {
@@ -311,7 +311,7 @@ class Coloring extends BasicColoring {
311311
/// Color with a square shape from the current position.
312312
///
313313
/// Requires a list of [colors].
314-
bool squareTopLeftReverse(List<int> colors, [int? n]) {
314+
bool squareRightDownLeft(List<int> colors, [int? n]) {
315315
final int originalRow = move.row;
316316
final int originalColumn = move.column;
317317
if (move.right() && move.down() && move.left()) {
@@ -334,7 +334,7 @@ class Coloring extends BasicColoring {
334334
/// Color with a square shape from the current position.
335335
///
336336
/// Requires a list of [colors].
337-
bool squareTopRight(List<int> colors, [int? n]) {
337+
bool squareLeftDownRight(List<int> colors, [int? n]) {
338338
final int originalRow = move.row;
339339
final int originalColumn = move.column;
340340
if (move.left() && move.down() && move.right()) {
@@ -357,7 +357,7 @@ class Coloring extends BasicColoring {
357357
/// Color with a square shape from the current position.
358358
///
359359
/// Requires a list of [colors].
360-
bool squareTopRightReverse(List<int> colors, [int? n]) {
360+
bool squareDownLeftUp(List<int> colors, [int? n]) {
361361
final int originalRow = move.row;
362362
final int originalColumn = move.column;
363363
if (move.down() && move.left() && move.up()) {
@@ -713,9 +713,10 @@ class Coloring extends BasicColoring {
713713
/// Returns:
714714
/// A boolean value.
715715
bool mirrorHorizontal() {
716-
if (move.row <= 2) {
717-
return mirrorHorizontalUpDown();
718-
}
716+
// if (move.row <= 2) {
717+
// return mirrorHorizontalUpDown();
718+
// }
719+
mirrorHorizontalUpDown();
719720

720721
return mirrorHorizontalDownUp();
721722
}
@@ -727,9 +728,10 @@ class Coloring extends BasicColoring {
727728
/// Returns:
728729
/// A boolean value.
729730
bool mirrorVertical() {
730-
if (move.column <= 2) {
731-
return mirrorVerticalLeftRight();
732-
}
731+
// if (move.column <= 2) {
732+
// return
733+
// }
734+
mirrorVerticalLeftRight();
733735

734736
return mirrorVerticalRightLeft();
735737
}

lib/src/command_caller.dart

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,26 @@ class CommandCaller {
2727

2828
/// It's creating a map of functions that can be called by name.
2929
late final Map<String, Function> _coloring = <String, Function>{
30+
// Directions
3031
"up": board.up,
3132
"down": board.down,
3233
"left": board.left,
3334
"right": board.right,
34-
"squareBottomLeft": board.squareBottomLeft,
35-
"squareBottomRight": board.squareBottomRight,
36-
"squareTopLeft": board.squareTopLeft,
37-
"squareTopRight": board.squareTopRight,
38-
"squareBottomLeftReverse": board.squareBottomLeftReverse,
39-
"squareBottomRightReverse": board.squareBottomRightReverse,
40-
"squareTopLeftReverse": board.squareTopLeftReverse,
41-
"squareTopRightReverse": board.squareTopRightReverse,
35+
// Square
36+
"squareRightUpLeft": board.squareRightUpLeft,
37+
"squareUpLeftDown": board.squareUpLeftDown,
38+
"squareDownRightUp": board.squareDownRightUp,
39+
"squareLeftDownRight": board.squareLeftDownRight,
40+
"squareUpRightDown": board.squareUpRightDown,
41+
"squareLeftUpRight": board.squareLeftUpRight,
42+
"squareRightDownLeft": board.squareRightDownLeft,
43+
"squareDownLeftUp": board.squareDownLeftUp,
44+
// Diagonal
4245
"diagonalUpLeft": board.diagonalUpLeft,
4346
"diagonalUpRight": board.diagonalUpRight,
4447
"diagonalDownLeft": board.diagonalDownLeft,
4548
"diagonalDownRight": board.diagonalDownRight,
49+
// L
4650
"lUpLeft": board.lUpLeft,
4751
"lUpRight": board.lUpRight,
4852
"lDownLeft": board.lDownLeft,
@@ -51,6 +55,7 @@ class CommandCaller {
5155
"lLeftDown": board.lLeftDown,
5256
"lRightUp": board.lRightUp,
5357
"lRightDown": board.lRightDown,
58+
// Zig-zag
5459
"zigzagLeftUpDown": board.zigzagLeftUpDown,
5560
"zigzagLeftDownUp": board.zigzagLeftDownUp,
5661
"zigzagRightUpDown": board.zigzagRightUpDown,
@@ -59,10 +64,12 @@ class CommandCaller {
5964
"zigzagUpRightLeft": board.zigzagUpRightLeft,
6065
"zigzagDownLeftRight": board.zigzagDownLeftRight,
6166
"zigzagDownRightLeft": board.zigzagDownRightLeft,
67+
// Mirror
6268
"mirrorVertical": board.mirrorVertical,
6369
"mirrorHorizontal": board.mirrorHorizontal,
6470
"mirrorCellHorizontal": board.mirrorCellHorizontal,
6571
"mirrorCellVertical": board.mirrorCellVertical,
72+
// Color
6673
"fillEmpty": board.fillEmpty,
6774
"color": board.color,
6875
};

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ environment:
1010
dependencies:
1111
colorize: ^3.0.0
1212
dartx: ^1.1.0
13-
path: ^1.8.2
13+
path: ^1.8.3
1414

1515
dev_dependencies:
16-
dart_code_metrics: ^5.6.0
16+
dart_code_metrics: ^5.7.2
1717
lints: ^2.0.1
1818
test: ^1.21.1

0 commit comments

Comments
 (0)