diff --git a/android/gradle.properties b/android/gradle.properties index aa51064abebb79ba519e600afb7af23779154d4e..135006f9c1386c8757595c43e890e911f732f5a3 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.5 -app.versionCode=5 +app.versionName=0.0.6 +app.versionCode=6 diff --git a/lib/layout/game.dart b/lib/layout/game.dart index 0c70fe6004a06f4cca65f2dc77ec5a8240718bba..558cde459b9ca233beabfdff4c0fd632bf9e34b1 100644 --- a/lib/layout/game.dart +++ b/lib/layout/game.dart @@ -55,6 +55,14 @@ class Game { color: Colors.black, ), ), + Text( + '(max: ' + myProvider.maxMovesCount.toString() + ')', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w600, + color: Colors.grey, + ), + ), ] ), Column( diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 3ecfa090a9224f0b52988474494944281941a494..6b31d5e78b9b81ed15724821837a16fa42c59a83 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -22,6 +22,7 @@ class Data extends ChangeNotifier { int _boardSize = 0; int _colorsCount = 0; int _movesCount = 0; + int _maxMovesCount = 0; List _cells = []; int _progress = 0; @@ -140,6 +141,11 @@ class Data extends ChangeNotifier { updateMovesCount(movesCount + 1); } + int get maxMovesCount => _maxMovesCount; + void updateMaxMovesCount(int maxMovesCount) { + _maxMovesCount = maxMovesCount; + } + int get progress => _progress; int get progressTotal => _progressTotal; int get progressDelta => _progressDelta; @@ -176,6 +182,7 @@ class Data extends ChangeNotifier { _gameIsRunning = false; _gameWon = false; _movesCount = 0; + _maxMovesCount = 0; _progress = 0; notifyListeners(); } diff --git a/lib/utils/board_utils.dart b/lib/utils/board_utils.dart index 405685c01ae50e0ffba4152e1958d1951fbc8b07..5127b151c81c215dc479ac1c434f8dade3a9233c 100644 --- a/lib/utils/board_utils.dart +++ b/lib/utils/board_utils.dart @@ -39,11 +39,19 @@ class BoardUtils { myProvider.resetGame(); myProvider.updateCells(grid); + myProvider.updateMaxMovesCount(computeMaxMovesCountLimit(myProvider)); int initProgress = BoardUtils.getSiblingFillableCells(myProvider, 0, 0, [[0, 0]]).length; myProvider.updateProgress(initProgress); } + static int computeMaxMovesCountLimit(myProvider) { + int boardSize = myProvider.boardSize; + int colorsCount = myProvider.colorsCount; + + return (30 * (boardSize * colorsCount) / (17 * 6)).round(); + } + static fillBoardFromFirstCell(Data myProvider, int value) { List cellsToFill = BoardUtils.getSiblingFillableCells(myProvider, 0, 0, [[0, 0]]); int progressBeforeMove = cellsToFill.length;