take inputs and use recursion to open up the neighbouring tiles