Skip to content

Commit 1507670

Browse files
committed
If timing is the same, take the one with fewer button presses.
1 parent f475224 commit 1507670

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

SerialPrograms/Source/NintendoSwitch/Programs/FastCodeEntry/NintendoSwitch_KeyboardCodeEntry.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ std::vector<CodeEntryActionWithDelay> keyboard_get_best_path(
243243
for (CodeEntryActionWithDelay& action : current_path){
244244
current_time += action.delay;
245245
}
246-
if (best_time > current_time){
246+
if (best_time > current_time ||
247+
(best_time == current_time && best_path.size() > current_path.size())
248+
){
247249
best_time = current_time;
248250
best_path = std::move(current_path);
249251
}

SerialPrograms/Source/NintendoSwitch/Programs/FastCodeEntry/NintendoSwitch_NumberCodeEntry.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ std::vector<CodeEntryActionWithDelay> numberpad_get_best_path(
162162
// action.delay =
163163
}
164164
}
165-
if (best_time > current_time){
165+
if (best_time > current_time ||
166+
(best_time == current_time && best_path.size() > current_path.size())
167+
){
166168
best_time = current_time;
167169
best_path = std::move(current_path);
168170
}

0 commit comments

Comments
 (0)