Moore's Nim

JavaScript

Ending Condition:

The four piles are of sizes :

How many do you remove?