Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps.