package de.stefanhoth.android.got2048;

import android.app.Application;
import android.os.Handler;

import java.util.Random;

import de.stefanhoth.android.got2048.logic.MCP;
import de.stefanhoth.android.got2048.logic.model.MOVE_DIRECTION;

/**
 * TODO describe class
 *
 * @author Stefan Hoth <sh@jnamic.com>
 *         date: 30.03.2014 21:36
 * @since TODO add version
 */
public class Got2048App extends Application {

    MCP masterControlProgram;
    private int mGridsize = 4;
    private Random mRandom;

    @Override
    public void onCreate() {
        super.onCreate();

        masterControlProgram = new MCP(mGridsize);
        masterControlProgram.addStartCells();

        mRandom = new Random();

        final Handler mHandler = new Handler();
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                simulateMove();
                mHandler.postDelayed(this, 500);
            }
        }, 2000);

    }

    private void simulateMove() {
        masterControlProgram.move(MOVE_DIRECTION.values()[mRandom.nextInt(MOVE_DIRECTION.values().length)]);
    }

    public MCP getMCP() {
        return masterControlProgram;
    }

}

@@ -69,173 +69,55 @@
 on;%0A
-import android.os.Handler;%0A%0Aimport java.util.Random;%0A%0Aimport de.stefanhoth.android.got2048.logic.MCP;%0Aimport de.stefanhoth.android.got2048.logic.model.MOVE_DIRECTION
+%0Aimport de.stefanhoth.android.got2048.logic.MCP
 ;%0A%0A/
@@ -360,36 +360,8 @@
 = 4;
-%0A    private Random mRandom;
 %0A%0A  
@@ -528,454 +528,8 @@
 s();
-%0A%0A        mRandom = new Random();%0A%0A        final Handler mHandler = new Handler();%0A        mHandler.postDelayed(new Runnable() %7B%0A            @Override%0A            public void run() %7B%0A                simulateMove();%0A                mHandler.postDelayed(this, 500);%0A            %7D%0A        %7D, 2000);%0A%0A    %7D%0A%0A    private void simulateMove() %7B%0A        masterControlProgram.move(MOVE_DIRECTION.values()%5BmRandom.nextInt(MOVE_DIRECTION.values().length)%5D);
 %0A   

Remove auto-play