I was thinking of determining the game of war. I could write a fairly simple game that takes two "decks" of cards, and plays them against each other but I do not think this is optimal.
Because in war the order of the cards matter it is also not a question of simply summing up the "power" of the cards. If the decks were Q-Q-J-J and K-K-1-1 then the game would go as follows even though the first player has more power:
Q-K (QJJ, K11)
Q-K (JJ, 11QK)
J-1 (J, 1QKQK)
J-1 (1J, QKQK)
1-Q (J1J, KQK)
J-K (1J, QK1Q)
1-Q (J, QK1QJK)
J-K (͏∅, K1QJK1Q)
∅ (͏∅, 1QJK1QJK)
I've been trying to think of a method of determine the winner of the game without going through the entire deck each and every time (and thus possibly going for thousands of iterations.)
If you could provide me with some pointers to start thinking about this question - that would be great!
I wasn't exactly sure where to ask this question: so if this is off topic here please redirect me.