Scenario: Each player has a deck of N cards. The first player controls an object called Grindclock, which means that at each turn, he can either :
- Add a "charge" counter on Grindclock, or
- Remove the top X carts of his opponent's deck
Only one of these action is possible. The second player doesn't control anything, and pass every turn. However, at each of his turn, he will have to draw a card from his deck (so he will remove the top cart from his own deck).
The game ends when the second player cannot draw his card.
What is the equation of the optimal amount of "charge" counter that should be put on Grindclock to end the match in the lowest amount of turns possible?
A friend on a social network shared that the answer was |√(N+1)-1|, but he didn't described why, and I'm very curious. I tried to solve it on my own, but it seems to be outside by reach. I'm not sure about the starting equation.
Your friend is right. Suppose you charge for the first $x$ turns, then remove cards from that point on. That means that your opponent will lose 1 card per turn for the first $x$ turns (from drawing cards), then $x+1$ per turn until the end of the game ($x$ from your special ability, plus $1$ from drawing).
After the first $x$ turns, your opponent has $N-x$ cards left, so the total number of turns it takes to reduce your opponent's deck to $0$ is:
$$f(x) = x + \frac{N-x}{x+1}$$
The derivative is
$$f'(x) = 1 + \frac{-1-N}{(x+1)^2}$$
Setting this to $0$ and solving for $x$, we get $x = \sqrt{N+1} - 1$. Bear in mind that if $\sqrt{N+1}$ is not an integer, you'll have to round up or down.