You still have a year after publishing to file a patent. During that year, you only lose out on the patent if
other innovations are made and published with regards to the subject matter of your patent and your application includes those other innovations. (You can still receive a patent if you restrict yourself to the invention described in your publication, but threading the needle in such a fashion could be difficult.)
Commercial sales by competitors are not subject to patent during that interim period, and they can continue such sales after the patent application is filed, but once the patent application is filed they can only continue to sell without a license the exact same products they sold before the application. So if the competitor changes the product sold, they could be subject to the patent (assuming the patent is granted).
As for your specific example: algorithms can't be patented; they are trade secrets. Specific software implementations of algorithms possibly can be patented. The difficulty, of course, is that deep pockets Paapo can always engineer around the specific software implementation you specify in your application.