[Step2] ๐ 2๋จ๊ณ - ์ฌ๋ค๋ฆฌ(์์ฑ)#1776
[Step2] ๐ 2๋จ๊ณ - ์ฌ๋ค๋ฆฌ(์์ฑ)#1776SimJung wants to merge 16 commits intonext-step:simjungfrom
Conversation
- ์ฌ๋ ์ด๋ฆ์ ์ผํ๋ฅผ ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถํ๋ค.
- VerticalLine ๋ฐ ์ปฌ๋ ์ ํด๋์ค ์ถ๊ฐ - HorizontalLine ๋ฐ ์ปฌ๋ ์ ํด๋์ค ์ถ๊ฐ
- view ํจํค์ง ์ถ๊ฐ
shared-moon
left a comment
There was a problem hiding this comment.
์ ๋ ์๋
ํ์ธ์!
2๋จ๊ณ ๋ฏธ์
์ ์งํ ํด ์ฃผ์
จ๋ค์ :)
์ฝ๋ฉํธ๋ฅผ ์ข ๋จ๊ฒจ ๋์๋๋ฐ, ๋ค์ ๋ฏธ์
์ ์ ์ดํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
ํ์ธ ํ ๋ฆฌ๋ทฐ ์ฌ์์ฒญ ๋ถํ๋๋ฆด๊ฒ์!
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| Players players = PlayersGenerator.create(InputView.getPlayerNames()); |
There was a problem hiding this comment.
InputView.getPlayerNames() ๋ ๋ณ์๋ก ํ๋ฒ ๋นผ๋ ๊ฑด ์ด๋จ๊น์ ?
| public static void main(String[] args) { | ||
| Players players = PlayersGenerator.create(InputView.getPlayerNames()); | ||
| int width = players.getPlayerNumber(); | ||
| System.out.println(); |
There was a problem hiding this comment.
์ค๋ฐ๊ฟ์ ๊ผญ ์ฌ๊ธฐ์ ํด ์ค์ผ ํ ๊น์ ?
| System.out.println(); | ||
|
|
||
| Ladder ladder = new LadderGenerator().generate(height, width); | ||
| ResultView.showResultMessage(); |
There was a problem hiding this comment.
์ด ์ธ ๊ฐ๋ฅผ ๋ฌถ๋ ํจ์๋ฅผ ๋ฐ๋ก ์ ๊ณตํด์ฃผ๋ ๊ฑด ์ด๋จ๊น์ ?
| @@ -0,0 +1,9 @@ | |||
| package ladder.exception; | |||
|
|
|||
| public class ContinuousHorizontalLineException extends RuntimeException { | |||
There was a problem hiding this comment.
์์ธํ ์์ธ ์ ์ธ ์ข๋ค์ ๐
| import java.util.HashSet; | ||
| import java.util.Set; | ||
|
|
||
| public class LadderGenerator { |
There was a problem hiding this comment.
์ด ํด๋์ค๋ ์ ํธ ํด๋์ค๋ก ์ ์ธ ํด ๋ณด๋ ๊ฑด ์ด๋จ๊น์ ? Strategy๋ฅผ generate์์ ๋ฐ์๋ ๋ ๊ฒ ๊ฐ์์์!
| import java.util.stream.Collectors; | ||
|
|
||
| public class HorizontalLines { | ||
| private final Set<HorizontalLine> horizontalLineSet; |
There was a problem hiding this comment.
ํน์ ์๋ฃ๊ตฌ์กฐ๋ฅผ Set์ผ๋ก ์ ํ์ ์ด์ ๊ฐ ์์๊น์ ?
| VerticalLine nowVerticalLine = verticalLines.getVerticalLineByIndex(i); | ||
| VerticalLine nextVerticalLine = verticalLines.getVerticalLineByIndex(i + 1); | ||
|
|
||
| boolean notExistPreviousHorizontalLine = sameHeightHorizontalLineHashSet.stream() |
There was a problem hiding this comment.
์ด๋ ๊ฒ ๋ค ๋น๊ตํด์ผ ํ ๊น์ ? ์ด์ฐจํผ ์์ฐจ์ฒ๋ฆฌ๋ฅผ ํ๋๊ฑฐ๋ผ๋ฉด ์ด์ ์นธ์์ ์์ฑ์ ํ๋์ง๋ง ํ์ธํ๋ฉด ๋ ๊ฒ ๊ฐ์์์!
| @@ -0,0 +1,5 @@ | |||
| package ladder.domain; | |||
|
|
|||
| public interface LadderGenerateStrategy { | |||
There was a problem hiding this comment.
์ธํฐํ์ด์ค ํ์ฉ ์ข๋ค์! ํน์ domain ํจํค์ง ๋ด๋ถ์์๋ ๊ด๊ณ์๋ ํด๋์ค๋ผ๋ฆฌ ๋ฐ๋ก ํจํค์ง ํ ์๋ ์์๊น์ ?
| } | ||
| } | ||
|
|
||
| private void checkValidLines(VerticalLines verticalLines, HorizontalLines horizontalLines) { |
There was a problem hiding this comment.
์ ์ ํจ์ฑ๊ฒ์ฌ ํน์ ๊ผญ ํ์ ํ ๊น์ ? ์์ VerticalLines์ HorizontalLines๋ฅผ ๋ง๋ค ๋ ์ด๋ฏธ ๊ฒ์ฆ ๋๊ณ ์๋ ๊ฒ ๊ฐ์์์!
|
|
||
| import java.util.Set; | ||
|
|
||
| public class Ladder { |
There was a problem hiding this comment.
์ฌ๋ค๋ฆฌ๋ฅผ ๊ฐ๋ก์ / ์ธ๋ก์ ์ ๊ฐ๋
์ผ๋ก ์ ๊ทผํ๋ฉด์ ๋ก์ง์ด ๋ง์ด ๋ณต์กํด ์ง ๊ฒ ๊ฐ์์!
์ฌ๋ค๋ฆฌ ํ์นธ ํ์นธ์ ์ ์ผ๋ก ๋ฐ๋ผ๋ณด๊ณ , ๊ฐ ์ ์์ ์ฌ๋ค๋ฆฌ์ ์ ๋ฌด๋ฅผ ํ๋จํ๋ ์์ผ๋ก ๊ฐ๋
์ ์กฐ๊ธ ๋ฐ๊พธ๋ฉด ์ฝ๊ฒ ์ ๊ทผ ํ ์ ์์ง ์์๊น์ ?
4๋ช
์ ํ๋ ์ด์ด, ๋์ด 4์ ์ฌ๋ค๋ฆฌ๋ผ๋ฉด
[x][o][x]
[o][x][o]
[o][x][o]
[x][x][o]
์ด๋ฐ์์ผ๋ก์!
์๋ ํ์ธ์.
2๋จ๊ณ - ์ฌ๋ค๋ฆฌ(์์ฑ) ๋ฏธ์ ์งํํ์ฌ PR ๋๋ฆฝ๋๋ค.
์๊ฐ๋ณด๋ค ๋์ด๋๊ฐ ์์ด ์๊ฐ์ด ์ข ๊ฑธ๋ ธ์ต๋๋ค.
๊ธฐ๋ฅ ์๊ตฌ์ฌํญ
PS.
PR ์ฌ๋ฆฌ๊ณ ๋๋ ์ด์ ์คํ ์ปค๋ฐ๊น์ง ์์ฌ์๋๊ฑธ ํ์ธํ์ต๋๋ค..
squash&merge ์ดํ ๋ก์ปฌ์์ pull๋ฐ๊ณ ์งํํ๋๋ฐ ํท๊ฐ๋ฆฌ๋ค์ ใ ใ