Skip to content

ComprosoftCEO/MothersDay2020

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mother's Day 2020 Card

Cracking the Secret Codes


About

Every year, I like to program cards for my family for special events, including:

  • Birthdays
  • Father's Day
  • Mother's Day
  • etc.

I don't normally post the cards I program, but I was really proud of Mom's code breaking challenge this year, so I wanted to go ahead and post the source code. I hope that you can also enjoy playing it! I've removed any personal family references from the code.


Compiling the Code

To compile the code, you need to have the GNU Readline Library installed on your system.

Ubuntu:

sudo apt install libreadline-dev

Fedora:

sudo yum install readline-devel

Windows:

There is also a Windows version, but it is a bit trickier to install and configure the shared library and header files.


You will also need a C++11 compiler and GNU Make. To compile the code, simply run:

make

To rebuild the code, type:

make clean
make

This will produce MothersDay2020.out for the executable.


Running the Code

./MothersDay2020.out <WordsFile>

The game requires a text file of English words to use with the code algorithms. The program loads all words that are at least 10 letters long and only contain lowercase letters (so no capital letters, dashes, commas, apostrophies, etc.). The text file I used is words.txt from the GitHub repository english-words. However, you can use other dictionaries as well.


Game Commands

All Commands:

  • help = Help screen
  • word = Reshow the scrambled word
  • hint = Ask a hint for the problem
  • new = Pick a new word and reset the problem
  • quit = Exit the program
  • <solution> = Solve the problem

Undocumented Commands:

  • cheat = Used for debugging to show the solution

All Level Solutions

Level 1 First letter and last letter swapped
Level 2 Word Reversed
Level 3 Shifted right 1 letter
Level 4 Every letter becomes next letter (a->b, b->c, etc.)
Level 5 Shifted left 1 letter and reversed
Level 6 Vowels converted to symbols
Level 7 First half and second half swapped
Level 8 Interweaved letters, indicated by capital letters
Level 9 Every letter increased by a random amount (a->a+n)
Level 10 Random letter subsitution

Code Linters

The source code uses ClangFormat and Clang-Tidy to format the code and maintain a consistant style. You can either run these programs manually or install a plugin into your favorite code editor.