var gametitle=document.getElementsByClassName("title")[0].innerHTML
if(takeOver){ //takeOver is a function used by the AI
    function takeOver(){

    //try {    //enable for error protection
    
        // test game is compatible and set exec str
        ///testGame();
    
        // take over manager
        realGM = eval(gm_exec_str);

        // set constants
        GRID_SIZE = realGM.size;
        for (var i=0;i<100;i++) {
            if (realGM.getVector(i) == null) break;
        }    
        NUM_OF_MOVES = i;
    
        // setup speedups
//        speedups();

        var testAI = new AI(realGM);
        var res = testAI.getBestMove();
    
        realAI = new AI(realGM);
    
        if (document.getElementById('toggleAI')) return;
        setup_UI();
    /*} catch (e) {
        alert("There's a problem accessing this game. If you want me to fix this, please report it at the feedback link.");*/
    
    }    
    console.log('AI Patch successful!');
    console.log('You can play with the AI constants RUNS and MOVES_AHEAD to control AI strength. Set DEBUG to see verbose running data.');
    console.log('run speedups() for experimental speedup patchs.');
    
    }
    if(gametitle==="Isotopic 256"){ //Isotopic 256 requires a patch to copy instability to random runs
        AI.prototype.cloneGM=function(gm) {
            // create a backgroud manager to do the runs on
            var bgm = new GameManager(GRID_SIZE, StubManager, StubManager, StubManager);
    
                // clone grid
                for (var x=0;x<gm.grid.cells.length;x++) {
                for (var y=0;y<gm.grid.cells[x].length;y++) {
                    var cell = gm.grid.cells[x][y];
            
                    // clone cell if exists
                    if (cell) {
                        var value = JSON.parse(JSON.stringify(cell.value));
                        var unstable = cell.unstable
                        cell = new Tile({ x: cell.x, y: cell.y }, cell.value);
                        cell.unstable = unstable
                    }
            
                    bgm.grid.cells[x][y] = cell;
                }
            }
    
            return bgm;
        }
    }if(gametitle=="DIVE"){ //AI fails to load
        GameManager.prototype.isGameTerminated = function () {
            if (this.over || (this.won && !this.keepPlaying)) {
                return true;
            } else {
                return false;
            }
        };
        StubManager.prototype.updateCurrentlyUnlocked=StubManager.prototype.setGameMode=StubManager.prototype.announce=nullfunc; //by this point the AI manages to install itself
}
if(gametitle==="DIVE"){
    document.body.appendChild(document.createElement('style')).src='https://catsarefluffy.github.io/2048-patches/big_grid_dive.css';
}else{
    document.body.appendChild(document.createElement('style')).src='https://catsarefluffy.github.io/2048-patches/big_grid.css';
}

@@ -2474,16 +2474,65 @@
        %7D
+%0A        GameManager.prototype.keepPlaying = true
 ;%0A      
@@ -2657,57 +2657,1341 @@
 unc;
+%0A       
  //
-by
  this 
-point the AI manages to install itself
+gets annoying%0A        HTMLActuator.prototype.announce = function (message) %7B%0A            var announce = document.createElement(%22p%22);%0A            announce.classList.add(%22announcement%22);%0A            announce.textContent = message;%0A            this.announcer.appendChild(announce);%0A            setTimeout(this.removeFirstChild.bind(this,this.announcer),250);%0A        %7D%0A        AI.prototype.cloneGM=function(gm) %7B%0A            // create a backgroud manager to do the runs on%0A            var bgm = new GameManager(GRID_SIZE, StubManager, StubManager, StubManager);%0A    %0A                // clone grid%0A                for (var x=0;x%3Cgm.grid.cells.length;x++) %7B%0A                for (var y=0;y%3Cgm.grid.cells%5Bx%5D.length;y++) %7B%0A                    var cell = gm.grid.cells%5Bx%5D%5By%5D;%0A            %0A                    // clone cell if exists%0A                    if (cell) %7B%0A                        var value = JSON.parse(JSON.stringify(cell.value));%0A                        cell = new Tile(%7B x: cell.x, y: cell.y %7D, cell.value);%0A                    %7D%0A            %0A                    bgm.grid.cells%5Bx%5D%5By%5D = cell;%0A                %7D%0A            %7D%0A            bgm.tileTypes = gm.tileTypes;%0A    %0A            return bgm;%0A        %7D%0A        document.getElementsByClassName(%22game-intro%22)%5B1%5D.classList.remove(%22game-intro%22);%0A        takeOver();
 %0A%7D%0Ai

Fix DIVE