Then you just write it in fancy sounding bullshit, and pass it off as a unique invention -- and the morons at the patent office, whose only real criteria is if the checks clear, will rubber stamp it and suddenly you have a patent.
To a great degree this is actually true. The patent officers don't care about the checks that much, though. It just creates a lot of work for them when they reject a patent claim and the lawyers of the people applying for the patent, i.e. prosecuting (that's the technical term) it prove them wrong and get their rejections overturned. It also shows badly on the record of the patent officer if their rejections tend to not hold up. The lawyers usually have more resources and motivation to make the patent pass through. So, the patent clerks tend to take the path of least resistance, i.e. approving the patents after doing their due diligence. Patent officers have a pre defined set of databases(including scientific journals, previous patents, etc) that they look through for prior art, and they don't look outside of that set (for example on Google) to find out if an idea is original. There is a fair amount of screening that goes into granting a patent for sure, and they don't just stamp anything. But they will stamp anything as long as their asses are covered. And they are really tiny asses that don't need a whole lot of cover.
Now when you bring up a case in court to invalidate somebody else's patent, that's when your lawyers will do all the google searches and thorough research to show that the invention was publicly known before the patent was granted. This research would go in front of a judge who will most likely rule in favor of whoever hired the bigger guns.
The problem with ideas in software (as opposed to, say, chemistry) is that they are generated far too quickly and anonymously to be included in formal databases and journals, even though they may be publicly known. I'll give you a rough example. Around the year 1998, you could use a plugin in Winamp called Geiss that showed trippy visualizations of music. Before that plugin (correct me if I'm wrong), music visualization was mostly just fancy waveforms. Apple lifted this idea wholesale and made it part of iTunes in 2001. Sony patented this idea in 2009. Poor Mr. Geiss got diddly squat for his invention, even though millions or even billions have probably used it till date, and his idea got patented more than a decade after conception. Such is the state of affairs: big tech companies go out and patent ideas that they learn from the general public. If the idea's implementation takes off, the patent provides them security, and if it doesn't, it's a bargaining chip to gouge money from anyone that tries to use the idea.
Regarding the patenting of ideas versus inventions, in theory you can only patent inventions, but the definition of what constitutes an invention is very lax, especially for software, and you don't have to go and show a working proof of concept to a patent officer. If the patent application describes the software in enough detail so as to allow an average programmer to develop it based on just the description, it's good enough to qualify. In other words, you can pretty much patent a piece of software at the requirements and architecture stage.