Last active
August 1, 2020 13:41
-
-
Save cioccarellia/bb24c49b2753c9600d79172e3862d113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mountain = Mountain().apply { | |
treeCount = randomBetween(2000, 3000) | |
houseCount = randomBetween(5, 10) | |
pendence = 20/100 | |
roadKind = RoadKind.DIRT | |
} | |
val leavesToHouseRatio: Float = mountain.run { | |
val totalLeaves = treeCount * TREE_LEAVES_COUNT | |
val houseSurface = houseList.map { | |
it.squareMeters | |
}.sum() | |
// Last statement | |
if (houseCount > 0) { | |
totalLeaves / houseSurface | |
} else { | |
0 | |
} | |
} | |
// We run functions but don't care about the result | |
mountain.run { | |
printHousePosition() | |
printTreesPosition() | |
printStreetPath() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment