terrainFunction and findChar implemented