Question
The golems of the City of Ankh Morpork are rising up! Led by a human named Adora, they have finally had enough long hours and
The golems of the City of Ankh Morpork are rising up! Led by a human named Adora, they have finally had enough long hours and no pay. The city's police force, the City Watch, is going to try to intervene. The bad news is that that the golems are nearly invincible. The good news is that the golems are controlled by small spells that are put inside their heads. If the Watch can determine the right combination then they will be able to return the golems to a docile state.
The control spells are made up of a sequence of 4 elements selected from the following: Fire, Water, Air, and Earth. Duplicates are allowed. The City Watch will have to try a series of spells in hopes of disabling the golems. Fortunately, the golems have eyes that will glow in a way that will give the Watch some clues. Their eyes will glow RED for each element that is in the correct location. Their eyes will glow BLUE for each element that is correctly included, but in the wrong location.
For example, if the secret code is FFAW (Fire, Fire, Air, Water) and the Watch guesses FEWA, then the eyes will glow RBB. If they were to then guess FAFW, then the eyes will glow RRBB.The Watch will get 10 guesses only....
Components:
- Randomly generated secret spell code ( look up rand() )
- Robust interface to enter the guesses. Only valid guesses will count, be accommodating in terms of case.
- Limit the number of guesses
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started