import java.util.Random;

public class MouseMove {
    private static Random random = new Random();
    private static MouseMove[] allMoves = new MouseMove[0];
    protected int deltaX;
    protected int deltaY;

    public MouseMove()
    {}

    private MouseMove(int deltaX, int deltaY)
    {
        this.deltaX = deltaX;
        this.deltaY = deltaY;
    }

    public static MouseMove getMove()
    {
        int deltaX = random.nextInt(-1, 2);
        int deltaY = random.nextInt(-1, 2);
        MouseMove mm = new MouseMove(deltaX, deltaY);

        MouseMove[] newMoves = new MouseMove[allMoves.length + 1];
        newMoves[allMoves.length] = mm;

        for (int i = 0; i < allMoves.length; i++) {
            newMoves[i] = allMoves[i];
        }

        allMoves = newMoves;

        return mm;
    }
}
