Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

468 show captured pieces instead of material imbalance #1142

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

Jimima
Copy link
Contributor

@Jimima Jimima commented Nov 8, 2024

Had a go at this, draft at this stage as there is a bit to do but wanted feedback on the overall idea, if possible

Relates #468

@veloce
Copy link
Contributor

veloce commented Nov 11, 2024

UI looks fine!

@Jimima
Copy link
Contributor Author

Jimima commented Nov 11, 2024

I added a secondary option to the settings for this. I wonder if this is the best approach, it was simple to add it this way but maybe a single choice with 3 options would be better

Was also a bit unclear on why the theme preference implementation did something custom for the choice picker on ios, this seems to work but can take the other approach if there is a reason to do so

@ijm8710
Copy link

ijm8710 commented Nov 11, 2024

I think it makes more sense to have one setting with 3 options. Rather than 2 separate toggle due to the fact that the settings screen keeps getting more options and to limit it best we can.

Obv Veloce/toms opinion will carry more weight but I think it's best to keep that contained best they can

@Jimima
Copy link
Contributor Author

Jimima commented Nov 12, 2024

Alternate option

@Jimima
Copy link
Contributor Author

Jimima commented Nov 14, 2024

In-game option

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-11-14.at.08.55.42.mp4

@Jimima Jimima marked this pull request as ready for review November 14, 2024 09:14
@Jimima
Copy link
Contributor Author

Jimima commented Nov 14, 2024

Would appreciate a review @veloce @tom-anders

@veloce
Copy link
Contributor

veloce commented Nov 14, 2024

It is better with a single setting yes. Thanks!

lib/src/model/game/material_diff.dart Show resolved Hide resolved
lib/src/model/game/material_diff.dart Outdated Show resolved Hide resolved
Board.standard.materialCount(Side.black);
final IMap<Role, int> whiteStartingCount =
Board.standard.materialCount(Side.white);
// TODO: parameterise starting position maybe so it can be passed in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think this is needed before merging - It's already possible to view (but not play) variants that have a different starting position (e.h. Horde). With this PR, capturedPieces will display incorrect values currently.

However, I noticed that the web UI does not display material difference at all for Horde, maybe we should do the same? @veloce wdyt?

lib/src/model/settings/board_preferences.dart Show resolved Hide resolved
lib/src/model/settings/board_preferences.dart Outdated Show resolved Hide resolved
lib/src/model/settings/board_preferences.dart Show resolved Hide resolved
@@ -110,7 +119,9 @@ class BoardPrefs with _$BoardPrefs implements Serializable {
required bool boardHighlights,
required bool coordinates,
required bool pieceAnimation,
required bool showMaterialDifference,
// required bool showMaterialDifference,
required MaterialDifference materialDifference,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling this MaterialDifferenceFormat (like in the commented line below) would be more readable I think. Currently, there's both MaterialDiff and MaterialDifference which is confusing

lib/src/view/game/game_player.dart Outdated Show resolved Hide resolved
@Jimima
Copy link
Contributor Author

Jimima commented Nov 15, 2024

@tom-anders I pushed up a bunch of changes, would appreciate you taking another look when you have the time 🙂

: '',
),
],
else if (materialDiff != null &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if both these conditions should be moved into the new MaterialDifferenceDisplay's build() method as well (returning SizedBox.shrink() if either of them is false) . This way we'd have all the logic in one place. (it would also make the ternary in lib/src/view/game/game_body.dart l. 131 redundant)

@tom-anders
Copy link
Contributor

very nice, no more comments from me :)

@Jimima
Copy link
Contributor Author

Jimima commented Nov 15, 2024

Oh should have said, I still don't really know the best label to use for the setting. I just changed it to simply "Material" just now but I've changed it a few times and still can't decide what is best. Happy to be told here!

@Jimima
Copy link
Contributor Author

Jimima commented Nov 15, 2024

very nice, no more comments from me :)

Thanks, will take a look at the l10n stuff tomorrow

@Jimima Jimima force-pushed the 468-show-captured-pieces-instead-of-material-imbalance branch from edd44f6 to a4716f7 Compare November 20, 2024 16:44
@Jimima Jimima changed the base branch from main to analysis_tabs November 20, 2024 17:23
@Jimima Jimima changed the base branch from analysis_tabs to main November 20, 2024 17:23
@Jimima
Copy link
Contributor Author

Jimima commented Nov 21, 2024

@veloce @tom-anders I think I've gone as far as I can with this. Would appreciate any further feedback you have for me 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants