Dr. Nim

Dr. Nim is a toy invented by John Thomas Godfrey and manufactured by E.S.R., Inc. in the mid-1960s. It consists of a marble-powered plastic computer capable of playing the game of Nim. The machine selects its moves through the action of the marbles falling through the levers of the machine.
Game play and construction.
Dr. Nim is an early computer game. The "game board" is based on the mechanical Digi-Comp II digital computer. It has memory switches that hold bits of data. The unit is programmed by lobed levers that affect and are affected by marbles that are released from the top of the game. Three of the levers set the start position. The fourth lever is the 'equaliser' option; if set, the player can win if they play perfectly. A fifth lever acts as a switch to indicate whose turn it is. The player takes a turn by pressing a button to release one marble at a time, to a maximum of three, then flips the switch and presses the button again to start the machine's turn. After the machine has played, the last released marble flips the switch back to end the turn.
Nim.
Dr. Nim was based on a mathematical game called "NIM," which similarly consisted of twelve marbles. A simple strategy will always win as long as the opponent goes first. This is the strategy for single-pile NIM: If the opponent takes 3 marbles, the first player should take 1. If the opponent takes 2 marbles, the first player should take 2. Finally, if the opponent takes 1 marble, the first player should take 3. The goal of the game is to get the last marble (the 12th marble).
Influence.
The mathematics communicator Matt Parker created a video about Dr. Nim.