Skip to content

Commit

Permalink
day(21): Added observations note
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrodger committed Dec 21, 2024
1 parent e04b4b1 commit 0348182
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/AdventOfCode/Day21.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ private static long Presses(string sequence, int depth, int maxDepth, Dictionary
/// | 0 | A |
/// +---+---+
/// </summary>
/// <remarks>
/// Observed that to be most efficient, you must:
///
/// - move left before up
/// - move up before right
/// - move right before down (except 2 -> A which is the opposite for some reason)
/// - move down before left
///
/// You must always take the maximum number of steps in a direction, never zigzagging
///
/// Sometimes it's not possible to follow those rules, because you'd have to pass through the disallowed
/// bottom left square, so then we flip the order of horizontal and vertical moves, e.g. A -> 1
///
/// I'm leaving all the possibilities in because it's too hard to prove/debug the above. It could be the case
/// that my input and the sample inputs just don't exercise some of these, and those may be exceptions like
/// the 2 -> A exception that my real input definitely needs.
/// </remarks>
private static string[] NumpadSequences(char start, char end) => (start, end) switch
{
('A', 'A') => [""],
Expand Down

0 comments on commit 0348182

Please sign in to comment.