finalized code for equilateral triangle simulation