Fix lint
This commit is contained in:
parent
c1ee9e3e80
commit
9bd6c6e624
1 changed files with 12 additions and 9 deletions
|
@ -37,15 +37,13 @@ class MinefieldRepository : IMinefieldRepository {
|
|||
val fieldSize = dimensionRepository.areaSize()
|
||||
|
||||
val display = dimensionRepository.displaySize()
|
||||
val calculatedWidth = ((display.width / fieldSize).toInt() - HORIZONTAL_STANDARD_GAP)
|
||||
val calculatedHeight = ((display.height / fieldSize).toInt() - VERTICAL_STANDARD_GAP)
|
||||
val finalWidth = calculatedWidth.coerceAtLeast(MIN_STANDARD_WIDTH)
|
||||
val finalHeight = calculatedHeight.coerceAtLeast(MIN_STANDARD_HEIGHT)
|
||||
val finalMines = (finalWidth * finalHeight * CUSTOM_LEVEL_RATIO).toInt()
|
||||
|
||||
val finalWidth = ((display.width / fieldSize).toInt() - 1).coerceAtLeast(6)
|
||||
val finalHeight = ((display.height / fieldSize).toInt() - 3).coerceAtLeast(9)
|
||||
|
||||
return Minefield(
|
||||
finalWidth,
|
||||
finalHeight,
|
||||
(finalWidth * finalHeight * customLevelRatio).toInt()
|
||||
)
|
||||
return Minefield(finalWidth, finalHeight, finalMines)
|
||||
}
|
||||
|
||||
override fun randomSeed(): Long = Random.nextLong()
|
||||
|
@ -54,6 +52,11 @@ class MinefieldRepository : IMinefieldRepository {
|
|||
private val beginnerMinefield = Minefield(9, 9, 10)
|
||||
private val intermediateMinefield = Minefield(16, 16, 40)
|
||||
private val expertMinefield = Minefield(24, 24, 99)
|
||||
private const val customLevelRatio = 0.2
|
||||
|
||||
private const val CUSTOM_LEVEL_RATIO = 0.2
|
||||
private const val HORIZONTAL_STANDARD_GAP = 1
|
||||
private const val VERTICAL_STANDARD_GAP = 3
|
||||
private const val MIN_STANDARD_WIDTH = 6
|
||||
private const val MIN_STANDARD_HEIGHT = 9
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue