Here is a very interesting Unfair Dice mission:
https://py.checkio.org/mission/unfair-dice/
And some examples for the self-check:
1. winning_die([4, 4, 4, 4, 4, 4]) == [2, 2, 5, 5, 5, 5] # Or [5, 5, 2, 2, 5, 5]
================================================================================
In this case I found a better combination: [4, 0, 5, 5, 5, 5]
This gives us 18 versus the enemy's dice [4, 4, 4, 4, 4, 4], while [2, 2, 5, 5, 5, 5] and [5, 5, 2, 2, 5, 5] gives both 12
- winning_die([2, 2, 5, 5, 5, 5]) == [3, 3, 3, 3, 6, 6]
========================================================
In this case, [6, 0, 0, 6, 6, 6] is better then author's [3, 3, 3, 3, 6, 6]
So, I consider author's algoritm has a flaw, and does not consider all correct variants of answers.
Created at: 2017/07/28 21:03; Updated at: 2017/07/29 11:57
The question is resolved.