Based on the Cluedo BoardGame and the whodunnit starter from Stuart Lucas@CAS. Using the data provided write a program that randomly picks a location, weapon and person to generate a murder scene.
- People: Professor Plum, Reverend Green, Miss Scarlet, Mrs Peacock, Mr Black.
- Weapons: Knife, Gun, Candlestick, Lead Piping, Rope.
- Rooms: Kitchen, Conservatory, Lounge, Dining Room, Bedroom, Library
The player should be asked to pick one of each.
The computer will test the scenario and tell them how many correct choices they made.
A simple enhancement would be to record each guess with the number of right answers – rather like the mastermind code breaking game.
- At its simplest the Cluedo problem needs three arrays (one each for room, weapon, person) loaded with the different options. Don’t forget in Python you would use a list!
- The computer randomly picks one item from each array – this is the crime.
- The user then makes a guess.
- The computer attempts to match and tells the user how many they have correct but not which ones.
Some of these steps will need repeating until the user makes a correct guess.
Any problem you write should be tested and the best way of ensuring that you do a good job testing is to plan it before hand. The following image shows how you might test the basic Cluedo game.
Develop your game so it:
- Only allows the user to pick adjacent rooms as per the house map.
- Follows the rules for Cluedo as closely as possible.