-
Notifications
You must be signed in to change notification settings - Fork 181
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
2단계 - 지뢰 찾기(지뢰 개수) #378
2단계 - 지뢰 찾기(지뢰 개수) #378
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.
현준님 안녕하세요.
피드백 반영 잘 해주셨고, 2단계도 잘 구현해 주셨네요!
추후 단계에서 고민하게 되실지도 모르지만 1, 2단계 연계를 생각했을 때도 고민해 보면 좋을 것 같은 요청을 코멘트에 남겼습니다. 확인 후 다시 리뷰 요청 부탁드릴게요!
src/main/kotlin/minesweeper/Mines.kt
Outdated
private val mines: Set<Position> | ||
) { | ||
|
||
fun nearIncrementCellNumber(board: Array<Array<Int>>): Array<Array<Int>> { |
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.
함수명은 보통 동사로 시작하니 다른 함수명처럼 통일성을 맞추면 좋을 것 같아요.
src/main/kotlin/view/Output.kt
Outdated
minesweeperBoard.toBooleanBoard() | ||
minesweeperBoard.calculateAdjacentMineCounts() | ||
.joinToString("\n") { fillingCell(it) } | ||
|
||
private fun fillingCell(row: Array<Boolean>) = | ||
row.joinToString(" ") { if (it) MINE else CELL } | ||
private fun fillingCell(row: Array<Int>) = | ||
row.joinToString(" ") { if (it < 0) MINE else it.toString() } |
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.
이런 부분에서 발생한 변경을 추후에 줄일 수 있는 방법은 어떤 것이 있을까요?
기존에 C와 *로 표시하던 것을 숫자와 *로 변경하면서 이 부분이 수정되었습니다.
여러 방법이 있을 수 있겠지만 한 가지 떠올려 보자면 MinesweeperBoard를 어떠한 방법을 통해서 잘 구성해 보면 되지 않을까요?
OCP (개방폐쇄의 원칙: Open Close Principle): 소프트웨어의 구성요소(컴포넌트, 클래스, 모듈, 함수)는 확장에는 열려있고, 변경에는 닫혀있어야 한다.
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.
GameBoard를 추상화하여 게임판을 렌더링하는 책임을 가진 클래스를 추가해봤습니다 ㅎㅎ
1. GameBoard 인터페이스 추가 2. 렌더링 책임을 가지는 CharBoard와 NumberBoard 구현체 추가 3. 게임판 요소 BoardDimensions 클래스 추가
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.
현준님 안녕하세요.
피드백 잘 반영해 주셨네요!
제가 의도한 바를 정확히 캐치하셨습니다.
3단계 미션도 잘 부탁드립니다!
안녕하세요 ㅎㅎ 2단계 리뷰도 잘 부탁드립니다!!
이전에 피드백 주셨던 부분도 수정해봤습니다
게임판을 만드는 책임들이 잘 나뉘어진건지 궁금하네요 ㅎㅎ