public void solve(){
        solveRunning = true;
        g = ctrl.getGrid();

        //Add delay so that each step is visible.
        while(!isSolved(g)){

            try{
                Thread.sleep(20);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }


            if(!checkSolvedCell(g)){
                if(!eliminateCandidates(g)){
                    if(!hiddenSingle(g)){
                        if(!nakedPair(g)){
                            if(!nakedTriples(g)){
                                if(!pointingPair(g)){
                                    ctrl.sendToOutput("PUZZLE NOT SOLVED");

                                    break;
                                }
                            }
                        }
                    }
                }
            }
            ctrl.sendToPanel();
        }
        solveRunning = false;

    }