This was a group project with Sam Breece and Miggie Garcia for our final Java Project in the Java portion of our SDE cohort with TLG Learning.
This game is a play on the paper game Bulls and Cows. In this rendition of the game, the player is a master of disguise who can tactically acquire any jewel desired. The player will have 15 tries to crack the 5 character cipher. If they complete the challenge within the specified tries, they will win and evade the authorities once again. If not though, they will be captured and lose all their jewels. At the end of the game, the player can choose to continue their life of crime by playing again, or turn over a new leaf and exit the game.
Prior to this project, I had no idea what Bulls and Cows was, so I understand if you're confused. Here's the link I used to get an
understanding of the game -> Bulls and Cows
I also had no idea there was another version of this game in a board game variety until my teammates got me hip.
You can read about that here -> Mastermind
When I read up on both those games I'm like, sooo basically it's Wordle
with more chances? 🤔
Eh, yes and no.
- Yes. You are trying to guess a "code".
- Yes. You do have a certain amount of tries to guess the "code".
- Yes. The "code" is a certain amount of characters long.
However, the main difference between these games and Wordle is, Wordle will tell the player if the player has a correct character
in the correct position and/or a correct character in the wrong position. Crack the Code and the two games it is based off will not.
This makes the game fundamentally more challenging, but the same amount of fun!
Alright, alright. Enough about the background, let's get into this game and why I'm writing all of this shall we?
As stated above, our game is based around a person with a particular set of skills allowing them to tactically acquire precious
jewels. (We don't use the "C" word around here. (* whispers * It's criminals, in case you didn't catch on. LoL))
Their task is to Crack the Code 😏 within the 15 guesses to evade the authorities and escape with the rarest
jewels known to man. If they fail, they are captured, and they lose all their jewels and their freedom. Characters in the
cipher can repeat. ie: cipher = 34539
Crack the Code has 3 different levels the player can choose from.
- Level 1 ciphers are made up of numerical digits (0-9).
- Level 2 ciphers are made up of US alphabet letters (A-Z).
- Level 3 ciphers are made up of a combination of both digits and letters.
Please believe me when I tell you I've played this game SEVERAL times, and all three levels CAN be solved within 15 tries. Did
I solve each level within the 15 tries? Absolutely!
...NOT! LoL At first I was convinced the game was cheating, but then we
found out there was debugging that had to happen; so not cheating, but not working in the way we wanted either. So after that
was cleared up, did I solve each level with in the 15 tries? Absolutely!
For real this time, except that only happened
once. The next "few" (it was more than a few) times I played, I lost. Like every game no matter the level. (So obviously the
game was actually cheating this time LoL.) Eventually, I got a better strategy and my win rate went up, which bee tee dubs,
the game will calculate for you. 🤗 So anyway, I said all this to say we did a pretty good job on this game for it to be all
of our first time coding in Java, and I hope you enjoy reviewing the code and even playing the game. 😄
Naturally, as soon as the project was due, I thought of another feature to add to the game. It's a very simple feature that
should have probably been an obvious addition during our planning, but for what ever reason we never really thought about it.
It's an exit feature. At no point in the game could a player decided they wanted to stop playing unless they won or lost. Which I REALLY should have thought of as many
times as I lost. 🙃
Anywho, in this forked version of code, I added the option for the player to exit the game any
time user input was accepted just by typing '#'. This was beyond the scope of my knowledge, though. I knew (somewhat) where I needed
to add the code, but not exactly what code to add and how. Luckily, the internet exists. After extensive (seriously, it took awhile) research,
I figured out what I needed to make this happen. I implemented it and BOOM! The player can now exit the game whenever they want. I also added in code that would print the current cipher along with the goodbye message, should the player choose to exit afer choosing a difficulty level.
Thank you for taking the time to read all of this, review the code, and/or play the game. If you decide to play the game,
I hope you enjoy it! I'd tell you to report back about it, but I'm not sure how that works on here, yet. But, if you do
find a way to report back, be kind. We are still learning, so I'm sure there are different, more efficient directions we
could have gone to write this code. As I learn more, I will (try to) update this version, as I'm sure my teammates will do on their
versions that they may update and change.