This challenge is a copy of a challenge introduced in a TV show called Countdown. The challenge is called Numbers round.
In Numbers round there is a player whose mission is to pick six cards from the table and then with those cards he has to achieve a number generated by a machine using basic operators: + - * /
There are two groups of cards on the table. In the first group there are four different cards with values 25, 50, 75 and 100. In the second group there are cards with values from 1 to 10. Usually players pick one big card and the rest five from small cards. The number they have to achieve (or get as close as possible) is from range 100-999.
One number can only be used once. Not all numbers have to be used.
Your challenge is to create a program which does the following:
- Picks the cards:
-- Randomly picks one card from big cards (25,50,75,100) and five cards from small cards (1-10). The small cards aren't unique, they can have the same value
- Generates a number from range 100-999
- Finds out what how to get to the generated number using the cards given and the operators +, -, *, /. Note that you aren't allowed to use integer rounding meaning that number 4/3 equals to 1.333 instead of 1. One card can be used only once. Not all cards have to be used.
- Prints out how it got to the generated number
Big card: 25 Small cards: 5 8 1 10 6 Generated number: 452 25 - 10 = 15 15 * 5 = 75 75 - 1 = 74 74 * 6 = 444 444 + 8 = 452
Big card: 25 Small cards: 2 6 1 9 1 Generated number: 333 25 + 1 = 26 26 + 1 = 27 27 * 2 = 54 54 * 6 = 324 324 + 9 = 333
Joy of programming, what else would you dare to ask.
Good luck and have fun.
Remember to use Spoiler and Code tags when posting code.