View Single Post
  #9  
Old 09-23-2005, 02:42 AM
Moozh Moozh is offline
Member
 
Join Date: Jan 2004
Posts: 40
Default Re: Game Theory (possibly redundant)

In case anyone cares (I'm bored). For the general case where:

You lose if you pick the last packet
You go first
Each player must pick between x and y packets (x<y)
There are n packets
If there are x or fewer packets left, the player must take them.

Realize that after the first pick, you can choose such that every subsequent pair of picks totals x+y

Your first step is to find the remainder of (n-1)/(x+y), or (n-1)%(x+y). That number will be your first pick. If that remainder is less than x, the 2nd player has the advantage.

After that, whatever your opponent picks, you pick a number such that his and yours add up to x+y.

You win (unless that remainder was less than x)
Reply With Quote