Prompted by Théophile's answer, we can make a direct statement of how to play the game. We claim the $P$ positions, won by the previous player, are those that have an even number of piles with an even number of stones and an even number of piles that have an odd number of stones, and the $N$ positions are the rest. To prove this we need to show that the terminal position is $P$, that all moves from $P$ positions result in $N$ positions, and that every $N$ position has at least one move to a $P$ position. The terminal position has no piles, so has an even number of piles of each parity. From a $P$ position, any move will leave an odd number of piles of the parity moved in. If the move leaves stones in the pile moved in, it will also leave an odd number of piles of the other parity, but we don't need that. If there are an odd number of piles of one parity and an even number of the other, take an entire pile of the parity with an odd number of piles and this will leave a $P$ position. If there are an odd number of piles of each parity, take one stone from a pile with an even number of stones and this will leave a $P$ position. This shows the $N$ and $P$ positions are as claimed and gives a specific move where there is a winning one (the $N$ positions).