Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. Converted to Java from my older C++ version.