-
Notifications
You must be signed in to change notification settings - Fork 51
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
[부나] 1, 2단계 오목 제출합니다. #24
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.
Listener 방식과 UI layer를 위한 클래스를 선언한 부분이 인상깊네요 :)
몇 가지 피드백을 남겨두었으니 확인 후 다시 요청해주세요!
src/test/kotlin/Fixtures.kt
Outdated
val ONE_ONE_STONE = Stone.of(1, 1) | ||
val ONE_TWO_STONE = Stone.of(1, 2) | ||
val ONE_THREE_STONE = Stone.of(1, 3) | ||
val ONE_FOUR_STONE = Stone.of(1, 4) | ||
val ONE_FIVE_STONE = Stone.of(1, 5) | ||
val ONE_SIX_STONE = Stone.of(1, 6) | ||
val ONE_SEVEN_STONE = Stone.of(1, 7) | ||
val ONE_EIGHT_STONE = Stone.of(1, 8) | ||
val ONE_NINE_STONE = Stone.of(1, 9) | ||
val ONE_TEN_STONE = Stone.of(1, 10) |
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.
이 정도 수준의 인스턴스는 오히려 Fixture로 분리하지 않는게 더 가독성이 좋습니다.
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.
Stone.of를 반복적으로 사용하는 것이 번거로워서 Fixture를 만들어봤습니다!
혹시 토리님께서 이 정도는 Fixture로 만들어야 편하겠다
라는 기준이 있으실까요?!
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.
Fixture는 특정 테스트 환경이 여러 테스트 코드에서 여러 번 쓰일 수 있다고 판단되는 경우 분리합니다.
또는 테스트 본문에서 해당 테스트와 관련이 없는 코드의 경우에는 private 함수로 분리하거나 Fixture로 분리합니다.
테스트 본문에는 테스트하고자 하는 것을 이해할 수 있는 정보를 모두 가지고 있어야 하고, 반대로 불필요한 내용을 전부 감추어야 합니다.
- 같은 방향을 2번 확인하던 버그
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.
1, 2단계 미션 고생하셨습니다 👏👏
이번 피드백은 다음 단계에 같이 반영해주시면 됩니다.
다음 단계도 힘내세요!
src/test/kotlin/Fixtures.kt
Outdated
val ONE_ONE_STONE = Stone.of(1, 1) | ||
val ONE_TWO_STONE = Stone.of(1, 2) | ||
val ONE_THREE_STONE = Stone.of(1, 3) | ||
val ONE_FOUR_STONE = Stone.of(1, 4) | ||
val ONE_FIVE_STONE = Stone.of(1, 5) | ||
val ONE_SIX_STONE = Stone.of(1, 6) | ||
val ONE_SEVEN_STONE = Stone.of(1, 7) | ||
val ONE_EIGHT_STONE = Stone.of(1, 8) | ||
val ONE_NINE_STONE = Stone.of(1, 9) | ||
val ONE_TEN_STONE = Stone.of(1, 10) |
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.
Fixture는 특정 테스트 환경이 여러 테스트 코드에서 여러 번 쓰일 수 있다고 판단되는 경우 분리합니다.
또는 테스트 본문에서 해당 테스트와 관련이 없는 코드의 경우에는 private 함수로 분리하거나 Fixture로 분리합니다.
테스트 본문에는 테스트하고자 하는 것을 이해할 수 있는 정보를 모두 가지고 있어야 하고, 반대로 불필요한 내용을 전부 감추어야 합니다.
private val blackPositions: MutableList<Position> by lazy { | ||
mutableListOf( | ||
Position(1, 1), | ||
Position(1, 2), | ||
Position(1, 3), | ||
Position(1, 4), | ||
Position(1, 5), | ||
) | ||
} | ||
private val whitePositions: MutableList<Position> by lazy { | ||
mutableListOf( | ||
Position(3, 3), | ||
Position(3, 4), | ||
Position(3, 10), | ||
Position(5, 5), | ||
Position(6, 5), | ||
) | ||
} |
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.
lazy를 사용할 필요는 없어보입니다.
혹시 사용하신 특별한 이유가 있을까요?
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.
다시 살펴보니 해당 테스트 코드에서는 지연 초기화가 필요하지 않아 보입니다!
바로 초기화되도록 by lazy를 제거하겠습니다.
fun Position.toPresentation(): PositionModel { | ||
val row = ROW_RANGE[row + 1] | ||
val col = COLUMN_RANGE[col + 1] | ||
return PositionModel(row, col) | ||
} | ||
|
||
fun PositionModel.toDomain(): Position? { | ||
val row = ROW_RANGE.indexOf(row) | ||
val col = COLUMN_RANGE.indexOf(col) | ||
if (row == NOT_FOUND_INDEX || col == NOT_FOUND_INDEX) return null | ||
return Position(row + 1, col + 1) | ||
} |
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.
mapper를 하나의 파일로 모아주셨군요 👍️
* docs: 오목 기능 목록 작성 * feat: 1부터 15 위치를 가진 오목알 클래스 구현 * feat: 중복 오목알 처리를 위한 오목알 일급 컬렉션 구현 * docs: .gitkeep 파일 제거 * feat: 오목알을 놓은 플레이어가 게임에서 이겼는지 확인하는 기능 구현 * feat: 사용자가 오목알을 놓았을 때 상태를 반환하는 기능 구현 * feat: 오목판에 돌을 올려놓는 기능 구현 * feat: 플레이어의 오목알을 놓는 턴을 바꾸는 기능 구현 * refactor: 돌을 놓으면 새로운 상태를 가진 플레이어 반환하는 기능 구현 * feat: 플레이어가 놓은 마지막 돌을 리턴하는 기능 구현 * refactor: 오목알을 놓을 수 있는지 확인하는 함수를 Players 클래스로 이동 * feat: 오목 게임 진행하는 기능 구현 * feat: 오목 게임 입력, 출력 화면 구현 * feat: 오목 컨트롤러 구현 * refactor: 도메인 패키지 분리 * fix: 중간에 오목알을 뒀을 때 승리 판정하지 않는 오류 수정 * feat: 렌주룰 기능 추가 (미완성) * feat: 렌주룰 적용 (완성) * feat: View에 대한 인터페이스 적용 * fix: 렌주룰 버그 수정 - 같은 방향을 2번 확인하던 버그 * refactor: 사용하지 않는 클래스 제거 * refactor: Stone color mapper 클래스 구현 * refactor: 오목 결과에 대한 코드 라인 포맷팅 * refactor: Position mapper 클래스 구현 * refactor: 이웃한 Position을 찾는 기능을 Position 클래스로 이동 * refactor: 이웃한 Position을 찾는 메서드명 변경 * refactor: 파울링 여부까지 고려하여 결과를 출력하도록 변경 * refactor: 오목 클래스 메서드 분리 및 라인 포맷팅 * test: 렌주룰 테스트 코드 작성 * test: Stone 클래스 테스트 코드 작성 * test: PlayingState 클래스 테스트 코드 작성 * test: FoulState 클래스 테스트 코드 작성 * test: WinState 클래스 테스트 코드 작성 * test: 테스트 클래스 패키지 변경 * test: WhitePlayer 테스트 코드 작성 * test: BlackPlayer 테스트 코드 작성 * test: Board 테스트 코드 작성 * test: Omok 테스트 코드 작성 * refactor: 사용하지 않는 메서드 제거 * test: 오목알 Fixtures 제거
3일 안에 구현하느라 부족한게 많습니다..
혼자서도 부족한 점을 찾고 수정해보겠습니다.
현재 코드에서 렌주룰 관련 클래스 리팩토링하고 모듈화하는 작업을 해보려고 합니다.
정말 오목이라는 라이브러리를 제공한다고 생각하고 작업하도록 노력하겠습니다!