Quick kata: code cracker

2 Nov 2023

This code cracker challenge is a great exercise to flex your programming muscles, especially in something new (like I did with rust). Let's break it down:

Challenge 1: Finding Possible Words Create a function that takes input text and outputs the substitution alphabet and each clue. For example:

example input

14 R
1 7 7 14 7 21
14 7 3 7 14 1 7

example output

Alphabet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
_ _ _ _ _ _ _ _ _  _  _  _  _  R  _  _  _  _  _  _  _  _  _  _  _  _

Clue 1:
1 7 7 R 7 21

Now, search through a dictionary (e.g., /usr/dict/words) to find words matching the clue's length.

Challenge 2: Optimizing Options Print out all possible words that match the pattern. For 1 7 7 R 7 21, the output would be:

1 7 7 R 7 21

0: DEERES
1: JEERED
2: LEERED
3: PEERED
4: VEERED

Challenge 3: Play the Game Allow the player to fill in new letters in the substitution alphabet to play the next word. This could be a handy hint buddy for cracker enthusiasts.

Challenge 4: Solving a Full Game Create the ability to input an entire game, letting the program figure out a solution.

This challenge is not only a great exercise but also a fantastic way to learn a new programming language. Happy coding!

Looking for some more samples, check out the original authors work! codecracker.co.nz

As for my own solution? I'll post it soon, promise!

Subscribe to my Newsletter

Want to know more? Put your email in the box for updates on my blog posts and projects. Emails sent a maximum of twice a month.