Flags of the World

We are trying to build a program that will ask the end-user to choose a flag amongst six flags. The program will then try to guess the selected flag by asking a maximum of two questions.

Look at the flowchart below used to describe our algorithm.

Analysing this flowchart, can you guess the country corresponding to these six flags? (Type your answer below each flag).

Flag-Tanzania Flag-Turkey Flag-Luxembourg
Flag-Ghana Flag-Sweden Flag-Chad


Click on flowchart to enlarge.

Challenge #1

Design a similar flowchart used for the computer the guess the correct flag amonst these six new flags. You will need to ask different questions.

Flag-Jamaica Flag-China Flag-Iceland
Flag-Colombia Flag-Cuba Flag-Denmark

Challenge #2

Can you tweak the algorithm from the previous task to get the computer to guess the correct flag amongst all twelve flags, using a maximum of three consecutive questions?

Share Button
Tagged with: ,