PATCH Solution

FOLD COUNT

PATCH off-by-one loop bound

In-game screenshot of FOLD COUNT
In-game view
FamilyPATCH Graph0.494 DifficultyHard Ring03 IDzp41_offbyone

Prerequisites

Spin Lock

Unlocks

CROSSBAR

Patch choices bound=5
Accepted keysSUM42 Editable slots1 Rulenonzero

Walkthrough

The fold walks the key and rotates after each byte, but the loop quits one step early, so the last byte never folds in and the total comes out wrong. Only the marked loop bound can move. Because the rotate makes the fold count-sensitive, stopping short or running long both miss. Set the bound to fold every real byte, then TEST.

Read what the loop compares the index against before it exits. The key is five bytes and the expected total already assumes all five were folded, so a bound that stops at four leaves the final byte out and rotates one time too few.

Valid Patch Combos

  • bound=5

Reject Battery

  • SUM43
  • TUM42
  • RUM42
  • SUM4
  • SUM422

Editable Slot Options

  • bound: 4, 5, 6
Broken Listing
; FOLD COUNT: a PATCH job. A rolling fold walks the key byte by byte, adding each
; byte into the accumulator and rotating after every step, then checks the folded
; total. The loop quits one step early, so the last byte never reaches the fold
; and the rotate count is off too. Only the marked loop bound (label "bound") is
; yours to edit; the accumulator, the rotate, the expected total, and the verdict
; are all frozen.
;
; The real key is SUM42 (length 5). The fold is order- and count-sensitive
; because of the rotate, so reaching one byte short OR one byte long both miss the
; frozen total 0x57. Set the bound so the loop folds exactly the five real bytes.
;
; r0 = 1 on accept; rule: nonzero. SHIPPED bound is "cmp r7, 4": the loop stops
; before the final byte, the fold lands on the wrong total, and the key is bounced.

        len   r2
        cmp   r2, 5
        jnz   bad

        mov   r3, 0         ; accumulator
        mov   r7, 0         ; index
loop:
bound:  cmp   r7, 4         ; SHIPPED BROKEN: stops one byte short -> want 5
        jge   done
        ldb   r0, [r7]
        add   r3, r0
        rol   r3, 1
        inc   r7
        jmp   loop

done:   cmp   r3, 0x57      ; folded total of all five bytes
        jnz   bad
        mov   r0, 1
        ret
bad:    mov   r0, 0
        ret