Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • android/org.benoitharrault.suguru
1 result
Show changes
Commits on Source (2)
Fix rotate board.
Correction sur rotation de la grille.
...@@ -36,8 +36,6 @@ class ActivityCubit extends HydratedCubit<ActivityState> { ...@@ -36,8 +36,6 @@ class ActivityCubit extends HydratedCubit<ActivityState> {
boardAnimated: state.currentActivity.boardAnimated, boardAnimated: state.currentActivity.boardAnimated,
// Base data // Base data
board: state.currentActivity.board, board: state.currentActivity.board,
boardSizeHorizontal: state.currentActivity.boardSizeHorizontal,
boardSizeVertical: state.currentActivity.boardSizeVertical,
// Game data // Game data
boardConflicts: state.currentActivity.boardConflicts, boardConflicts: state.currentActivity.boardConflicts,
selectedCell: state.currentActivity.selectedCell, selectedCell: state.currentActivity.selectedCell,
...@@ -154,8 +152,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> { ...@@ -154,8 +152,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> {
} }
void setAnimatedBackground(List animatedCellsPattern) { void setAnimatedBackground(List animatedCellsPattern) {
for (int row = 0; row < state.currentActivity.boardSizeVertical; row++) { for (int row = 0; row < state.currentActivity.board.boardSizeVertical; row++) {
for (int col = 0; col < state.currentActivity.boardSizeHorizontal; col++) { for (int col = 0; col < state.currentActivity.board.boardSizeHorizontal; col++) {
state.currentActivity.boardAnimated[row][col] = animatedCellsPattern[row][col]; state.currentActivity.boardAnimated[row][col] = animatedCellsPattern[row][col];
} }
} }
...@@ -163,8 +161,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> { ...@@ -163,8 +161,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> {
} }
void resetAnimatedBackground() { void resetAnimatedBackground() {
for (int row = 0; row < state.currentActivity.boardSizeVertical; row++) { for (int row = 0; row < state.currentActivity.board.boardSizeVertical; row++) {
for (int col = 0; col < state.currentActivity.boardSizeHorizontal; col++) { for (int col = 0; col < state.currentActivity.board.boardSizeHorizontal; col++) {
state.currentActivity.boardAnimated[row][col] = false; state.currentActivity.boardAnimated[row][col] = false;
} }
} }
......
...@@ -26,8 +26,6 @@ class Activity { ...@@ -26,8 +26,6 @@ class Activity {
// Base data // Base data
required this.board, required this.board,
required this.boardSizeHorizontal,
required this.boardSizeVertical,
// Game data // Game data
this.boardConflicts = const [], this.boardConflicts = const [],
...@@ -49,8 +47,6 @@ class Activity { ...@@ -49,8 +47,6 @@ class Activity {
// Base data // Base data
final Board board; final Board board;
final int boardSizeHorizontal;
final int boardSizeVertical;
// Game data // Game data
ConflictsCount boardConflicts; ConflictsCount boardConflicts;
...@@ -65,8 +61,6 @@ class Activity { ...@@ -65,8 +61,6 @@ class Activity {
activitySettings: ActivitySettings.createDefault(appConfig: ApplicationConfig.config), activitySettings: ActivitySettings.createDefault(appConfig: ApplicationConfig.config),
// Base data // Base data
board: Board.createEmpty(), board: Board.createEmpty(),
boardSizeHorizontal: 0,
boardSizeVertical: 0,
// Game data // Game data
givenTipsCount: 0, givenTipsCount: 0,
); );
...@@ -90,15 +84,15 @@ class Activity { ...@@ -90,15 +84,15 @@ class Activity {
return Activity.createEmpty(); return Activity.createEmpty();
} }
final String boardSizeAsString = templateParts[0]; // Build main game board
final int boardSizeHorizontal = int.parse(boardSizeAsString.split('x')[0]); final Board board = Board.createEmpty();
final int boardSizeVertical = int.parse(boardSizeAsString.split('x')[1]); board.createFromTemplate(template: template);
// Build empty conflicts board // Build empty conflicts board
ConflictsCount nonConflictedBoard = []; ConflictsCount nonConflictedBoard = [];
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
List<int> line = []; List<int> line = [];
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
line.add(0); line.add(0);
} }
nonConflictedBoard.add(line); nonConflictedBoard.add(line);
...@@ -106,18 +100,14 @@ class Activity { ...@@ -106,18 +100,14 @@ class Activity {
// Build empty animated background // Build empty animated background
AnimatedBoard notAnimatedBoard = []; AnimatedBoard notAnimatedBoard = [];
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
List<bool> line = []; List<bool> line = [];
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
line.add(false); line.add(false);
} }
notAnimatedBoard.add(line); notAnimatedBoard.add(line);
} }
// Build main game board
final Board board = Board.createEmpty();
board.createFromTemplate(template: template);
return Activity( return Activity(
// Settings // Settings
activitySettings: newActivitySettings, activitySettings: newActivitySettings,
...@@ -126,8 +116,6 @@ class Activity { ...@@ -126,8 +116,6 @@ class Activity {
boardAnimated: notAnimatedBoard, boardAnimated: notAnimatedBoard,
// Base data // Base data
board: board, board: board,
boardSizeHorizontal: boardSizeHorizontal,
boardSizeVertical: boardSizeVertical,
// Game data // Game data
boardConflicts: nonConflictedBoard, boardConflicts: nonConflictedBoard,
selectedCell: null, selectedCell: null,
...@@ -154,23 +142,23 @@ class Activity { ...@@ -154,23 +142,23 @@ class Activity {
final ConflictsCount conflicts = boardConflicts; final ConflictsCount conflicts = boardConflicts;
// reset conflict states // reset conflict states
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
conflicts[row][col] = 0; conflicts[row][col] = 0;
} }
} }
// check siblings // check siblings
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
final int value = cells[row][col].value; final int value = cells[row][col].value;
if (value != 0) { if (value != 0) {
for (int deltaRow = -1; deltaRow <= 1; deltaRow++) { for (int deltaRow = -1; deltaRow <= 1; deltaRow++) {
for (int deltaCol = -1; deltaCol <= 1; deltaCol++) { for (int deltaCol = -1; deltaCol <= 1; deltaCol++) {
if (row + deltaRow >= 0 && if (row + deltaRow >= 0 &&
row + deltaRow < boardSizeHorizontal && row + deltaRow < board.boardSizeHorizontal &&
col + deltaCol >= 0 && col + deltaCol >= 0 &&
col + deltaCol < boardSizeVertical && col + deltaCol < board.boardSizeVertical &&
(deltaRow * deltaCol != 0)) { (deltaRow * deltaCol != 0)) {
final int siblingValue = cells[row + deltaRow][col + deltaCol].value; final int siblingValue = cells[row + deltaRow][col + deltaCol].value;
...@@ -188,8 +176,8 @@ class Activity { ...@@ -188,8 +176,8 @@ class Activity {
for (String blockId in board.getBlockIds()) { for (String blockId in board.getBlockIds()) {
List<int> values = []; List<int> values = [];
List<int> duplicateValues = []; List<int> duplicateValues = [];
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
if (cells[row][col].blockId == blockId) { if (cells[row][col].blockId == blockId) {
final int value = cells[row][col].value; final int value = cells[row][col].value;
if (value != 0) { if (value != 0) {
...@@ -203,8 +191,8 @@ class Activity { ...@@ -203,8 +191,8 @@ class Activity {
} }
} }
for (int duplicateValue in duplicateValues) { for (int duplicateValue in duplicateValues) {
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
if (cells[row][col].blockId == blockId && if (cells[row][col].blockId == blockId &&
cells[row][col].value == duplicateValue) { cells[row][col].value == duplicateValue) {
conflicts[row][col]++; conflicts[row][col]++;
...@@ -289,8 +277,8 @@ class Activity { ...@@ -289,8 +277,8 @@ class Activity {
List<CellLocation> cellsWithWrongValue = []; List<CellLocation> cellsWithWrongValue = [];
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
if (cells[row][col].value != 0 && if (cells[row][col].value != 0 &&
cells[row][col].value != cellsSolved[row][col].value) { cells[row][col].value != cellsSolved[row][col].value) {
cellsWithWrongValue.add(CellLocation.go(row, col)); cellsWithWrongValue.add(CellLocation.go(row, col));
...@@ -304,8 +292,8 @@ class Activity { ...@@ -304,8 +292,8 @@ class Activity {
List<CellLocation> getCellsWithConflicts() { List<CellLocation> getCellsWithConflicts() {
List<CellLocation> cellsWithConflict = []; List<CellLocation> cellsWithConflict = [];
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < board.boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < board.boardSizeHorizontal; col++) {
if (boardConflicts[row][col] != 0) { if (boardConflicts[row][col] != 0) {
cellsWithConflict.add(CellLocation.go(row, col)); cellsWithConflict.add(CellLocation.go(row, col));
} }
...@@ -327,9 +315,6 @@ class Activity { ...@@ -327,9 +315,6 @@ class Activity {
printlog(' isStarted: $isStarted'); printlog(' isStarted: $isStarted');
printlog(' isFinished: $isFinished'); printlog(' isFinished: $isFinished');
printlog(' animationInProgress: $animationInProgress'); printlog(' animationInProgress: $animationInProgress');
printlog(' Base data');
printlog(' boardSizeHorizontal: $boardSizeHorizontal');
printlog(' boardSizeVertical: $boardSizeVertical');
printlog(' Game data'); printlog(' Game data');
printlog(' selectedCell: ${selectedCell?.toString() ?? ''}'); printlog(' selectedCell: ${selectedCell?.toString() ?? ''}');
printlog(' showConflicts: $showConflicts'); printlog(' showConflicts: $showConflicts');
...@@ -358,8 +343,6 @@ class Activity { ...@@ -358,8 +343,6 @@ class Activity {
'boardAnimated': boardAnimated, 'boardAnimated': boardAnimated,
// Base data // Base data
'board': board.toJson(), 'board': board.toJson(),
'boardSizeHorizontal': boardSizeHorizontal,
'boardSizeVertical': boardSizeVertical,
// Game data // Game data
'boardConflicts': boardConflicts, 'boardConflicts': boardConflicts,
'selectedCell': selectedCell?.toJson(), 'selectedCell': selectedCell?.toJson(),
......
...@@ -17,10 +17,24 @@ class Board { ...@@ -17,10 +17,24 @@ class Board {
BoardCells cells = const []; BoardCells cells = const [];
BoardCells solvedCells = const []; BoardCells solvedCells = const [];
factory Board.createEmpty() { factory Board.createEmpty([final int width = 0, final int height = 0]) {
final BoardCells cells = [];
for (int rowIndex = 0; rowIndex < height; rowIndex++) {
final List<Cell> row = [];
for (int colIndex = 0; colIndex < width; colIndex++) {
row.add(Cell(
location: CellLocation.go(rowIndex, colIndex),
blockId: '',
value: 0,
isFixed: false,
));
}
cells.add(row);
}
return Board( return Board(
cells: [], cells: cells,
solvedCells: [], solvedCells: cells,
); );
} }
...@@ -96,34 +110,12 @@ class Board { ...@@ -96,34 +110,12 @@ class Board {
// cells = solvedCells; // cells = solvedCells;
} }
// Helper to create board from size, with "empty" cells int get boardSizeVertical => cells.length;
static BoardCells createEmptyBoard(final int width, final int height) { int get boardSizeHorizontal => cells.isNotEmpty ? cells.first.length : 0;
final BoardCells cells = [];
for (int rowIndex = 0; rowIndex < height; rowIndex++) {
final List<Cell> row = [];
for (int colIndex = 0; colIndex < width; colIndex++) {
row.add(Cell(
location: CellLocation.go(rowIndex, colIndex),
blockId: '',
value: 0,
isFixed: false,
));
}
cells.add(row);
}
return cells;
}
List<CellLocation> getCellLocations([String? blockId]) { List<CellLocation> getCellLocations([String? blockId]) {
if (cells.isEmpty) {
return [];
}
final List<CellLocation> locations = []; final List<CellLocation> locations = [];
final int boardSizeVertical = cells.length;
final int boardSizeHorizontal = cells[0].length;
for (int row = 0; row < boardSizeVertical; row++) { for (int row = 0; row < boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) { for (int col = 0; col < boardSizeHorizontal; col++) {
if ((blockId == null) || (blockId == get(CellLocation.go(row, col)).blockId)) { if ((blockId == null) || (blockId == get(CellLocation.go(row, col)).blockId)) {
...@@ -136,14 +128,13 @@ class Board { ...@@ -136,14 +128,13 @@ class Board {
} }
void transformBoard() { void transformBoard() {
final int boardSizeVertical = cells.length;
final int boardSizeHorizontal = cells[0].length;
const List<String> allowedFlip = ['none', 'horizontal', 'vertical']; const List<String> allowedFlip = ['none', 'horizontal', 'vertical'];
List<String> allowedRotate = ['none', 'left', 'right', 'upsidedown']; List<String> allowedRotate = [];
// Limit rotation if board is not symetric // Force "vertical board"
if (boardSizeVertical != boardSizeHorizontal) { if (boardSizeVertical < boardSizeHorizontal) {
allowedRotate = ['left', 'right'];
} else {
allowedRotate = ['none', 'upsidedown']; allowedRotate = ['none', 'upsidedown'];
} }
...@@ -167,12 +158,14 @@ class Board { ...@@ -167,12 +158,14 @@ class Board {
switch (rotate) { switch (rotate) {
case 'left': case 'left':
{ {
transformRotateLeft(); transformRotate();
transformRotate();
transformRotate();
} }
break; break;
case 'right': case 'right':
{ {
transformRotateRight(); transformRotate();
} }
break; break;
case 'upsidedown': case 'upsidedown':
...@@ -186,7 +179,6 @@ class Board { ...@@ -186,7 +179,6 @@ class Board {
void transformFlipHorizontal() { void transformFlipHorizontal() {
final BoardCells transformedBoard = copyCells(); final BoardCells transformedBoard = copyCells();
final int boardSizeVertical = cells.length;
for (CellLocation location in getCellLocations()) { for (CellLocation location in getCellLocations()) {
final Cell cell = cells[boardSizeVertical - location.row - 1][location.col]; final Cell cell = cells[boardSizeVertical - location.row - 1][location.col];
...@@ -202,14 +194,8 @@ class Board { ...@@ -202,14 +194,8 @@ class Board {
} }
void transformFlipVertical() { void transformFlipVertical() {
if (cells.isEmpty) {
return;
}
final BoardCells transformedBoard = copyCells(); final BoardCells transformedBoard = copyCells();
final int boardSizeHorizontal = cells[0].length;
for (CellLocation location in getCellLocations()) { for (CellLocation location in getCellLocations()) {
final Cell cell = cells[location.row][boardSizeHorizontal - location.col - 1]; final Cell cell = cells[location.row][boardSizeHorizontal - location.col - 1];
transformedBoard[location.row][location.col] = Cell( transformedBoard[location.row][location.col] = Cell(
...@@ -223,43 +209,20 @@ class Board { ...@@ -223,43 +209,20 @@ class Board {
cells = transformedBoard; cells = transformedBoard;
} }
void transformRotateLeft() { void transformRotate() {
final BoardCells transformedBoard = copyCells(); final Board transformedBoard = Board.createEmpty(boardSizeVertical, boardSizeHorizontal);
final int boardSizeVertical = cells.length;
for (CellLocation location in getCellLocations()) { for (CellLocation location in getCellLocations()) {
final Cell cell = cells[location.col][boardSizeVertical - location.row - 1]; final Cell cell = get(location);
transformedBoard[location.row][location.col] = Cell( transformedBoard.cells[location.col][location.row] = Cell(
location: location, location: CellLocation.go(location.col, location.row),
blockId: cell.blockId,
value: cell.value,
isFixed: false,
);
}
cells = transformedBoard;
}
void transformRotateRight() {
if (cells.isEmpty) {
return;
}
final BoardCells transformedBoard = copyCells();
final int boardSizeHorizontal = cells[0].length;
for (CellLocation location in getCellLocations()) {
final Cell cell = cells[boardSizeHorizontal - location.col - 1][location.row];
transformedBoard[location.row][location.col] = Cell(
location: location,
blockId: cell.blockId, blockId: cell.blockId,
value: cell.value, value: cell.value,
isFixed: false, isFixed: false,
); );
} }
cells = transformedBoard; cells = transformedBoard.cells;
} }
bool inBoard(CellLocation location) { bool inBoard(CellLocation location) {
...@@ -521,10 +484,6 @@ class Board { ...@@ -521,10 +484,6 @@ class Board {
} }
bool cellHasSiblingWithSameValue(CellLocation cellLocation, [int? candidateValue]) { bool cellHasSiblingWithSameValue(CellLocation cellLocation, [int? candidateValue]) {
if (cells.isEmpty) {
return false;
}
final int value = candidateValue ?? get(cellLocation).value; final int value = candidateValue ?? get(cellLocation).value;
if (value != 0) { if (value != 0) {
for (int deltaCol in [-1, 0, 1]) { for (int deltaCol in [-1, 0, 1]) {
......
...@@ -158,25 +158,25 @@ class CellWidget extends StatelessWidget { ...@@ -158,25 +158,25 @@ class CellWidget extends StatelessWidget {
top: BorderSide( top: BorderSide(
width: cellBorderWidth, width: cellBorderWidth,
color: (hasBlockBorderTop || color: (hasBlockBorderTop ||
(((cell.location.row) % activity.boardSizeVertical) == 0)) (((cell.location.row) % activity.board.boardSizeVertical) == 0))
? cellBorderDarkColor ? cellBorderDarkColor
: cellBorderLightColor), : cellBorderLightColor),
left: BorderSide( left: BorderSide(
width: cellBorderWidth, width: cellBorderWidth,
color: (hasBlockBorderLeft || color: (hasBlockBorderLeft ||
(((cell.location.col) % activity.boardSizeHorizontal) == 0)) (((cell.location.col) % activity.board.boardSizeHorizontal) == 0))
? cellBorderDarkColor ? cellBorderDarkColor
: cellBorderLightColor), : cellBorderLightColor),
right: BorderSide( right: BorderSide(
width: cellBorderWidth, width: cellBorderWidth,
color: (hasBlockBorderRight || color: (hasBlockBorderRight ||
((((cell.location.col) + 1) % activity.boardSizeHorizontal) == 0)) ((((cell.location.col) + 1) % activity.board.boardSizeHorizontal) == 0))
? cellBorderDarkColor ? cellBorderDarkColor
: cellBorderLightColor), : cellBorderLightColor),
bottom: BorderSide( bottom: BorderSide(
width: cellBorderWidth, width: cellBorderWidth,
color: (hasBlockBorderBottom || color: (hasBlockBorderBottom ||
((((cell.location.row) + 1) % activity.boardSizeVertical) == 0)) ((((cell.location.row) + 1) % activity.board.boardSizeVertical) == 0))
? cellBorderDarkColor ? cellBorderDarkColor
: cellBorderLightColor), : cellBorderLightColor),
); );
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
...@@ -38,16 +37,18 @@ class GameBoardWidget extends StatelessWidget { ...@@ -38,16 +37,18 @@ class GameBoardWidget extends StatelessWidget {
Table( Table(
defaultColumnWidth: const IntrinsicColumnWidth(), defaultColumnWidth: const IntrinsicColumnWidth(),
children: [ children: [
for (int row = 0; row < currentActivity.boardSizeVertical; row++) for (int row = 0; row < currentActivity.board.boardSizeVertical; row++)
TableRow( TableRow(
children: [ children: [
for (int col = 0; col < currentActivity.boardSizeHorizontal; col++) for (int col = 0;
col < currentActivity.board.boardSizeHorizontal;
col++)
Column( Column(
children: [ children: [
CellWidget( CellWidget(
cell: currentActivity.board.get(CellLocation.go(row, col)), cell: currentActivity.board.get(CellLocation.go(row, col)),
hasBlockBorderBottom: hasBlockBorderBottom:
row == currentActivity.boardSizeVertical || row == currentActivity.board.boardSizeVertical ||
currentActivity.board currentActivity.board
.get(CellLocation.go(row, col)) .get(CellLocation.go(row, col))
.blockId != .blockId !=
...@@ -62,7 +63,7 @@ class GameBoardWidget extends StatelessWidget { ...@@ -62,7 +63,7 @@ class GameBoardWidget extends StatelessWidget {
.get(CellLocation.go(row, col - 1)) .get(CellLocation.go(row, col - 1))
.blockId, .blockId,
hasBlockBorderRight: hasBlockBorderRight:
col == currentActivity.boardSizeVertical || col == currentActivity.board.boardSizeVertical ||
currentActivity.board currentActivity.board
.get(CellLocation.go(row, col)) .get(CellLocation.go(row, col))
.blockId != .blockId !=
......
...@@ -13,9 +13,9 @@ class BoardAnimate { ...@@ -13,9 +13,9 @@ class BoardAnimate {
for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) { for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) {
AnimatedBoard pattern = []; AnimatedBoard pattern = [];
for (int row = 0; row < activity.boardSizeVertical; row++) { for (int row = 0; row < activity.board.boardSizeVertical; row++) {
List<bool> patternRow = []; List<bool> patternRow = [];
for (int col = 0; col < activity.boardSizeHorizontal; col++) { for (int col = 0; col < activity.board.boardSizeHorizontal; col++) {
patternRow.add(((patternIndex + row + col) % 2 == 0)); patternRow.add(((patternIndex + row + col) % 2 == 0));
} }
pattern.add(patternRow); pattern.add(patternRow);
...@@ -30,13 +30,13 @@ class BoardAnimate { ...@@ -30,13 +30,13 @@ class BoardAnimate {
static AnimatedBoardSequence createWinGameAnimationPatterns(Activity activity) { static AnimatedBoardSequence createWinGameAnimationPatterns(Activity activity) {
AnimatedBoardSequence patterns = []; AnimatedBoardSequence patterns = [];
int patternsCount = activity.boardSizeHorizontal + activity.boardSizeVertical; int patternsCount = activity.board.boardSizeHorizontal + activity.board.boardSizeVertical;
for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) { for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) {
AnimatedBoard pattern = []; AnimatedBoard pattern = [];
for (int row = 0; row < activity.boardSizeVertical; row++) { for (int row = 0; row < activity.board.boardSizeVertical; row++) {
List<bool> patternRow = []; List<bool> patternRow = [];
for (int col = 0; col < activity.boardSizeHorizontal; col++) { for (int col = 0; col < activity.board.boardSizeHorizontal; col++) {
patternRow.add(row > (patternIndex - 4)); patternRow.add(row > (patternIndex - 4));
} }
pattern.add(patternRow); pattern.add(patternRow);
...@@ -51,14 +51,14 @@ class BoardAnimate { ...@@ -51,14 +51,14 @@ class BoardAnimate {
static AnimatedBoardSequence createDefaultAnimationPatterns(Activity activity) { static AnimatedBoardSequence createDefaultAnimationPatterns(Activity activity) {
AnimatedBoardSequence patterns = []; AnimatedBoardSequence patterns = [];
int boardSideLength = activity.boardSizeHorizontal; int boardSideLength = activity.board.boardSizeHorizontal;
int patternsCount = boardSideLength; int patternsCount = boardSideLength;
for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) { for (int patternIndex = 0; patternIndex < patternsCount; patternIndex++) {
AnimatedBoard pattern = []; AnimatedBoard pattern = [];
for (int row = 0; row < activity.boardSizeVertical; row++) { for (int row = 0; row < activity.board.boardSizeVertical; row++) {
List<bool> patternRow = []; List<bool> patternRow = [];
for (int col = 0; col < activity.boardSizeHorizontal; col++) { for (int col = 0; col < activity.board.boardSizeHorizontal; col++) {
patternRow.add(((patternIndex + row + col) % 4 == 0)); patternRow.add(((patternIndex + row + col) % 4 == 0));
} }
pattern.add(patternRow); pattern.add(patternRow);
......
...@@ -3,7 +3,7 @@ description: A suguru game application. ...@@ -3,7 +3,7 @@ description: A suguru game application.
publish_to: "none" publish_to: "none"
version: 0.0.5+5 version: 0.0.6+6
environment: environment:
sdk: "^3.0.0" sdk: "^3.0.0"
......