import java.awt.*;

class Spaceship extends Body {
    // Constructs a new spaceship with the initial location and velocity
    // as given in the parameters.
    public Spaceship(double inX, double inY, double inVx, double inVy) {
        super(inX, inY, Color.MAGENTA, 1e20, "Spaceship", inVx, inVy);
    }

    // Returns the force being applied by the rockets.
    public double getThrust() {
        return 0.0;
    }

    // Alters the force being applied by this ship's rockets.
    public void setThrust(double force) {
    }

    // Returns the direction in which this spaceship is facing. Note that
    // because space is frictionless, the direction the spaceship is facing
    // has nothing to do with which direction it is actually moving.
    public double getFacing() {
        return 0.0;
    }

    // Configures how many radians this ship will rotate with each step of
    // the simulation.
    public void setRotation(double radiansPerStep) {
    }

    // You should not modify or use this method: It dictates how the
    // spaceship is drawn on the screen.
    public void paint(Graphics g) {
        double x = this.getX();
        double y = this.getY();
        double face = this.getFacing();
        double faceOffs = 2 * Math.PI / 3;
        double thrust = this.getThrust();
        if(thrust > 0) {
            double length = 1000 * thrust;
            int[] rx = { (int) Math.round(x - length * Math.cos(face)),
                    (int) Math.round(x + 8 * Math.cos(face + faceOffs)),
                    (int) Math.round(x + 8 * Math.cos(face - faceOffs)) };
            int[] ry = { (int) Math.round(y - length * Math.sin(face)),
                    (int) Math.round(y + 8 * Math.sin(face + faceOffs)),
                    (int) Math.round(y + 8 * Math.sin(face - faceOffs)) };
            g.setColor(Color.RED);
            g.fillPolygon(rx, ry, 3);
        }
        double ang = 2 * Math.PI / 3;
        int[] px = { (int) Math.round(x + 15 * Math.cos(face)),
                (int) Math.round(x + 10 * Math.cos(face + faceOffs)),
                (int) Math.round(x + 10 * Math.cos(face - faceOffs)) };
        int[] py = { (int) Math.round(y + 15 * Math.sin(face)),
                (int) Math.round(y + 10 * Math.sin(face + faceOffs)),
                (int) Math.round(y + 10 * Math.sin(face - faceOffs)) };
        g.setColor(Color.MAGENTA);
        g.fillPolygon(px, py, 3);
        g.setColor(Color.BLACK);
        g.drawPolygon(px, py, 3);
    }
}
