I'll tell you a story that shows how different software is from hardware (the figures aren't accurage, but ballpack correct, and the story is true).
You can get software that will design a circuit. Works great.
Someone thought that maybe the software was missing out on things that the real world had, so use FPGA's to design a circuit that would haev a stead voltage out either high or low for a high frequency or low frequency input.
Standard way in software would have a timing circuit that would take more than the 100 transistors to make on its own.
He used genetic algorithms to select the best 50 out of 100, interbred them and kept going. Eventually it got stable. And only 30 transistors out of the 100 availble were connected. However, if he disconnected all 70 redundant ones, the design didn't work. He needed 38, even though 8 of them weren't connected at all.
The reason why this story is needed is because when you get to implementing your idea in cogs and wheels, you find out that Real Life (tm) is a lot less helpful than software. You can find that your backlash is too high, or the teeth don't mesh or that there's a maximum rate you can use, or you need odd materials. Software works under it's own set of very simple laws (add one number to another number, repeat 1billion times a second) and it doesn't give you anywhere near the issues.
In the case of the cogs and wheels, you may find that it DOES work but not well. So someone comes along, solves the EXACT SAME problem but uses different shaped cogs (cams maybe) or a new material (that they invented) and it works better. And THEY get a patent on this "better mousetrap". With software, the only way you can make it "better" is by using more efficient code. But code isn't part of the patent, just the outcome required. Copyright is used on the code.
Lastly, the software patent version of "building a better mousetrap" would be something like:
A method to restrain by force, impediment or other method the continued translocation of a pest (rodent, insect or other) by means not limited to lethal action, trapdoor, latching or immobilisation, such situation to be occasioned on the ingress of the pest species into the invention. Such change in state of the trap being sufficient to render unavailable egress of the pest species from the invention's controlled space.
Now build a better mousetrap from this...