Skip to content
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 18 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fe3ce07
docs: 오목 기능 목록 작성
tmdgh1592 Mar 14, 2023
ca4182c
feat: 1부터 15 위치를 가진 오목알 클래스 구현
tmdgh1592 Mar 14, 2023
e13e7da
feat: 중복 오목알 처리를 위한 오목알 일급 컬렉션 구현
tmdgh1592 Mar 14, 2023
fa5e2b9
docs: .gitkeep 파일 제거
tmdgh1592 Mar 14, 2023
0c398fd
feat: 오목알을 놓은 플레이어가 게임에서 이겼는지 확인하는 기능 구현
tmdgh1592 Mar 14, 2023
190d007
feat: 사용자가 오목알을 놓았을 때 상태를 반환하는 기능 구현
tmdgh1592 Mar 14, 2023
9d0c276
feat: 오목판에 돌을 올려놓는 기능 구현
tmdgh1592 Mar 15, 2023
606cfcf
feat: 플레이어의 오목알을 놓는 턴을 바꾸는 기능 구현
tmdgh1592 Mar 15, 2023
f96746e
refactor: 돌을 놓으면 새로운 상태를 가진 플레이어 반환하는 기능 구현
tmdgh1592 Mar 15, 2023
e5e8ce4
feat: 플레이어가 놓은 마지막 돌을 리턴하는 기능 구현
tmdgh1592 Mar 15, 2023
c472a31
refactor: 오목알을 놓을 수 있는지 확인하는 함수를 Players 클래스로 이동
tmdgh1592 Mar 15, 2023
f4f1b15
feat: 오목 게임 진행하는 기능 구현
tmdgh1592 Mar 15, 2023
28bb0cd
feat: 오목 게임 입력, 출력 화면 구현
tmdgh1592 Mar 15, 2023
f37f93b
feat: 오목 컨트롤러 구현
tmdgh1592 Mar 15, 2023
b1fcb5b
refactor: 도메인 패키지 분리
tmdgh1592 Mar 15, 2023
11b2666
fix: 중간에 오목알을 뒀을 때 승리 판정하지 않는 오류 수정
tmdgh1592 Mar 16, 2023
a0166e0
feat: 렌주룰 기능 추가 (미완성)
tmdgh1592 Mar 16, 2023
7eb0bc9
feat: 렌주룰 적용 (완성)
tmdgh1592 Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: 오목알을 놓을 수 있는지 확인하는 함수를 Players 클래스로 이동
  • Loading branch information
tmdgh1592 committed Mar 15, 2023
commit c472a31b87eee4ad7f741e736851314f0cf80ac2
6 changes: 1 addition & 5 deletions src/main/kotlin/Board.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ import player.Players
class Board(private val players: Players) {
constructor(blackPlayer: Player, whitePlayer: Player) : this(Players(blackPlayer, whitePlayer))

private fun canPlace(stone: Stone): Boolean = allPlayers().none { it.isPlaced(stone) }

private fun allPlayers(): List<Player> = players.toList()

fun putStone(turn: Turn, stone: Stone): Player? {
if (canPlace(stone)) {
if (players.canPlace(stone)) {
return players.putStone(turn, stone)
}
return null
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/player/Players.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Turn
class Players private constructor(private val players: Map<Turn, Player>) {
constructor(black: Player, white: Player) : this(mapOf(Turn.BLACK to black, Turn.WHITE to white))

fun toList(): List<Player> = players.values.toList()

fun putStone(turn: Turn, stone: Stone): Player? = players[turn]?.putStone(stone)

fun canPlace(stone: Stone): Boolean = players.values.none { it.isPlaced(stone) }
}