Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
Change-Id: I2a49f2ab9e1adebe2a283770c5f10cee287a5717
  • Loading branch information
calcitem committed Dec 24, 2023
1 parent 8014d05 commit 769db9b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/perfect/perfect_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ Wrappers::gui_eval_elem2 PerfectPlayer::moveValue(const GameState &s,

template <typename T, typename K>
std::vector<T> PerfectPlayer::allMaxBy(std::function<K(T)> f,
const std::vector<T> &l, K minValue, Value &value)
const std::vector<T> &l, K minValue,
Value &value)
{
std::vector<T> r;

Expand Down Expand Up @@ -401,7 +402,8 @@ std::vector<T> PerfectPlayer::allMaxBy(std::function<K(T)> f,

#if 1
// Assuming the definition of gui_eval_elem2::min_value function
std::vector<AdvancedMove> PerfectPlayer::goodMoves(const GameState &s, Value &value)
std::vector<AdvancedMove> PerfectPlayer::goodMoves(const GameState &s,
Value &value)
{
return allMaxBy(std::function<Wrappers::gui_eval_elem2(AdvancedMove)>(
[this, &s](AdvancedMove m) { return moveValue(s, m); }),
Expand All @@ -413,15 +415,13 @@ std::vector<AdvancedMove> PerfectPlayer::goodMoves(const GameState &s,
Value &value)
{
auto moveList = getMoveList(s);
std::cout << "Move list size: " << moveList.size()
<< std::endl;
std::cout << "Move list size: " << moveList.size() << std::endl;
std::function<Wrappers::gui_eval_elem2(AdvancedMove)> evalFunction =
[this, &s](AdvancedMove m) {
auto value = moveValue(s, m);
std::cout << "Evaluating move from " << m.from << " to " << m.to
<< " with score: " << value.toString()
<< std::endl;
<< " with score: " << value.toString() << std::endl;
return value;
};
Expand Down
4 changes: 2 additions & 2 deletions src/perfect/perfect_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int perfect_test(int argc, char *argv[])
// int res = MalomSolutionAccess::getBestMove(0, 0, 9, 9, 0, false);
int res = MalomSolutionAccess::getBestMove(1, 2, 8, 8, 0, false,
value); // Correct
// output:
// 16384
// output:
// 16384
// int res = MalomSolutionAccess::getBestMove(1 + 2 + 4, 8 + 16 + 32, 100,
// 0, 0, false, value); // tests exception
// int res = MalomSolutionAccess::getBestMove(1 + 2 + 4, 1 + 8 + 16 + 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class LoadService {
if (Platform.isAndroid) {
final Directory appDocDir = await getApplicationDocumentsDirectory();
final String appDocPath = appDocDir.path;
final List<FileSystemEntity> entities = appDocDir.listSync(
recursive: true);
final List<FileSystemEntity> entities =
appDocDir.listSync(recursive: true);

for (final FileSystemEntity entity in entities) {
if (entity is File && entity.path.endsWith('.pgn')) {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/flutter_app/lib/game_page/widgets/game_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class _GameHeaderState extends State<GameHeader> {
int value =
GameController().value == null ? 0 : int.parse(GameController().value!);

final bool perfect = abs(value) == valueDrawPerfect ||
abs(value) == valueMatePerfect;
final double opacity = perfect? 0.5 : 1;
final bool perfect =
abs(value) == valueDrawPerfect || abs(value) == valueMatePerfect;
final double opacity = perfect ? 0.5 : 1;

if (DB().displaySettings.isPositionalAdvantageIndicatorShown) {
const int valueLimit = 100;
Expand Down

0 comments on commit 769db9b

Please sign in to comment.