-
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단계 오목 제출합니다. #26
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fe3ce07
docs: 오목 기능 목록 작성
tmdgh1592 ca4182c
feat: 1부터 15 위치를 가진 오목알 클래스 구현
tmdgh1592 e13e7da
feat: 중복 오목알 처리를 위한 오목알 일급 컬렉션 구현
tmdgh1592 fa5e2b9
docs: .gitkeep 파일 제거
tmdgh1592 0c398fd
feat: 오목알을 놓은 플레이어가 게임에서 이겼는지 확인하는 기능 구현
tmdgh1592 190d007
feat: 사용자가 오목알을 놓았을 때 상태를 반환하는 기능 구현
tmdgh1592 9d0c276
feat: 오목판에 돌을 올려놓는 기능 구현
tmdgh1592 606cfcf
feat: 플레이어의 오목알을 놓는 턴을 바꾸는 기능 구현
tmdgh1592 f96746e
refactor: 돌을 놓으면 새로운 상태를 가진 플레이어 반환하는 기능 구현
tmdgh1592 e5e8ce4
feat: 플레이어가 놓은 마지막 돌을 리턴하는 기능 구현
tmdgh1592 c472a31
refactor: 오목알을 놓을 수 있는지 확인하는 함수를 Players 클래스로 이동
tmdgh1592 f4f1b15
feat: 오목 게임 진행하는 기능 구현
tmdgh1592 28bb0cd
feat: 오목 게임 입력, 출력 화면 구현
tmdgh1592 f37f93b
feat: 오목 컨트롤러 구현
tmdgh1592 b1fcb5b
refactor: 도메인 패키지 분리
tmdgh1592 11b2666
fix: 중간에 오목알을 뒀을 때 승리 판정하지 않는 오류 수정
tmdgh1592 a0166e0
feat: 렌주룰 기능 추가 (미완성)
tmdgh1592 7eb0bc9
feat: 렌주룰 적용 (완성)
tmdgh1592 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: 도메인 패키지 분리
- Loading branch information
commit b1fcb5bec46238b245fac02062ce0e596487fb07
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package domain.game | ||
|
||
import domain.board.Board | ||
import domain.player.BlackPlayer | ||
import domain.player.WhitePlayer | ||
import domain.stone.Stone | ||
import domain.stone.StoneColor | ||
import listener.OmokStartEndEventListener | ||
import listener.OmokTurnEventListener | ||
|
||
class Omok( | ||
private val startEndEventListener: OmokStartEndEventListener, | ||
private val turnEventListener: OmokTurnEventListener | ||
) { | ||
fun run() { | ||
startEndEventListener.onStartGame() | ||
var curStoneColor: StoneColor = StoneColor.BLACK | ||
var curBoard = Board(BlackPlayer(), WhitePlayer()) | ||
do { | ||
curBoard = takeTurn(curBoard, curStoneColor) | ||
startEndEventListener.onEndTurn(curBoard.getPlayers()) | ||
curStoneColor = curStoneColor.next() | ||
} while (curBoard.isRunning()) | ||
startEndEventListener.onEndGame(curStoneColor.next()) | ||
} | ||
|
||
private fun takeTurn(board: Board, stoneColor: StoneColor): Board { | ||
val newStone = Stone.of(turnEventListener.onTakeTurn(stoneColor)) | ||
val newBoard = board.putStone(stoneColor, newStone) | ||
if (newBoard == null) { | ||
turnEventListener.onNotPlaceable() | ||
return takeTurn(board, stoneColor) | ||
} | ||
return newBoard | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
src/main/kotlin/player/BlackPlayer.kt → src/main/kotlin/domain/player/BlackPlayer.kt
This file contains 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
10 changes: 5 additions & 5 deletions
10
src/main/kotlin/player/Player.kt → src/main/kotlin/domain/player/Player.kt
This file contains 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
This file contains 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
8 changes: 4 additions & 4 deletions
8
src/main/kotlin/player/WhitePlayer.kt → src/main/kotlin/domain/player/WhitePlayer.kt
This file contains 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
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/Position.kt → src/main/kotlin/domain/position/Position.kt
This file contains 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
8 changes: 4 additions & 4 deletions
8
src/main/kotlin/state/PlayerState.kt → src/main/kotlin/domain/state/PlayerState.kt
This file contains 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
6 changes: 3 additions & 3 deletions
6
src/main/kotlin/state/PlayingState.kt → src/main/kotlin/domain/state/PlayingState.kt
This file contains 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
6 changes: 3 additions & 3 deletions
6
src/main/kotlin/state/WinState.kt → src/main/kotlin/domain/state/WinState.kt
This file contains 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
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/Stone.kt → src/main/kotlin/domain/stone/Stone.kt
This file contains 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
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/StoneColor.kt → src/main/kotlin/domain/stone/StoneColor.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package domain.stone | ||
|
||
enum class StoneColor { | ||
BLACK, WHITE; | ||
|
||
|
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/view/BoardModel.kt → src/main/kotlin/view/model/BoardModel.kt
This file contains 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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/view/ColorModel.kt → src/main/kotlin/view/model/ColorModel.kt
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import game.Omok | ||
|
||
import org.junit.jupiter.api.Test | ||
|
||
class OmokTest { | ||
@Test | ||
fun `한 플레이어라도 승리할 때까지 차례를 번갈아가면서 돌을 놓는다`() { | ||
val omok = Omok() | ||
// val omok = Omok() | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
가급적 do, while은 사용을 지양하는면 좋습니다.
while로 표현할 수는 없을까? 를 먼저 생각 해보세요.
조건을 마지막에 확인하기 때문에 코드를 읽는데 어려움이 있고 가독성을 낮춥니다.