Problem: a stack of cards placed face up in a row, and each player can pick a card from either end once per turn. Once all cards have been picked, they are summed up for each player.
Determine if the first player wins, loses, draws
E.g [0] or [<empty>] - Draw
E.g [1] - Win
E.g [1, 1] - Draw
E.g [1, 2, 1] - Draw
E.g [3, 5, -3, 12, 7, 6] - Win
I thought there would be some kind of pattern. I came up with:
- if the sum of first player is greater than or equal to the max value of all card values then first player wins - But that doesn't work (e.g [1, 2, 1]).
I was wondering if there is another pattern I'm not seeing...
Determine if the first player wins, loses, draws
E.g [0] or [<empty>] - Draw
E.g [1] - Win
E.g [1, 1] - Draw
E.g [1, 2, 1] - Draw
E.g [3, 5, -3, 12, 7, 6] - Win
I thought there would be some kind of pattern. I came up with:
- if the sum of first player is greater than or equal to the max value of all card values then first player wins - But that doesn't work (e.g [1, 2, 1]).
I was wondering if there is another pattern I'm not seeing...