We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Misère Nim
- Discussions
Misère Nim
Misère Nim
Sort by
recency
|
27 Discussions
|
Please Login in order to post a comment
If you're familiar with Nim-Sum, this problem will be very easy; otherwise, it's incredibly difficult. This type of problem should be used to test well-read individuals, not programmers.
def misereNim(s):
Here is my solution: 1) For 1 or 2 piles, it is easy to figure out the solution. 2) Win only if the opponent can not figure out how to win for all possible moves. 3) A depth-first seach for each combinition. 4) Minor optimizations.
import static org.junit.Assert.assertEquals;
import java.util.LinkedList; import java.util.List;
import org.junit.Test;
public class MisereNim {
}
}
Win or loose depends on number of remaining of pile of "1". So, if there are pile of ">1" value, player can use those piles to controller number of remaining pile of "1". Both player can use above pile to controller number of remaining of pile of "1", "Second" player always able to override controll of "Frist" player if number of pile of ">1" value is even && larger than 2.
I believe the testcases's result is incorrect.
My solution: