-
Notifications
You must be signed in to change notification settings - Fork 62
[사다리 - 함수형 프로그래밍] 박진형 미션 제출 #85
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
Open
jinhyeongpark
wants to merge
34
commits into
next-step:jinhyeongpark
Choose a base branch
from
jinhyeongpark:step1
base: jinhyeongpark
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
- 각 값들은 생성자를 private로 하고 정적 팩터리 메서드를 통해 검증 후 생성 - 가로 검증: 최소 두 명의 참가자가 있도록 value < 2 - 세로 검증: 1 이상의 값을 입력하도록 value < 1
- 불필요한 객체 생성을 방지하기 위해 정적 팩터리 메서드 및 캐싱 적용 - boolean 원시 값 포장 및 캡슐화
- 정적 팩터리 메서드를 통해 Point 리스트 생성 및 객체 조립 로직 구현 - 가로 라인이 겹치지 않도록 연속 생성 방지 로직 적용
- LadderWidth와 LadderHeight를 기반으로 사다리 조립 로직 구현 - List<Line>을 관리하는 일급 컬렉션 구조 설계
- 반복적으로 쓰이는 사다리 시각화 문자열에 대한 매직넘버 처리 - printLadder를 통해 각 Line들을 구현 - 각 Line은 세로줄 및 Point에 따라 가로줄 출력
- 예외 발생 시 재입력을 유도하는 공통 입력 유틸리티 메서드 구현 (Supplier 활용) - 사다리 너비 및 높이 입력 기능 구현 - 정수 입력값에 대한 기본 형식 검증 및 에러 메시지 처리
- InputView, Ladder, OutputView를 연결하여 전체 게임 흐름 제어
- 외부에서 boolean을 주입하는 strategy로 변경 - 차후 용이한 테스트코드 작성을 위함
- 우측에 여유 공간이 있고 포인트가 있으면 우로 이동 - 좌측에 여유 공간이 있고, 포인트가 있으면 좌로 이동 - 그렇지 않으면 그대로 내려오기
- climb: 각 인덱스에서 시작하여 Line을 모두 거쳐 도착지의 인덱스를 반환 - generateResults: 모든 인덱스에 대해 climb를 호출하여 그 결과를 반환
- Point를 3개로 지정하고 전략을 true로 하여 기둥이 true, false, true로 생성되게 함 - 각 기둥에서 이동하여 도착한 인덱스를 검증
- climb: 참여자를 2, 높이를 1, 전략을 true로 설정하여 교차해서 내려감을 검증 - generateResults: 참여자를 3, 높이를 1, 전략을 true로 설정하여 결과의 크기와 그 값을 검증
- 기존 LadderWidth는 사용 X - Participants를 받아 그 크기로 반복
- Name: 빈 값이거나 5글자를 넘을 수 없음 - Participants: 최소 2명이며, 이름은 중복될 수 없음
- Participants와 LadderResults를 인덱스 경로(Map)를 기준으로 매핑하는 로직 구현 - 특정 참여자의 이름을 검색하여 결과를 반환하는 기능 추가
- 'all' 입력 전까지 반복해서 결과를 조회하는 runInquiry 로직 구현 - 사용자 입력값에 따라 단일 결과 또는 전체 결과 출력 기능 연결를 반환하는 기능 추가
- 이름과 실행 결과의 가로 정렬을 위한 6칸 포매팅(%6s) 적용 - 사다리 기둥과 이름의 위치를 맞추기 위한 라인 시작 여백 처리 - 개별 결과 및 전체 결과 출력 메서드 추가
- 1~5자 사이의 이름 생성 성공 케이스 검증 - 입력값 앞뒤 공백 제거(trim) 로직 확인 - 빈 값(blank) 입력 시 예외 발생 및 메시지 검증 - 5자 초과 입력 시 예외 발생 및 메시지 검증
- 사다리 경로에 따른 결과 매핑 검증 - 존재하지 않는 이름으로 결과 조회시 예외처리 - 전체 결과 조회시 모든 결과 반환
- 2명 이상, 중복 불가에 대한 검증
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. 로또 게임 실행 흐름
-참여 인원 및 실행 결과 입력: InputView를 통해 참여자 이름과 결과 항목을 쉼표(,) 기준으로 입력받습니다. Name과 LadderResult 객체 생성 시 각각 5자 이하의 길이 제한 및 빈 값 검증을 수행.
2. 주요 클래스 설명
3. 궁금한 점