Conversation
added 2 commits
November 7, 2022 18:38
Contributor
|
빠르다 ... ! 👍 |
shkisme
reviewed
Nov 11, 2022
| public class Application { | ||
|
|
||
| public static void main(String[] args) { | ||
| GameController gameController = new GameController(); |
Contributor
There was a problem hiding this comment.
main이 GameController 클래스를 생성하고, 게임을 시작하는 역할만 하도록 잘 작성하신 것 같습니다! 👍
| public class RacingTool { | ||
| public static boolean isGoAhead(){ //전진할 지 여부를 반환하는 메서드 | ||
| int random= Randoms.pickNumberInRange(0, 9); | ||
| return random>=4; |
| import java.util.List; | ||
| import racingcar.Car; | ||
|
|
||
| public class TextPrinter { |
Contributor
There was a problem hiding this comment.
TextPrinter 클래스는 출력만 하도록 역할을 잘 분리하신 것 같아요👍👍 그런데 TextPrinter 클래스의 메서드들을 정적 메서드들로 설정하신 이유가 있나요?
| } | ||
|
|
||
| public int getMaxPosition() { | ||
| int max = 0, pos; |
Contributor
There was a problem hiding this comment.
저는 요새 stream 사용 연습에 몰두하는 중입니다! 스트림으로 표현했을 때 훨씬 간결해질 것 같은 메서드들이 GameController 에 많은 것 같아요! 예를 들어 getMaxPosition 메서드는 아래처럼 나타낼 수 있을 것 같습니다.
return carList.stream().map(Car::getPosition).reduce(Integer::max).get();진짜 마법같지 않나요 ?! 이번 기회에 스트림을 활용해서 메서드들을 리팩토링 해보는 것도 좋을 것 같습니다!
There was a problem hiding this comment.
added 2 commits
November 20, 2022 16:01
- RacingTool.java 포매터 적용 - TextPrinter, TextScanner 클래스 non-static 메서드로 변경
- for문 몇몇을 stream으로 구현
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
버전 설정이 잘못되어있었어서 1시간은 삽질한 것 같네요...
코드 작성하는 난이도는 제약조건까지 준수했을 때 숫자야구게임이랑 비슷한 것 같습니다.