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

Lmh - 사다리 게임 리팩토링 #7

Open
wants to merge 4 commits into
base: lmh
Choose a base branch
from
Open

Conversation

Gobukgol
Copy link

@Gobukgol Gobukgol commented May 8, 2019

No description provided.

Gobukgol added 4 commits May 5, 2019 15:08
2. LadderGame 위치 변경 및 HashMap에서 Map으로 변경
3. 플레이어 수와 결과 수 validation 체크 로직 추가
4. GameResultDto 에서 GameInformationDto를 멤버변수로 가지고있지 않게 변경
5. 함수 static으로 변경 및 함수 분리

public LadderGame(GameInformationDto gameInformationDto) {
this.gameInformationDto = gameInformationDto;
ladder = LadderGenerator.generate(gameInformationDto.getLadderHeight(),gameInformationDto.getPlayers().size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분 파라미터를 gameInfomationDto를 넘기면 좀더 보기 편하고 파라미터 갯수도 줄일수 있지않을까

List<User> userList = gameInformationDto.getPlayers();
List<ExecuteResult> executeResults = gameInformationDto.getExecuteResult();

Map<User, ExecuteResult> userPlayResult = getUserPlayResult(userList,executeResults);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 그냥 gameInformationDto를 넘기면 안되나??? 그러면 오히려 더 복잡해지나???


for(int i = 1 ; i < playerNum - 1; i++){
Point previous = points.get(i-1);
points.add(PointGenerator.generateNormalPoint(i+1,previous));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나는 이렇게 리스트에 add 하는 작업을 따로 하나의 메소드로 빼는게 더 읽기 좋은거같아
예를 들어서 지금 이 함수 첫줄에 add 하는거를 addFirstPoint 이런식으로 메소드 하나 만드는 것 처럼!

List<Bridge> bridges = new ArrayList<>();

for(int i = 0 ; i < ladderHeight ; i++){
BridgeGenerator bridgeGenerator = new BridgeGenerator();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 매번 생성할 필요없지 않아?????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants