Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[둘리] 2단계 자동차 경주 제출합니다. #68

Merged
merged 12 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(CarsHelper): CarsHelper -> WinnersFinder로 이름 변경
  • Loading branch information
hyemdooly committed Feb 13, 2023
commit e818230d04fac48c7e6ecd16288eecddfa158352
4 changes: 2 additions & 2 deletions src/main/kotlin/controller/RaceGame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package controller

import generator.RandomGenerator
import model.Cars
import util.CarsHelper
import util.WinnersFinder
import view.InputView
import view.OutputView

Expand All @@ -17,7 +17,7 @@ class RaceGame(private val outputView: OutputView, private val inputView: InputV
repeat(tryNumber) {
tryMove(cars)
}
outputView.outputWinners(CarsHelper.findWinners(cars))
outputView.outputWinners(WinnersFinder.findWinners(cars))
}

private fun tryMove(cars: Cars) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package util

import model.Cars

object CarsHelper {
object WinnersFinder {
fun findWinners(cars: Cars): List<String> {
val equalCars = cars.cars.groupBy({ it.position }, { it.name })
return equalCars[equalCars.keys.max()]?.toList() ?: emptyList()
Expand Down