Skip to content
Snippets Groups Projects
Commit 0fe6c59f authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Disable and do not count move if no change in board

parent 1371d1dd
No related branches found
No related tags found
1 merge request!16Resolve "Do not count move if no change in board"
Pipeline #2808 passed
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.15 app.versionName=0.0.16
app.versionCode=15 app.versionCode=16
...@@ -39,7 +39,7 @@ class Cell { ...@@ -39,7 +39,7 @@ class Cell {
fit: BoxFit.fill fit: BoxFit.fill
), ),
onTap: () { onTap: () {
if (!myProvider.animationInProgress) { if (!myProvider.animationInProgress && myProvider.getFirstCellValue() != this.value) {
BoardUtils.fillBoardFromFirstCell(myProvider, this.value); BoardUtils.fillBoardFromFirstCell(myProvider, this.value);
} }
}, },
......
...@@ -179,6 +179,10 @@ class Data extends ChangeNotifier { ...@@ -179,6 +179,10 @@ class Data extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
int getFirstCellValue() {
return _cells[0][0].value;
}
int get movesCount => _movesCount; int get movesCount => _movesCount;
void updateMovesCount(int movesCount) { void updateMovesCount(int movesCount) {
_movesCount = movesCount; _movesCount = movesCount;
......
...@@ -81,7 +81,10 @@ class BoardUtils { ...@@ -81,7 +81,10 @@ class BoardUtils {
myProvider.updateProgressDelta(progressDelta); myProvider.updateProgressDelta(progressDelta);
myProvider.updateProgress(progressAfterMove); myProvider.updateProgress(progressAfterMove);
if (progressDelta != 0) {
myProvider.incrementMovesCount(); myProvider.incrementMovesCount();
}
myProvider.updateAnimationInProgress(false); myProvider.updateAnimationInProgress(false);
if (BoardUtils.checkBoardIsSolved(myProvider)) { if (BoardUtils.checkBoardIsSolved(myProvider)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment