implemented terrainFunction and findChar