[Odin] Looping all the way deep[Odin] Looping all the way deep
🪙
Crypto Wallet Password
Week 28, 2026
package main
import "core:fmt"
import "core:os"
import "core:strings"
SEED_WORDS_TXT := #load("bip39-seed-words.txt", string)
RESULT_FILENAME :: "result.txt"
TARGET_LEN :: 12
TARGET_WORD :: "zoo"
main :: proc () {
words := strings.split_lines(SEED_WORDS_TXT)
defer delete(words)
fmt.printfln("There are %d words", len(words))
fmt.printfln("Target length is %d", TARGET_LEN)
fmt.printfln("Target word is `%s`", TARGET_WORD)
f, err := os.open(RESULT_FILENAME, { .Write })
defer os.close(f)
assert(err == nil)
total_trios_of_target_len: int
for w1 in words {
trio_len := len(w1)
trio_has_target_word := w1 == TARGET_WORD
if trio_len < TARGET_LEN do for w2 in words {
trio_len += len(w2)
trio_has_target_word ||= w2 == TARGET_WORD
if trio_len < TARGET_LEN do for w3 in words {
trio_len += len(w3)
trio_has_target_word ||= w3 == TARGET_WORD
if trio_len == TARGET_LEN {
total_trios_of_target_len += 1
if trio_has_target_word do fmt.fprintln(f, w1, w2, w3, sep="")
}
trio_has_target_word = w1 == TARGET_WORD || w2 == TARGET_WORD
trio_len -= len(w3)
}
trio_has_target_word = w1 == TARGET_WORD
trio_len -= len(w2)
}
}
fmt.printfln("There are %d trios of the target length", total_trios_of_target_len)
}