-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[step4] π 4λ¨κ³ - μλμ°¨ κ²½μ£Ό(μ°μΉμ) #5477
base: shgpwn
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ λ°μ μΌλ‘ ν° κ³ λ―Όμ΄ μμ΄ λ―Έμ
μ§ν λ° μ½λ μμ±μ΄ μ΄λ€μ§ κ² κ°μ, 리뷰μ΄λ‘μ μμ¬μμ΄ μ§νκ² λ¨λ PRμ
λλ€.
λ¬Όλ‘ μμν κ³Όμ λ₯Ό μ νκ³ λ΅μ μ°Ύμκ°λ κ³Όμ μ΄ λ μ¦κ±°μΈ μ μκ² μ§λ§, μ‘°κΈ λ μΉμ΄ν κ³ λ―Όκ³Ό, κΉμ΄μλ μ€κ³λ₯Ό κΈ°λν©λλ€. κ·Έλμ ν΄μ€μ
¨λ λ°©μμΌλ‘ λκ°μ΄ μ½λλ₯Ό μμ±νμ€ κ²μ΄λΌλ©΄, μ°λ¦¬ κ³Όμ μ μ°Έμ¬νμλ μλ―Έλ₯Ό μ΄λ¦¬κΈ° μ΄λ ΅λ€κ³ μκ°ν©λλ€.
μ κ° μλ° μκ°μ κ°κ²λ κ·Όκ±°λ€μ νλμ© μ΄ν΄ λλ¦¬κ² μ΅λλ€.
- ν μ€νΈκ° λ무 λΉμ½ν©λλ€. κ³Όν ν μ€νΈλ λ¬Έμ μ§λ§, μ 체μ μΈ μ½λ λ³κ²½μ λΉν΄ ν μ€νΈ μ½λκ° λ무 μ κ² μΆκ°λμμ΅λλ€.
- for loop μ¬μ© λ± μλ‘μ΄ μλ보λ€λ κΈ°μ‘΄μ νλ‘κ·Έλλ°μ μ§ννμ ¨λ λ°©λ²λλ‘ μ§ννμ κ² κ°μ΅λλ€.
- κ°μ μλ£λ λΌμ΄λΈ κ°μ λ±μ ν΅ν΄μ κ°μ ν¬μΈνΈλΌκ³ μ λ¬λμλ λΆλΆλ€μ΄ λ°μλμ§ μμμ΅λλ€.
- μ κ·Ό μ μ΄μ λλ½ λ±, κΈ°λ³Έμ μΌλ‘ μ§μΌμ£Όμλ©΄ μ’μ λ²ν λ΄μ©λ€μ μ±κ²¨μ£Όμ§ μμΌμ ¨μ΅λλ€.
λ°λΌμ μλμ κ°μ μ‘μ ν¬μΈνΈ μ‘μ λλ¦¬κ² μ΅λλ€.
- for loopμ ν΅ν΄ κ°μ²΄ μν λ³κ²½νλ λ‘μ§μ λͺ¨λ stream APIμ μ¬μ©μΌλ‘ κ°μ ν΄ λ³΄μΈμ.
- μ κ·Ό μ μ΄μκ° λλ½λ λΆλΆμ λν΄μ package-privateμ μλνμλ κ² μλλΌλ©΄ λͺ¨λ μ κ·Ό μ μ΄μλ₯Ό λΆμ¬ μ£ΌμκΈ° λ°λλλ€.
- νλμ ν΄λμ€μ λν΄ νλμ ν μ€νΈ ν΄λμ€λ₯Ό 무쑰건 λκ³ , ν μ€νΈ μΌμ΄μ€ μ΅λν λμΆν΄ μ£Όμλ©΄ μ’κ² μ΅λλ€.
μ‘°κΈ λ λμ μ½λλ₯Ό κΈ°λν΄ λ³΄κ² μ΅λλ€. κ°μ¬ν©λλ€ π
private static final String HYPHEN = "-"; | ||
private static final String SPACE = " "; | ||
private static final String COLON = ":"; | ||
int currentPosition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μκΈ°μλ μ κ·Ό μ μ΄μκ° λΆμ΄μΌ ν κ² κ°μ΅λλ€. νλ λΆμ¬μ£Όμμ£ !
InputView inputView; | ||
ResultView resultView; | ||
|
||
List<Car> carList; | ||
String[] carNameList; | ||
int roundCount; | ||
Random random; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- μ κ·Ό μ μ΄μ λλ½λλ©΄ μλ©λλ€. κΌ μ±κ²¨μ£ΌμΈμ
- μ§κΈ 컨νΈλ‘€λ¬μμ λ€ κ΄λ¦¬νκ³ μλ μ λ³μλ€μ μ±κ²¨μ€
RacingGame
μ΄λΌλ ν΄λμ€λ₯Ό μ€κ³νκ³ μμ±ν΄λ³΄μΈμ. μ΄ ν΄λμ€μ κΈ°λ₯μ λ€μκ³Ό κ°μ΅λλ€.
Inputview
λ‘λΆν° νλ μ΄μ΄ μ΄λ¦ μ λ ₯λ°μ- λͺ λ² λλ¦΄κ±΄μ§ νμ°¨ μ λ ₯λ°μ
- μ€μ κ²μ μν
- νμ°¨λ³ κ²°κ³Ό κ΄λ¦¬
for (Car car : carList) { | ||
String stringCurrentPosition = car.makeStringCurrentPosition(); | ||
resultRound += stringCurrentPosition + "\n"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stream API λ‘ κ°μ ν μ μμ΅λλ€. κ°μ μλν΄λ³΄μΈμ.
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
public class RacingCarWinnerTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ν μ€νΈμ ꡬμ±μ μμ΄μ λͺ κ°μ§ ν΄λμ€λ€μ λν ν μ€νΈκ° ν ν μ€νΈ ν΄λμ€ νμΌλ‘ ν©μ³μ Έ μλλ°μ, μ건 μΌλ¨...
- ν μ€νΈ λ¨Όμ μμ±νμκ³ κ΅¬ννλ νλ¦μ κ°μ Έκ°κ³ κ³μμ§ μλ€λ κ±Έ μ μ μμ΅λλ€.
- μ΄ μμ²΄λ‘ μ½λ μ€λ©μ λλ€. ν μ€νΈλ λ©μλ λ¨μ μ€νμ΄ μλ ν΄λμ€ λ¨μ μ€νμ΄λ©΄ μ’κ² κ³ , κ° ν΄λμ€κ° μλ―Έλ¨μλ₯Ό κ°μ‘μΌλ©΄ ν©λλ€.
import java.util.Scanner; | ||
|
||
public class InputView { | ||
private Scanner scanner = new Scanner(System.in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μΈλΆμμ μ£Όμ λ°λ λ°©μμ΄λ©΄ λμ± μ’μ λ―ν©λλ€.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wheejuni 리뷰μ΄λ μΈλΆμμ μ£Όμ
λ°λ λ°©μμ΄ λ¬΄μ¨ μλ―ΈμΌκΉμ??
InputViewμμλ μ
λ ₯κ°λ§ λ°κ³ , split κ°μ μ
λ ₯ κ°μ λν λ‘μ§μ μΈλΆμμ μ²λ¦¬νλ λ°©μμ λ§μνμ κ±ΈκΉμ??
μ κ° μ΄ν΄ν κ² λ§λμ§ κΆκΈνμ¬ νμΈμ°¨ μ¬μμ΄ λ΄
λλ€^^
μ΅μ΄ ꡬν