Java code to generate terrains and explore them