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

Improve pick new color

parent 09f1f0f2
No related branches found
No related tags found
1 merge request!13Resolve "Improve "pick new color""
Pipeline #4907 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.10 app.versionName=0.0.11
app.versionCode=10 app.versionCode=11
Improve pick new color.
Amélioration de la sélection de couleur.
...@@ -184,23 +184,25 @@ class Game { ...@@ -184,23 +184,25 @@ class Game {
// build a list of values to pick one // build a list of values to pick one
final List<int> values = []; final List<int> values = [];
// All eligible values // All eligible values (twice)
final int maxValue = this.settings.colorsCount; final int maxValue = this.settings.colorsCount;
for (int i = 1; i <= maxValue; i++) { for (int i = 1; i <= maxValue; i++) {
values.add(i); values.add(i);
values.add(i);
} }
// Add values of current col // Add values of current col (twice)
for (int r = 0; r <= this.settings.boardSize; r++) { for (int r = 0; r <= this.settings.boardSize; r++) {
if (this.isInBoard(CellLocation.go(r, col))) { if (this.isInBoard(CellLocation.go(r, col))) {
final int? value = this.getCellValue(CellLocation.go(r, col)); final int? value = this.getCellValue(CellLocation.go(r, col));
if (value != null) { if (value != null) {
values.add(value); values.add(value);
values.add(value);
} }
} }
} }
// Add values of sibling cols // Add values of sibling cols (twice for top rows)
for (int deltaCol = -1; deltaCol <= 1; deltaCol++) { for (int deltaCol = -1; deltaCol <= 1; deltaCol++) {
final int c = col + deltaCol; final int c = col + deltaCol;
for (int r = 0; r < this.settings.boardSize; r++) { for (int r = 0; r < this.settings.boardSize; r++) {
...@@ -208,6 +210,9 @@ class Game { ...@@ -208,6 +210,9 @@ class Game {
final int? value = this.getCellValue(CellLocation.go(r, c)); final int? value = this.getCellValue(CellLocation.go(r, c));
if (value != null) { if (value != null) {
values.add(value); values.add(value);
if (row < this.settings.boardSize / 3) {
values.add(value);
}
} }
} }
} }
......
...@@ -3,7 +3,7 @@ description: Jeweled Game ...@@ -3,7 +3,7 @@ description: Jeweled Game
publish_to: 'none' publish_to: 'none'
version: 0.0.10+10 version: 0.0.11+11
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment