Computer simulation of the Varley mechanism