How to maximize your score in this game?

78 Views Asked by At

Consider the following game:

On a table, there are two glass bowls with $x$ and $y$ beads each. In each move you can do the following:

  1. Remove a bead from the first bowl and put it in the second
  2. Discard a bead from the second bowl

If $x+y$ is even, its your turn to move. If its odd, your opponent will move. At each position in the game (not just in your turns), you will get a score determined by a function $f(x, y)$

$$f(x, y) = Ax^2 + By + Cxy$$

where $A$, $B$, $C$, are constants. Your total score is the sum of your scores in all the positions during the game.

Your opponent will try to minimize your score. What's the maximum score you can achieve given $A, B, C, x, y$?

I have never encountered a problem with so many variables before. I have no idea how to approach it. An ideal solution would be a function $S(A, B, C, x, y)$ that would return the maximum score possible.

1

There are 1 best solutions below

2
On

The way to solve this problem, for a given $A,B,C$, is to determine $S(A,B,C,x,y)$ recursively in $x$ and $y$. It's trivial to determine $S(A,B,C,0,y)$ for any $y\ge0$, since all moves must be of type $2$. From there we know that for $x>0$, $$ S(A,B,C,x,y) = \begin{cases} \max\{S(A,B,C,x-1,y+1),S(A,B,C,x,y-1)\}, &\text{if $x+y$ is even}, \\ \min\{S(A,B,C,x-1,y+1),S(A,B,C,x,y-1)\}, &\text{if $x+y$ is odd}. \\ \end{cases} $$ I suggest doing explicit computations and seeing if you can detect a pattern.