There is no source code to simulate this. It is a theoretic construct used in security proofs. Cryptography is often about the very limits of what could be calculated. This is quite far from actual programming source code.
For example, quite often something is called "efficient" in cryptography, if the algorithm runs in polynomial time (for some parameter). However, if the source code of a program actually requires $n^{1000}$ seconds then it still runs in polynomial time, but it is not possible to calculate it for $n=2$ (over $10^{293}$ years).
The adversary can not be represented by a specific algorithm, but the adversary is the union of all polynomial time algorithms (or said differently: He is limited to poly-time algorithms, but not specified which algorithms).