-
Notifications
You must be signed in to change notification settings - Fork 166
[๐ ์ฌ์ดํด1 - ๋ฏธ์ (๋ณด๋ ์ด๊ธฐํ + ๊ธฐ๋ฌผ ์ด๋)] ๋ฌํค ๋ฏธ์ ์ ์ถํฉ๋๋ค. #237
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
Open
Jiihyun
wants to merge
68
commits into
woowacourse:jiihyun
Choose a base branch
from
Jiihyun:step1
base: jiihyun
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
1e2353f
docs(README): ๊ธฐ๋ฅ ์๊ตฌ์ฌํญ ์์ฑ
MODUGGAGI 153cf04
feat: Position ์์ฑ ์ ํ,์ด ์์ธ ์ฒ๋ฆฌ ๊ตฌํ
MODUGGAGI 12fb008
feat: ํ๊ณผ ์ด ์ฐจ์ด ๊ณ์ฐ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI a6b1208
feat: ๋ณ์ ํ๋ง๋ฒ ๊ณ์ฐ ๋ก์ง ๊ตฌํ
MODUGGAGI a590747
refactor: ์์ค ์ฝ๋ ํจํค์ง๋ก ์ด๋
MODUGGAGI 85cedc8
feat: ๋ณด๋ ์ด๊ธฐํ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI 0d04301
refactor: Position VO ์ ํ
MODUGGAGI 053ccf3
feat: ์์ฐจ๋ฆผ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI c07bf10
feat: ์กธ/๋ณ ํ์ง ์์ธ ์ฒ๋ฆฌ ๊ตฌํ
MODUGGAGI 23e026f
feat: ์กธ/๋ณ ํ์ง ์์ธ ์ฒ๋ฆฌ ๊ตฌํ๊ฐ
MODUGGAGI a461255
test: ํ๋ง๋ฒ ํ
์คํธ ์ถ๊ฐ
MODUGGAGI 84cf947
feat: ์ฐจ ํ๋ง๋ฒ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI c8f9421
docs: ๊ตฌํํ ๊ธฐ๋ฅ ์๋ฃ ์ฒ๋ฆฌ
MODUGGAGI 4df7f3d
refactor: ์ ๋ต ์ด๋ฆ ์์
MODUGGAGI 462827a
refactor: ๊ฒฝ๋ก ์์ฑ ๋ก์ง ์ต์ ํ
MODUGGAGI 99c17c1
refactor: ํ
์คํธ ๋ฉ์๋ ์ด๋ฆ ์์
MODUGGAGI d78aef3
feat: ์ฐจ,ํฌ ์ ์๋ฆฌ ์ด๋ ์์ธ ์ถ๊ฐ
MODUGGAGI b3b9198
feat: ๋ง ์ด๋ ๊ตฌํ
MODUGGAGI f92203f
feat: ์ ํ๋ง๋ฒ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI 3f62291
refactor: DirectionInformation ๊ฐ ๊ฐ์ฒด ์ ์ฉ
MODUGGAGI 49914a9
refactor: DirectionInformation ๊ฐ ๊ฐ์ฒด ์ ์ฉ
MODUGGAGI dfb2afe
refactor: ํด๋์ค ์ด๋ฆ PieceRule๋ก ๋ณ๊ฒฝ
MODUGGAGI 7ef3df4
refactor: ์์ฑ์์์ MoveStrategy ์ ๊ฑฐ
MODUGGAGI d8fa73b
feat: ๊ฒฝ๋ก ์ ๊ธฐ๋ฌผ์ด ์์ด์ผ ์ด๋ํ ์ ์๋ ์กฐ๊ฑด ํ์ธ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI 74efd5a
feat: ๊ฒฝ๋ก ์ ๊ธฐ๋ฌผ์ด 1๊ฐ ์์ด์ผ ์ด๋ํ ์ ์๋ ์กฐ๊ฑด ํ์ธ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI 4fe8ab9
refactor: MoveCondition ๋งค๊ฐ๋ณ์ ์ถ๊ฐ
MODUGGAGI 0eabf55
feat: MoveCondition ์ถ๊ฐ
MODUGGAGI 5445082
feat: ๊ธฐ๋ฌผ ์ด๋ ๊ฒ์ฆ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI dc41b10
feat: ๋ณด๋ ๊ธฐ๋ฌผ ์ด๋ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI a13c511
refactor: ์์ฐจ๋ฆผ ๋ก์ง ์์
MODUGGAGI b83e12e
feat: ์์ฐจ๋ฆผ ์
๋ ฅ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI f5172e3
feat: ์ฅ๊ธฐ ์
์ถ๋ ฅ ๊ธฐ๋ฅ ๊ตฌํ
MODUGGAGI 7a76925
feat: ์์ธ ๋ฉ์์ง ๋ฐ ๋งค์ง ๋๋ฒ ์์ ์ฒ๋ฆฌ
MODUGGAGI f4e38f4
test: ํ์ ํ
์คํธ ์ถ๊ฐ
MODUGGAGI 9df0ca5
refactor: ์์ธ ๋ฉ์์ง ์์ ๋ณ๊ฒฝ
MODUGGAGI a4adc92
refactor: ์ถ๋ฐ์ง, ๋ชฉ์ ์ง ๋ณ์๋ช
๋ณ๊ฒฝ
MODUGGAGI 0834056
docs: ๊ธฐ๋ฅ ๊ตฌํ ์๋ฃ ์ฒ๋ฆฌ
MODUGGAGI 9bafbe4
refactor: ์ถ๋ ฅ ํ์ ์์
MODUGGAGI db55fcf
feat: ์ฌ์๋ ๋ก์ง ๋ฐ ์์ธ ์ฒ๋ฆฌ ์ถ๊ฐ
MODUGGAGI 2dbdde9
refactor: ์๋ฃํ TODO ์ ๊ฑฐ
MODUGGAGI ebecb3e
refactor: View์ CampDto ์ ์ฉ
MODUGGAGI ef036ce
refactor: ์ง์ ์ด๋ฆ ์์ ์ฒ๋ฆฌ
MODUGGAGI 01783c9
feat: ํ๋ ์ด์ด ํด ์ ์ฉ ๊ฐ ๊ฐ์ฒด ์ถ๊ฐ
MODUGGAGI 425b7a3
refactor: ํด ์งํ ๋ฐํํ์
void๋ก ๋ณ๊ฒฝ
Jiihyun 9c0501d
refactor: ๊ณต๋ฐฑ ์ถ๊ฐ
Jiihyun 766e481
refactor: PieceFormatter์ CampFormatter enum์ผ๋ก ๋ณ๊ฒฝ ๋ฐ switch๋ฌธ ์ ๊ฑฐ
Jiihyun 024b08b
refactor: InitialPiecePlacement ์ธ์คํด์ค ๋ณ์ ์ถ์
Jiihyun 53d93d6
test: Turn ํ
์คํธ ์ถ๊ฐ
Jiihyun cd30819
test: ElephantSetting ํ
์คํธ ์ถ๊ฐ
Jiihyun c8ebd7f
test: DirectionInformation ํ
์คํธ ์ถ๊ฐ
Jiihyun 38f9425
test: Camp ํ
์คํธ ์ถ๊ฐ
Jiihyun 6ef4515
test: HorseStrategy ํ
์คํธ ์ถ๊ฐ
Jiihyun e60c9e6
refactor: EmptyConditionTestBoardInitializer ์ ๊ฑฐ
Jiihyun da6cd23
refactor: OnePieceExistsCondition ํ
์คํธ์ด๋ฆ ์ถ์ํ
Jiihyun 6325339
refactor: ElephantStrategyTest ๋ด ๋ถํ์ํ ํ
์คํธ ๋งค๊ฐ๋ณ์ ์ ๊ฑฐ
Jiihyun 69e6abb
refactor: MultiStepStraightStrategyTest, SingleStepStraightStrategyTeโฆ
Jiihyun 12a3328
refactor: PieceTest ๋ด ํ
์คํธ๋ช
๋ณ๊ฒฝ
Jiihyun 70cab43
refactor: GameRule ์์ ํด๋์ค ์ ๊ฑฐ
Jiihyun 423ea0f
refactor: ๋ณด๋ ์ด๊ธฐํ ์ ์์ฐจ๋ฆผ ํ์
๋ณ๊ฒฝ
Jiihyun ba43328
refactor: ํ๋ง๋ฒ ์ ๋ต ์ถ์ํ ๋ ๋ฒจ ๋ง๋๋ก ๋ณ๊ฒฝ
Jiihyun c4d4de5
refactor: BoardInitializer ํด๋์ค ์ญ์
Jiihyun 038079b
refactor: elephantSetUpFormat์์ ElephantFormation ์์ฑํ๋๋ก ๋ณ๊ฒฝ
Jiihyun 121f2b8
refactor: CampDto ์ ๊ฑฐ
Jiihyun 2b06742
refactor: ์ถ๋ฐ์ง, ๋ชฉ์ ์ง ๊ฒ์ฆ ์์น ๋ณ๊ฒฝ
Jiihyun d8188fc
refactor: ์ด๋ ๊ฑฐ๋ฆฌ ๊ตฌํ๋ ๋ก์ง ๋ถ๋ฆฌ
Jiihyun 619d82b
refactor: ์ด๋ ์ ๋ต ๋ฉ์๋ ๋ถ๋ฆฌ
Jiihyun 5518268
refactor: ํ๋ง๋ฒ ์ ๋ต ์ถ์ํ ์์ค ๋์ผํ๊ฒ ๋ณ๊ฒฝ
Jiihyun e1138ec
refactor: Position format ํ
์คํธ ์ถ๊ฐ
Jiihyun 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,195 @@ | ||
| # java-janggi | ||
|
|
||
| ์ฅ๊ธฐ ๋ฏธ์ ์ ์ฅ์ | ||
| > ์ฅ๊ธฐ ๋ฏธ์ ์ ์ฅ์ | ||
|
|
||
| ํ์ด : [์คํํฌ](https://github.com/MODUGGAGI), [๋ฌํค](https://github.com/Jiihyun) | ||
|
|
||
| --- | ||
|
|
||
| ## ๐ฅ ํ์ด ํ๋ก๊ทธ๋๋ฐ ๊ท์น | ||
|
|
||
| ๋ค๋น๊ฒ์ดํฐ, ๋๋ผ์ด๋ฒ ์ญํ ๊ตํ์ **15๋ถ**์ ํ๋ฒ์ฉ | ||
|
|
||
| | **๋ค๋น๊ฒ์ดํฐ** | **๋๋ผ์ด๋ฒ** | | ||
| |:---------------------------:|:------------------------------:| | ||
| | ๋๋ผ์ด๋ฒ์๊ฒ ์ง์์ ๋์์ ์๋ก์ ๋ํ ๋ด์ฉ ๊ธฐ๋ก | ์์ ์ด ์์ฑํ๋ ค๋ ์ฝ๋์ ์๋๋ฅผ ํญ์ ๋ช ํํ ๋ง๋ก ์ ๋ฌ | | ||
|
|
||
| --- | ||
|
|
||
| ## ๐๏ธ ๊ตฌํ ๊ธฐ๋ฅ ๋ชฉ๋ก | ||
|
|
||
| ## โ ์ ๋ ฅ | ||
|
|
||
| - [x] ๊ฒ์ ์์ ์ ์์ฐจ๋ฆผ ์ ๋ ฅ ๋ฐ๊ธฐ | ||
| - [x] ์ง์ ๋ ๋ช ๋ น์ด ์ด์ธ์ ๋ฌธ์์ด ๋ฐ ์ซ์ ๊ฐ์ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [x] ํ๋ ์ด์ด์ ์ ํ ๊ธฐ๋ฌผ ์ขํ ์ ๋ ฅ | ||
| - [x] ๊ณต๋ฐฑ์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ์ซ์๊ฐ ์๋ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ๊ตฌ๋ถ์๊ฐ `,`๊ฐ ์๋ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [x] ํ๋ ์ด์ด์ ๋ชฉํ ์ขํ ์ ๋ ฅ | ||
| - [x] ๊ณต๋ฐฑ์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ์ซ์๊ฐ ์๋ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ๊ตฌ๋ถ์๊ฐ `,`๊ฐ ์๋ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| ## โ ์ถ๋ ฅ | ||
|
|
||
| - [x] ์ฅ๊ธฐํ ์ถ๋ ฅ | ||
| - ์์ฐจ๋ฆผ ์ ํ ํ | ||
| - ๋ชฉํ ์ขํ ์ ๋ ฅ ํ | ||
| - [x] ํ์ฌ ์ฐจ๋ก์ธ ๋๋ผ ์ถ๋ ฅ | ||
| - ใํใ, ใ์ดใ | ||
|
|
||
| ## โ ๋น์ง๋์ค ๊ธฐ๋ฅ | ||
|
|
||
| ### ๋ณด๋ ์ด๊ธฐํ | ||
|
|
||
| - [x] ใํใ ์์ฐจ๋ฆผ | ||
| - [x] ใ์ดใ ์์ฐจ๋ฆผ | ||
|
|
||
| ```text | ||
| - ์ข์ธก ์๋จ์ 0ํ 0์ด ์ด๋ผ ๊ฐ์ | ||
|
|
||
| ์ฅ*1๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 1ํ 4์ด | ||
| - ์ด๋๋ผ: 8ํ 4์ด | ||
|
|
||
| ์ฌ*2๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 0ํ 3์ด, 0ํ 5์ด | ||
| - ์ด๋๋ผ: 9ํ 3์ด, 9ํ 5์ด | ||
|
|
||
| ์ฐจ*2๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 0ํ 0์ด, 0ํ 8์ด | ||
| - ์ด๋๋ผ: 9ํ 0์ด, 9ํ 8์ด | ||
|
|
||
| ํฌ*2๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 2ํ 1์ด, 2ํ 7์ด | ||
| - ์ด๋๋ผ: 7ํ 1์ด, 7ํ 7์ด | ||
|
|
||
| ๋ง*2๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 0ํ 2์ด, 0ํ 7์ด | ||
| - ์ด๋๋ผ: 9ํ 2์ด, 9ํ 7์ด | ||
|
|
||
| ์*2๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 0ํ 1์ด, 0ํ 6์ด | ||
| - ์ด๋๋ผ: 9ํ 1์ด, 9ํ 6์ด | ||
|
|
||
| ์กธ*5๊ฐ | ||
| ์์ ์์น | ||
| - ํ๋๋ผ: 3ํ 0์ด, 3ํ 2์ด, 3ํ 4์ด, 3ํ 6์ด, 3ํ 8์ด | ||
| - ์ด๋๋ผ: 6ํ 0์ด, 6ํ 2์ด, 6ํ 4์ด, 6ํ 6์ด, 6ํ 8์ด | ||
| ``` | ||
|
|
||
| ### ๊ธฐ๋ฌผ ์ด๋ | ||
|
|
||
| - [x] ์ด๋ ์ํค๋ ค๋ ๊ธฐ๋ฌผ์ ์ขํ๋ฅผ ํ์ธํ๋ค. | ||
| - [x] ์ขํ๊ฐ ์ฅ๊ธฐํ ๋ฒ์ ๋ฒ์ด๋ ์ขํ์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ์ขํ์ ๊ธฐ๋ฌผ์ด ์กด์ฌ ํ์ง ์์ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ์ขํ์ ๊ธฐ๋ฌผ์ด ์์ ์ ์ง์์ด ์๋ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [x] ๊ธฐ๋ฌผ์ ๋ชฉ์ ์ง ์ขํ๋ก ์ด๋ํ๋ค. | ||
| - [x] ๋ชฉ์ ์ง ์ขํ๊ฐ ์ฅ๊ธฐํ ๋ฒ์ ๋ฒ์ด๋ ์ขํ์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ๊ธฐ๋ฌผ ๊ท์น ๋ฐ ์ ์ฝ์ ๋ง๊ฒ ์ด๋ํ๋ค. | ||
| - [์ฐจ(่ป)] | ||
| - [x] ์ํ์ข์ฐ๋ก ์ฅ์ ๋ฌผ์ ๋ง๋ ๋๊น์ง ์นธ ์ ์ ํ ์์ด ์ด๋ํ๋ค. | ||
| - [x] ์ด๋ํ๋ ค๋ ๊ฒฝ๋ก ์ค๊ฐ์ ๋ค๋ฅธ ๊ธฐ๋ฌผ์ด **์**๋ค๋ฉด `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [ํฌ(ๅ )] | ||
| - [x] ์ํ์ข์ฐ๋ก ์ด๋ํ๋, ๋ฐ๋์ ์ค๊ฐ์ ๋ค๋ฅธ ๊ธฐ๋ฌผ์ ํ๋ ๋ฐ์ด๋์ด์ผ ํฉ๋๋ค. | ||
| - [x] ์ด๋ํ๋ ค๋ ๊ฒฝ๋ก ์ค๊ฐ์ ๋ค๋ฅธ ๊ธฐ๋ฌผ์ด **์**๋ค๋ฉด `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ๋์ผ๋ ค๋ ๊ธฐ๋ฌผ์ด ํฌ(ๅ ) ์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
| - [x] ๋ชฉ์ ์ง ์ขํ์ ๊ธฐ๋ฌผ์ด ํฌ(ๅ )์ผ ๊ฒฝ์ฐ `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [๋ง(้ฆฌ)] | ||
| - [x] ์ง์ 1์นธ + ๋๊ฐ์ 1์นธ(ๆฅ) ์ด๋ํ๋ค. | ||
| - [x] ๋ชฉ์ ์ง ์ขํ(์ง์ 1์นธ ๋๋ ๋๊ฐ์ 1์นธ)์ ๋ค๋ฅธ ๊ธฐ๋ฌผ์ด ์์ผ๋ฉด `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [์(่ฑก)] | ||
| - [x] ์ง์ 1์นธ + ๋๊ฐ์ 2์นธ(็จ) ์ด๋ํ๋ค. | ||
| - [x] ๋ชฉ์ ์ง ์ขํ(์ง์ 1์นธ ๋๋ ๋๊ฐ์ 1์นธ)์ ๋ค๋ฅธ ๊ธฐ๋ฌผ์ด ์์ผ๋ฉด `IllegalArgumentException`์ ๋ฐ์์ํจ๋ค. | ||
|
|
||
| - [๊ถ(ๆฅ/ๆผข), ์ฌ(ๅฃซ)] | ||
| - [x] ์ํ์ข์ฐ ์ง์ 1์นธ ์ด๋ํ๋ค. | ||
|
|
||
| - [์กธ/๋ณ(ๅ/ๅ ต)] | ||
| - [x] ์์ข์ฐ ์ง์ 1์นธ ์ด๋ํ๋ค. ํ์ง์ ๋ถ๊ฐ ์ฃผ์ | ||
|
|
||
| --- | ||
|
|
||
| ## ๐ป ์คํ ๊ฒฐ๊ณผ | ||
|
|
||
| ```text | ||
| 1. ์๋ง์๋ง | ||
| 2. ๋ง์๋ง์ | ||
| 3. ๋ง์์๋ง | ||
| 4. ์๋ง๋ง์ | ||
| ํ๋๋ผ์ ์์ฐจ๋ฆผ์ ์ ํํด์ฃผ์ธ์. | ||
| 1 | ||
|
|
||
| 1. ์๋ง์๋ง | ||
| 2. ๋ง์๋ง์ | ||
| 3. ๋ง์์๋ง | ||
| 4. ์๋ง๋ง์ | ||
| ์ด๋๋ผ์ ์์ฐจ๋ฆผ์ ์ ํํด์ฃผ์ธ์. | ||
| 3 | ||
|
|
||
| [์ฅ๊ธฐํ] | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ่ป ้ฆฌ ่ฑก ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๆฅ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๆผข ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ่ป ่ฑก ้ฆฌ ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
|
|
||
| ์ด๋๋ผ ์ฐจ๋ก ์ ๋๋ค. | ||
| ๊ณต๊ฒฉํ ๊ธฐ๋ฌผ์ ์ขํ๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์. | ||
| 3,0 | ||
|
|
||
| ์ด๋ ์ํฌ ๋ชฉ์ ์ง ์ขํ๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์. | ||
| 4,0 | ||
|
|
||
| [์ฅ๊ธฐํ] | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ่ป ้ฆฌ ่ฑก ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๆฅ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ | ||
| ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๆผข ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ่ป ่ฑก ้ฆฌ ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
|
|
||
| ํ๋๋ผ ์ฐจ๋ก ์ ๋๋ค. | ||
| ๊ณต๊ฒฉํ ๊ธฐ๋ฌผ์ ์ขํ๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์. | ||
| 9,0 | ||
|
|
||
| ์ด๋ ์ํฌ ๋ชฉ์ ์ง ์ขํ๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์. | ||
| 8,0 | ||
|
|
||
| [์ฅ๊ธฐํ] | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ่ป ้ฆฌ ่ฑก ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๆฅ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ ๏ผ ๅ | ||
| ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต ๏ผ ๅ ต | ||
| ๏ผ ๏ผ ๅ ๏ผ ๏ผ ๏ผ ๏ผ ๏ผ ๅ ๏ผ | ||
| ๏ผ ่ป ๏ผ ๏ผ ๏ผ ๆผข ๏ผ ๏ผ ๏ผ ๏ผ | ||
| ๏ผ ๏ผ ่ฑก ้ฆฌ ๅฃซ ๏ผ ๅฃซ ่ฑก ้ฆฌ ่ป | ||
| ``` |
This file contains hidden or 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,8 @@ | ||
| package janggi; | ||
|
|
||
| public class JanggiApplication { | ||
| public static void main(String[] args) { | ||
| JanggiGame game = new JanggiGame(); | ||
| game.run(); | ||
| } | ||
| } |
This file contains hidden or 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,76 @@ | ||
| package janggi; | ||
|
|
||
| import janggi.domain.Position; | ||
| import janggi.domain.Turn; | ||
| import janggi.domain.board.Board; | ||
| import janggi.domain.board.ElephantFormation; | ||
| import janggi.domain.board.InitialPiecePlacement; | ||
| import janggi.domain.piece.Camp; | ||
| import janggi.domain.piece.Piece; | ||
| import janggi.dto.PiecePositionDto; | ||
| import janggi.util.RetryHandler; | ||
| import janggi.view.InputView; | ||
| import janggi.view.OutputView; | ||
| import janggi.view.format.ElephantSetUpFormat; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| public class JanggiGame { | ||
|
|
||
| public void run() { | ||
| Board board = createBoard(); | ||
| OutputView.printBoard(toPiecePositions(board.getBoard())); | ||
| play(board); | ||
| } | ||
|
|
||
| private Board createBoard() { | ||
| ElephantFormation hanElephantFormation = readElephantFormation(Camp.HAN); | ||
| ElephantFormation choElephantFormation = readElephantFormation(Camp.CHO); | ||
| return InitialPiecePlacement.initialize(hanElephantFormation, choElephantFormation); | ||
| } | ||
|
|
||
| private ElephantFormation readElephantFormation(Camp camp) { | ||
| return RetryHandler.retryOnInvalidInput(() -> { | ||
| ElephantSetUpFormat elephantSetUpFormat = InputView.readElephantSettingCommand(camp); | ||
| return elephantSetUpFormat.toElephantFormation(camp); | ||
| }); | ||
| } | ||
|
|
||
| private List<PiecePositionDto> toPiecePositions(Map<Position, Piece> boardState) { | ||
| return boardState.entrySet().stream() | ||
| .map(entry -> PiecePositionDto.of(entry.getKey(), entry.getValue())) | ||
| .toList(); | ||
| } | ||
|
|
||
| private void play(Board board) { | ||
| Turn turn = new Turn(); | ||
| while (true) { | ||
| RetryHandler.retryOnInvalidInput(() -> playTurn(board, turn)); | ||
| OutputView.printBoard(toPiecePositions(board.getBoard())); | ||
| } | ||
| } | ||
|
|
||
| private void playTurn(Board board, Turn turn) { | ||
| Camp camp = turn.currentTurn(); | ||
| Position source = readSource(board, camp); | ||
| Position destination = readDestination(board, source, camp); | ||
| board.movePiece(source, destination, camp); | ||
| turn.finishTurn(); | ||
| } | ||
|
|
||
| private Position readSource(Board board, Camp camp) { | ||
| return RetryHandler.retryOnInvalidInput(() -> { | ||
| Position source = Position.from(InputView.readSource(camp)); | ||
| board.validateSource(source, camp); | ||
| return source; | ||
| }); | ||
| } | ||
|
|
||
| private Position readDestination(Board board, Position source, Camp camp) { | ||
| return RetryHandler.retryOnInvalidInput(() -> { | ||
| Position destination = Position.from(InputView.readDestination()); | ||
| board.validateDestination(destination, source, camp); | ||
| return destination; | ||
| }); | ||
| } | ||
| } |
This file contains hidden or 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,60 @@ | ||
| package janggi.domain; | ||
|
|
||
| import janggi.exception.ExceptionMessage; | ||
| import java.util.List; | ||
|
|
||
| public record Position(int row, int column) { | ||
|
|
||
| private static final int POSITION_SIZE = 2; | ||
| private static final int MIN_POSITION_INDEX = 0; | ||
| private static final int MAX_ROW_INDEX = 9; | ||
| private static final int MAX_COLUMN_INDEX = 8; | ||
|
|
||
| public static Position from(List<Integer> rawPosition) { | ||
| validatePositionSize(rawPosition); | ||
| return new Position(rawPosition.get(0), rawPosition.get(1)); | ||
| } | ||
|
|
||
| private static void validatePositionSize(List<Integer> position) { | ||
| if (position.size() != POSITION_SIZE) { | ||
| throw new IllegalArgumentException(ExceptionMessage.INVALID_INPUT_FORMAT.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| public Position { | ||
| validateRow(row); | ||
| validateColumn(column); | ||
| } | ||
|
|
||
| private void validateRow(int row) { | ||
| if (row < MIN_POSITION_INDEX || MAX_ROW_INDEX < row) { | ||
| throw new IllegalArgumentException(ExceptionMessage.ROW_OUT_OF_RANGE.getMessage(MIN_POSITION_INDEX, MAX_ROW_INDEX)); | ||
| } | ||
| } | ||
|
|
||
| private void validateColumn(int column) { | ||
| if (column < MIN_POSITION_INDEX || MAX_COLUMN_INDEX < column) { | ||
| throw new IllegalArgumentException(ExceptionMessage.COLUMN_OUT_OF_RANGE.getMessage(MIN_POSITION_INDEX, MAX_COLUMN_INDEX)); | ||
| } | ||
| } | ||
|
|
||
| public int calculateRowDistance(Position other) { | ||
| return row - other.row; | ||
| } | ||
|
|
||
| public int calculateColumnDistance(Position other) { | ||
| return column - other.column; | ||
| } | ||
|
|
||
| public Position moveRow(int distance) { | ||
| return new Position(row + distance, column); | ||
| } | ||
|
|
||
| public Position moveCol(int distance) { | ||
| return new Position(row, column + distance); | ||
| } | ||
|
|
||
| public Position moveDiagonal(int rowDistance, int colDistance) { | ||
| return new Position(row + rowDistance, column + colDistance); | ||
| } | ||
| } | ||
This file contains hidden or 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,16 @@ | ||
| package janggi.domain; | ||
|
|
||
| import janggi.domain.piece.Camp; | ||
|
|
||
| public class Turn { | ||
|
|
||
| private Camp currentCamp = Camp.CHO; | ||
|
|
||
| public Camp currentTurn() { | ||
| return currentCamp; | ||
| } | ||
|
|
||
| public void finishTurn() { | ||
| currentCamp = currentCamp.next(); | ||
| } | ||
| } |
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.
Position์ ์์ฑํ ๋ size๋ฅผ ๊ฒ์ฆํ๋ ํ ์คํธ๊ฐ ์๋ค์~
Uh oh!
There was an error while loading. Please reload this page.
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.
์ถ๊ฐํ์์ต๋๋ค!!
refactor: Position format ํ ์คํธ ์ถ๊ฐ
Uh oh!
There was an error while loading. Please reload this page.
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.
์ ์์ ์ผ๋ก ์์ฑํ๋ ํ ์คํธ ์ผ์ด์ค๋ ์๋ค์~