I am sorry, I totally missed this comment up there
Wow, I never thought of such simple calculation to create 1d array, that is neat :)
Took me a while to make sure it is really working in large sized grids :)
Even now this is still suspicious to me, it is a good place for stack overflow to happen, calling unexpected tiles instead of neighbours. Are You sure parameter.cols are updated after changing grid size to 30 ?
Another thing that came to my mind, is could it be you have setget for
selected boolean ?
I noticed, that aside from adding timer, You also removed game.lose line. Did You make sure it is not the only condition for stack overflow ?
Other than that I can't find anything risky in this code. I am sure You didn't mess getneighborid(). Your code is very clean and sharp. Maybe I could at least give You a tip to improve that further :) :