This solution was written in GDScript (similar to Python) and uses Godot 3.0.
Inside the project is a raw solution that only fulfills the minimal requirement of the problem. It is located in the folder named raw_code(./Galou_raw.gd).
The rest is a animated graphic representation of the problem. It includes a step by step mode and gears can be added/removed. On the bottom of the screen is a panel with a button to add and one to remove a gear. Dragging from the button on a gear will remove/add it. (Initial gears cannot be removed)
To display other boards the text file data.txt must be modified as specified in the problem description.