Invention2.java
/* 
 * A program that generate a different image using only one SRectangle. 
 */

package npw;

import painter.SPainter;
import java.awt.Color;

import shapes.SRectangle;

public class Invention2 {
    public static void main(String[] args){
        SPainter Kevin = new SPainter("Kuncheng's Invention 2", 1500, 1000);

        double Height = ((double)Math.random() * 500 + 1);
        double Width = ((double)Math.random() * 200 + 1);
        double NumOfRectangles = ((double)Math.random() * 15 + 1);
        double RecPosistion, ColorNum, MoveD;

        SRectangle AdmiralGraftSpee = new SRectangle(Height, Width);

        int i = 0;
        while (i < (int)NumOfRectangles) {
            MoveD = ((double)Math.random() * 250 + 50);

            RecPosistion = ((double)Math.random() * 4 + 1);
            if ((int)RecPosistion == 1){
                Kevin.mlt(MoveD);
                Kevin.tl();
            } if ((int)RecPosistion == 2){
                Kevin.mfd(MoveD);
            } if ((int)RecPosistion == 3){
                Kevin.mrt(MoveD);
                Kevin.tr();
            } if ((int)RecPosistion == 4){
                Kevin.mbk(MoveD);
            }


            ColorNum = ((double)Math.random() * 2 + 1);
            if ((int)ColorNum == 1){
                Kevin.setColor(Color.BLACK);
            } else {
                Kevin.setColor(Color.RED);
            }

            Kevin.paint(AdmiralGraftSpee);

            Kevin.moveToCenter();

            i++;
        }

    }
}