-
Notifications
You must be signed in to change notification settings - Fork 0
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
[전현수] - 양치기 꿍, 술래 잡기 #240
[전현수] - 양치기 꿍, 술래 잡기 #240
Conversation
|
||
data class Position(val x: Int, val y: Int) { | ||
|
||
operator fun plus(other: Position): Position { |
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.
operator function에 대해 설명해주셔서 감사했습니다!
for (i in 0 until 3) { | ||
val nextPos = tagger + (taggerDir * i) | ||
if (nextPos in treeList) continue | ||
|
||
fugitiveList.forEachIndexed { index, fug -> | ||
if (fug?.pos == nextPos) caughtFugitive.add(index) | ||
} | ||
} |
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.
- 를 활용해, 시작부터 끝까지 한 for 문 안에 담은 게 좋았어요!
val flattedBoard = board.flatten() | ||
println( | ||
"${flattedBoard.count { it == SHEEP }} ${flattedBoard.count { it == WOLF }}" | ||
) | ||
} |
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.
board 안에 SHEEP, WOLF 로 채우고 마지막에 개수를 세서 출력하는 게 저랑 달라서 좋았어요!
📌 from issue #239 📌
📋문제 목록📋
📍추가로 해결한 문제📍
📝메모
공유하고 싶은 정보, 새롭게 알게된 것, 문제를 풀면서 발생한 에로사항 등...자유롭게!