Yes I believe a man named Alan Turing devised a machine that is capable of doing just that. He expanded upon the work of Charles Babbage's Analytical Engine to create what was then known as a Turing machine, or a computer in modern terms. I believe a computer is capable of exactly the functionality you require.
However if you're looking for a useful answer, please form your question
accordingly
-MBirchmeier