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 (4)
.cxx
Fix compute/display conflicts.
Upgrade framework and dependencies.
Correction sur calcul/affichage des conflits.
Mise à jour du framework et des dépendances.
...@@ -93,6 +93,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> { ...@@ -93,6 +93,8 @@ class ActivityCubit extends HydratedCubit<ActivityState> {
refresh(); refresh();
} }
state.currentActivity.updateConflictsInBoard();
if (state.currentActivity.checkBoardIsSolved()) { if (state.currentActivity.checkBoardIsSolved()) {
BoardAnimate.startAnimation(this, 'win'); BoardAnimate.startAnimation(this, 'win');
state.currentActivity.isFinished = true; state.currentActivity.isFinished = true;
......
...@@ -137,37 +137,20 @@ class Activity { ...@@ -137,37 +137,20 @@ class Activity {
return false; return false;
} }
ConflictsCount computeConflictsInBoard() { void updateConflictsInBoard() {
final BoardCells cells = board.cells; final BoardCells cells = board.cells;
final ConflictsCount conflicts = boardConflicts;
// reset conflict states // reset conflict states
for (int row = 0; row < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { boardConflicts[location.row][location.col] = 0;
conflicts[row][col] = 0;
}
} }
// check siblings // check siblings
for (int row = 0; row < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { final int value = board.get(location).value;
final int value = cells[row][col].value; if (value != 0) {
if (value != 0) { if (board.cellHasSiblingWithSameValue(location)) {
for (int deltaRow = -1; deltaRow <= 1; deltaRow++) { boardConflicts[location.row][location.col]++;
for (int deltaCol = -1; deltaCol <= 1; deltaCol++) {
if (row + deltaRow >= 0 &&
row + deltaRow < board.boardSizeHorizontal &&
col + deltaCol >= 0 &&
col + deltaCol < board.boardSizeVertical &&
(deltaRow * deltaCol != 0)) {
final int siblingValue = cells[row + deltaRow][col + deltaCol].value;
if (siblingValue == value) {
conflicts[row][col]++;
}
}
}
}
} }
} }
} }
...@@ -176,33 +159,27 @@ class Activity { ...@@ -176,33 +159,27 @@ 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 < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { if (board.get(location).blockId == blockId) {
if (cells[row][col].blockId == blockId) { final int value = board.get(location).value;
final int value = cells[row][col].value; if (value != 0) {
if (value != 0) { if (!values.contains(value)) {
if (!values.contains(value)) { values.add(value);
values.add(value); } else {
} else { duplicateValues.add(value);
duplicateValues.add(value);
}
} }
} }
} }
} }
for (int duplicateValue in duplicateValues) { for (int duplicateValue in duplicateValues) {
for (int row = 0; row < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { if (board.get(location).blockId == blockId &&
if (cells[row][col].blockId == blockId && board.get(location).value == duplicateValue) {
cells[row][col].value == duplicateValue) { boardConflicts[location.row][location.col]++;
conflicts[row][col]++;
}
} }
} }
} }
} }
return conflicts;
} }
void showTip(ActivityCubit activityCubit) { void showTip(ActivityCubit activityCubit) {
...@@ -277,12 +254,11 @@ class Activity { ...@@ -277,12 +254,11 @@ class Activity {
List<CellLocation> cellsWithWrongValue = []; List<CellLocation> cellsWithWrongValue = [];
for (int row = 0; row < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { if (cells[location.row][location.col].value != 0 &&
if (cells[row][col].value != 0 && cells[location.row][location.col].value !=
cells[row][col].value != cellsSolved[row][col].value) { cellsSolved[location.row][location.col].value) {
cellsWithWrongValue.add(CellLocation.go(row, col)); cellsWithWrongValue.add(location);
}
} }
} }
...@@ -292,11 +268,9 @@ class Activity { ...@@ -292,11 +268,9 @@ class Activity {
List<CellLocation> getCellsWithConflicts() { List<CellLocation> getCellsWithConflicts() {
List<CellLocation> cellsWithConflict = []; List<CellLocation> cellsWithConflict = [];
for (int row = 0; row < board.boardSizeVertical; row++) { for (CellLocation location in board.getCellLocations()) {
for (int col = 0; col < board.boardSizeHorizontal; col++) { if (boardConflicts[location.row][location.col] != 0) {
if (boardConflicts[row][col] != 0) { cellsWithConflict.add(location);
cellsWithConflict.add(CellLocation.go(row, col));
}
} }
} }
......
...@@ -13,10 +13,10 @@ packages: ...@@ -13,10 +13,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.12.0" version: "2.13.0"
badges: badges:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -37,26 +37,26 @@ packages: ...@@ -37,26 +37,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.4.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.2"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.0" version: "1.19.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
...@@ -69,10 +69,10 @@ packages: ...@@ -69,10 +69,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: easy_localization name: easy_localization
sha256: fa59bcdbbb911a764aa6acf96bbb6fa7a5cf8234354fc45ec1a43a0349ef0201 sha256: "0f5239c7b8ab06c66440cfb0e9aa4b4640429c6668d5a42fe389c5de42220b12"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.7" version: "3.0.7+1"
easy_logger: easy_logger:
dependency: transitive dependency: transitive
description: description:
...@@ -93,10 +93,10 @@ packages: ...@@ -93,10 +93,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
file: file:
dependency: transitive dependency: transitive
description: description:
...@@ -122,10 +122,10 @@ packages: ...@@ -122,10 +122,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_custom_toolbox name: flutter_custom_toolbox
sha256: "55eec6215c16e1a4325a2c515bd8464d598c8b67ae4403c47fd5f1df538e2336" sha256: "94a61d34540916bf2be9acc0fa7b959c38233a7c604ab9baf8313969fcd82317"
url: "https://pub.harrault.fr" url: "https://pub.harrault.fr"
source: hosted source: hosted
version: "1.0.2" version: "1.0.7"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
...@@ -156,10 +156,10 @@ packages: ...@@ -156,10 +156,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: http name: http
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.2" version: "1.3.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
...@@ -204,10 +204,10 @@ packages: ...@@ -204,10 +204,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
...@@ -220,26 +220,26 @@ packages: ...@@ -220,26 +220,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: package_info_plus name: package_info_plus
sha256: "70c421fe9d9cc1a9a7f3b05ae56befd469fe4f8daa3b484823141a55442d858d" sha256: "67eae327b1b0faf761964a1d2e5d323c797f3799db0e85aa232db8d9e922bc35"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.1.2" version: "8.2.1"
package_info_plus_platform_interface: package_info_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: package_info_plus_platform_interface name: package_info_plus_platform_interface
sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b sha256: "205ec83335c2ab9107bbba3f8997f9356d72ca3c715d2f038fc773d0366b4c76"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.1.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.0" version: "1.9.1"
path_provider: path_provider:
dependency: transitive dependency: transitive
description: description:
...@@ -316,18 +316,18 @@ packages: ...@@ -316,18 +316,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences name: shared_preferences
sha256: a752ce92ea7540fc35a0d19722816e04d0e72828a4200e83a98cf1a1eb524c9a sha256: "846849e3e9b68f3ef4b60c60cf4b3e02e9321bc7f4d8c4692cf87ffa82fc8a3a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.5" version: "2.5.2"
shared_preferences_android: shared_preferences_android:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_android name: shared_preferences_android
sha256: "02a7d8a9ef346c9af715811b01fbd8e27845ad2c41148eefd31321471b41863d" sha256: a768fc8ede5f0c8e6150476e14f38e2417c0864ca36bb4582be8e21925a03c22
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.0" version: "2.4.6"
shared_preferences_foundation: shared_preferences_foundation:
dependency: transitive dependency: transitive
description: description:
...@@ -356,10 +356,10 @@ packages: ...@@ -356,10 +356,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.2" version: "2.4.3"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
...@@ -393,10 +393,10 @@ packages: ...@@ -393,10 +393,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: synchronized name: synchronized
sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" sha256: "0669c70faae6270521ee4f05bffd2919892d42d1276e6c495be80174b6bc0ef6"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.3.0+3" version: "3.3.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
...@@ -441,10 +441,10 @@ packages: ...@@ -441,10 +441,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: "154360849a56b7b67331c21f09a386562d88903f90a1099c5987afc1912e1f29" sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.10.0" version: "5.10.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
...@@ -454,5 +454,5 @@ packages: ...@@ -454,5 +454,5 @@ packages:
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
sdks: sdks:
dart: ">=3.6.0 <4.0.0" dart: ">=3.7.0 <4.0.0"
flutter: ">=3.24.0" flutter: ">=3.24.0"
...@@ -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.7+7 version: 0.1.0+9
environment: environment:
sdk: "^3.0.0" sdk: "^3.0.0"
......