Author |
Topic: winning algorithm/combination to win NIM (Read 1395 times) |
|
homer89
Newbie
Posts: 2
|
|
winning algorithm/combination to win NIM
« on: Apr 27th, 2009, 9:17am » |
Quote Modify
|
In the game of nim. You have three piles consisting of 3,5, and 7. The players take turn selecting any amount as long as it is in one pile. The player that's left with the lst one loses. What is the winning combination/algorithm of this game and how can I be sure o win each time?
|
|
IP Logged |
|
|
|
iono
Senior Riddler
dehydrated water....
Gender:
Posts: 516
|
|
Re: winning algorithm/combination to win NIM
« Reply #1 on: Apr 27th, 2009, 8:19pm » |
Quote Modify
|
Well, it depends whether or not you go first. I don't think there is a way. Nvm, there is a way, but you have to go first to be guaranteed a win.
|
« Last Edit: Apr 27th, 2009, 8:22pm by iono » |
IP Logged |
So, if I help you, I'll get kicked for ksing, but if I don't, then I'll get kick for not helping...
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: winning algorithm/combination to win NIM
« Reply #2 on: Apr 28th, 2009, 6:22am » |
Quote Modify
|
The winning strategy is to always move to one of the following situations: (1 0 0) or (1 2 3) in any order (n n 0) for n>1 (1 4 5) (2 4 6) (3 4 7) (2 5 7) (1 5 4) (3 5 6) I think that covers it.
|
|
IP Logged |
|
|
|
homer89
Newbie
Posts: 2
|
|
Re: winning algorithm/combination to win NIM
« Reply #3 on: Apr 28th, 2009, 5:30pm » |
Quote Modify
|
i don't think order has anything to do with it. My teacher played it with us and regardless of who was going first, he's always win. What about combinations where you only have 2 piles left?
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: winning algorithm/combination to win NIM
« Reply #4 on: Apr 28th, 2009, 10:20pm » |
Quote Modify
|
Well, obviously if 2 people as good as your teacher play together, one of them has to loose. There is no fail-safe strategy for both sides! Your teacher won because of his opponent's mistakes. From (3 5 7) you should remove 1 from any pile. If you do anything else, your teacher will take the opportunity and win. There might be a psychological component: taking 1 looks too simple and isn't played much as a starting move. With 2 piles left, you must make them equal. Whatever your opponent does, you can take the same from the other pile. The one exception is at the end, when one pile is 0 or 1, then make sure to leave only one item.
|
|
IP Logged |
|
|
|
|