Skip to content

Commit

Permalink
Task 1: UNTIL: loop
Browse files Browse the repository at this point in the history
  • Loading branch information
akifoq committed Aug 18, 2023
1 parent 70f4489 commit 9d057cf
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions contracts/1.fc
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,27 @@
}

cell solution(int hash, cell cur) asm """
// hash cur
SWAP 1 SETGLOB PUSHNULL
<{ AGAINBRK:
// ... cur
DROP DUP HASHCU 1 GETGLOB EQUAL IFRETALT
CTOS // ... cs
DUP SREFS
REPEAT: LDREF
}>CONT
<{ 2DROP
<b b> PUSHREF
}>CONT
TRY
1 PUSHINT ONLYTOPX
// hash cur
SWAP // cur hash

OVER HASHCU OVER EQUAL
IFJMP:<{ DROP }>

// cur hash
1 SETGLOB
<{ UNTIL:
// ... cur
CTOS // ... cs
DUP SREFS
REPEAT:<{ LDREF }>
// ... cs
DROP DUP HASHCU 1 GETGLOB EQUAL
}>CONT
<{ 2DROP
<b b> PUSHREF
}>CONT
TRY
1 PUSHINT ONLYTOPX
""";

;; testable
Expand Down

0 comments on commit 9d057cf

Please sign in to comment.