public Triple run() throws InterruptedException, IOException // run the simulation
    {
        double numBounces = 0;
        boolean endCollided = false;
        Vector2D prevPosition = pinball.getPosition();
        if(graphics)frame.add(this);
        while(!endCollided && numBounces < 500)
        {
            if(map.collided(pinball)) try
            {
                map.resolveCollision(pinball);
                numBounces++;
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
            pinball.update();
            if(graphics)
            {
                frame.repaint();
                sleep(1);
            }
            endCollided = endZone.collided(pinball);
            image.drawLine(prevPosition, pinball.getPosition());
            prevPosition = pinball.getPosition();
        }

        System.out.println("Finished run!");
        System.out.println("Number of Bounces: " + numBounces);
        image.saveImage();
        return new Triple(Constants.gravity, Constants.bounceFactor, numBounces);
    }