Min-Max Search
Posted: Tue Sep 20, 2005 11:45 am
Can you help me with this task. I think that it can be
solved with min-max search, but i can't find an example on
how to implement this algorithm.
Game
Two players are playing this game: There are n numbers (n<=128), ordered in a row.
The first player takes one number from the left or the right side.
Then the second player takes one number from the left or the right
side of the rest of the numbers.
In this way they take the numbers, until there are no numbers left. What is
the maximum sum of the numbers that the first player has taken, if the both
players are playing optimal.
input:
first line: n - the number of numbers
second lind: n numbers, of which a <= 100
output:
the maximum sum of numbers that the first player can take
solved with min-max search, but i can't find an example on
how to implement this algorithm.
Game
Two players are playing this game: There are n numbers (n<=128), ordered in a row.
The first player takes one number from the left or the right side.
Then the second player takes one number from the left or the right
side of the rest of the numbers.
In this way they take the numbers, until there are no numbers left. What is
the maximum sum of the numbers that the first player has taken, if the both
players are playing optimal.
input:
first line: n - the number of numbers
second lind: n numbers, of which a <= 100
output:
the maximum sum of numbers that the first player can take