public String getState() {
        String state = "STATE[";
        if(winner == 0)
            state += turn+"]";
        else
            state += "0]";
        for(int i=0;i<3;i++) {
            for(int j=0;j<3;j++) {
                state += grid[i][j];
                if(j < 2)
                    state +=",";
            }
            if(i<2)
                state += ";";
        }
        return state;
    }