Learn how to build virus simulation attacks on my PC?

Hi,
How do I build a virus simulation attack program on my PC? I would like to learn how these viruses operate on my PC, therefore protect my computer from future harmful attacks. The program should enable me to practice virus infections& recover from them, hence attack them before they reproduce on my system. Any one familiar with simulation of a virus attack?
