29
0
Santa's Decision:
In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get coal or toys.
But unfortunately, Santa is unorganised, in some of his entries, the naughty, nice and name fields are in the wrong order.
Input
Input will come in the following, interchangeable format:
- the person's name (cannot contain a colon, only
a-zA-Z0-9) - the word
naughtyfollowed directly by a colon and an non-negative integer representing the amount of times Santa caught you being naughty - the word
nicefollowed directly by a colon and an non-negative integer representing the amount of times Santa caught you being nice
All separated with a single whitespace (ASCII 32) between each of them.
Additionally, the name will have no whitespace between the parts of the name Santa Claus -> SantaClaus.
Bonus:
- (25%): He is Santa Claus, so he needs to check the list twice, and make sure there are no duplicates. (In which case, it just gets the first scores that user has)
Example:
Quill naughty:4 nice:0
naughty:0 Doorknob nice:3
naughty:2 Quill nice:6
nice:3 balpha naughty:3
pops nice:4 naughty:2
Output:
The output should consist of:
The name of the person followed by:
- If there's more points in
naughty, thencoal: - If there's more points in
nice, thentoys. But if
naughtyandniceare equal, thenneeds more dataExample output:
- With organisation bonus and duplicate removal bonus:
Quill coal
Doorknob toys
balpha needs more data
pops toys
- Without bonus:
Quill coal
Doorknob toys
Quill toys
balpha needs more data
pops toys
4
There's also a typo in the test cases. You misspelled our glorious mod DorkNoob's name :^)
– FryAmTheEggman – 2015-12-17T23:37:06.9779@FryAmTheEggman ಠ_ಠ – Doorknob – 2015-12-18T00:04:45.510
Can we assume nobody's name is
naughtyornice? – PurkkaKoodari – 2015-12-18T01:45:47.8602Nope, naughty or nice are valid names – Quill – 2015-12-18T01:56:40.720
Does the output have to be space-separated, or can it be in a list? – Maltysen – 2015-12-18T02:15:34.467
Space separated – Quill – 2015-12-18T02:16:04.037
Just curious: why did you choose to eliminate duplicates instead of adding their totals? Too complex? – 2012rcampion – 2015-12-18T02:45:42.403
1That's a good idea... I guess there's always next time... – Quill – 2015-12-18T02:49:47.020
1"balpha needs more data" That sounds about right. – Adam Davis – 2015-12-18T15:23:42.190