Create a puzzle
Instructions: Let’s create a puzzle. Below, you will find a problem statement for two different issues – relax, these are fun! I have presented to you a puzzle that you will code. You may use any and all coding concepts that you have learned so far. You may use more advanced coding concepts if and only if you know how to use them. Otherwise, all you need to use are the coding concepts learned this far. These applications should be coded in a Console Application. However, if you want the added challenge of coding in a Windows Form, that is up to you. The goal is for you to write an application that works – that is, for you meet the requirements of the problem statement.
Puzzle 1: Three people work at government facility. Each person knows the password to get into the building, and the password to get into their respective work area. No one can enter the building without using the password to get into the building. Additionally, no one can get into the building until “Rose”, the administrator, gets into the building. However, in order for “Bob” and “Susan” can get into their respective work areas, Rose must enter a second password that will allow her access to her work area. Bob and Susan cannot know the password that gains access to Rose’s work area. In fact, if they try to access Rose’s work area, an alarm (beep!) will sound 3 times and a prompt will indicate that they are not permitted to enter.
Now, only after Rose has gained access to her work area can Bob go to work. He must enter two passwords. If the first password works, then he will be prompted for a second password. If the first password does not work, he will not be allowed access to his work area. If the second password does not work, he will not be allowed into his work area. Only one attempt is given to enter either password. If incorrect data is entered and alarm will sound three times (Beep! Beep! Beep!), and a prompt will indicate that the person is not allowed to enter.
Only after Rose and Bob are at their respective work stations can Susan enter her work area. Susan must enter three different passwords at three different prompts. Again, if a password fails, she is locked out of her work station, an alarm will sound (3x) and a prompt will tell her that she is not allowed to enter.
Use the following to help you:
- The universal password to get into the building is ‘password’.
- Use Rose, Bob, and Susan as the login names for each person.
- Create unique passwords for each person.
- Remember the following. In addition to knowing the universal password, each person must know the following:
- Rose must know the password to get into her work area.
- Bob must know 2 passwords to get into his work area.
- Susan must know 3 passwords to get into her work area.
- If Rose enters invalid data into the system, the program stops! No one gets to go to work.
- If Bob enters invalid data into the system, the program stops. Bob and Susan cannot go to work.
- If Susan enters invalid data into the system, the program stops and she cannot go to work.
Puzzle 2: Santa’s reindeer are playing tricks on him. They are hiding in a small group of trees. There are six (6) trees, and the following four reindeer are hiding:
- Dasher,
- Dancer,
- Prancer,
- Vixen
Your job is to hide one and only one reindeer behind any of the six tress. Once the reindeer find their hiding spots, Santa will need to look for them. Santa has one and only one opportunity to find all of his reindeer. That means, every time he makes a wrong guess, the application will stop and he has to start all over again – even if he has only 1 reindeer to go!
Please note that in this puzzle, two trees will not have a reindeer behind them. So, if Santa guesses a tree (1, 2, 3, 4, 5, 6), and there is no reindeer behind it, then the program stops.
This puzzle may seem easy at first, but remember, Santa has to make every guess correctly or the program stops.
For added challenge, create a loop that gives Santa 2 guesses for each reindeer.
Use the following to help you:
- Use the reindeer names as mentioned above.
- You may need to use nested if statements – read about this if you need to.