DEV Community

Ersin Buckley
Ersin Buckley

Posted on • Originally published at ersin.nz

Code Cracker challenge

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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!

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay