-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Step2]: ๐ 2๋จ๊ณ - ์ง๋ขฐ ์ฐพ๊ธฐ(์ง๋ขฐ ๊ฐ์) #414
base: dlwnsgus777
Are you sure you want to change the base?
Conversation
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.
์๋
ํ์ธ์ ์คํ๋!
2๋จ๊ณ ๊ณ ์ํ์
จ์ต๋๋ค,
๋ช๊ฐ์ง ์ฝ๋ฉํธ ๋จ๊ฒผ์ผ๋, ํ์ธํด์ฃผ์ธ์ :)
if (minePositions.contains(position)) return Mine() | ||
return NormalPedal() |
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.
if (minePositions.contains(position)) return Mine() | |
return NormalPedal() | |
if (minePositions.contains(position)) Mine() else NormalPedal() |
๋ ๊ฐ๋จํ ์ฌ์ฉํด๋ณด์์!
} | ||
|
||
companion object { | ||
private const val VALID_MESSAGE: String = "์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค." |
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.
๊ตฌ์ฒด์ ์ผ๋ก ์ด๋ค ์๋ฌ์ธ์ง ํ๊ธฐํ๋ฉด ์ด๋จ๊น์?
return (x - 1..x + 1).flatMap { xVal -> | ||
(y - 1..y + 1).map { yVal -> Position(xVal, yVal) } |
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.
x - 1, x - 1, y+1,y-1 ๋ฑ์ด ๋ฌด์์ ์๋ฏธํ ๊น์?
๋ฐ๋ก ๊ฐ์ฒด๋ฅผ ๊ด๋ฆฌํด๋ณด๋ฉด ์ด๋จ๊น์?
@@ -1,3 +1,6 @@ | |||
package mineswipper.domain.map | |||
|
|||
class Mine : Pedal | |||
class Mine( | |||
override var mark: Mark? = Mark("*") |
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.
var ๋ก ์ ์ํ ์ด์ ๊ฐ ์์๊น์?
์ธ๋ถ์์ ์ฝ๊ฒ ๋ณ๊ฒฝ์ด ๊ฐ๋ฅํ ๊ตฌ์กฐ๋ค์!
var mark: Mark? |
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.
nullable ๋ณ์๋ก ์ ์ ํ ์ด์ ๊ฐ ์์๊น์?
๋ ๋ถ๋ณ๊ฐ์ฒด๋ก ๋ง๋ค์ด๋ณด๋๊ฑด ์ด๋จ๊น์?
|
||
} | ||
|
||
fun List<Position>.toPositions(): Positions = Positions(this) |
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.
์ค์ ์ต์
์ ํ์ฑํํ์ฌ EOF ๊ฒฝ๊ณ ๋ฅผ ์์ ์ฃผ์๋ฉด ์ข์๊ฑฐ๊ฐ์์!
(File > Preferences > Editor > General > Ensure every saved file ends with a line break )
val pedals = field[position.toRow()] | ||
require(pedals != null) { VALID_MESSAGE } | ||
|
||
val pedal = pedals.get(position.x) |
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.x ์ ํด๋นํ๋ ๊ฐ์ด ์์ผ๋ฉด ์ด๋ค์ผ์ด ์ผ์ด๋ ๊น์/
@@ -22,6 +23,8 @@ class MineGame( | |||
positionFactory.generateMinePositions(size, mine) | |||
) | |||
|
|||
MarkGenerator.markGeneration(field) |
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.
ํ๋ผ๋ฏธํฐ๋ก ์ ๋ฌ๋ field๊ฐ MarkGenerator๋ด๋ถ์์ ๋ณ๊ฒฝ์ด ๋๋ค์!
markGeneration๋ฅผ ํตํด field๊ฐ ๋ณ๊ฒฝ๋ ์ ์๋ค๋ ์ ์ ์๊ฐํ ์ ์์๊น์?
๊ณ ๋ฏผํด๋ณด๋ฉด ์ข์๊ฑฐ๊ฐ์์!
@@ -22,6 +23,8 @@ class MineGame( | |||
positionFactory.generateMinePositions(size, mine) | |||
) | |||
|
|||
MarkGenerator.markGeneration(field) | |||
|
|||
outputManager.printStartGame() | |||
outputManager.printField(field) | |||
} |
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.
MineGame์ ์ฌ์ค์ Controller ์ญํ ์ ํด์ฃผ๊ณ ์์ด์,
Controller์ View์์ ์ํธ์์ฉ์ ์ฑ
์์ ๊ฐ์ก๋ค๊ณ ์๊ฐ์ด ๋ค์ด์,
๊ทธ๋ ๋ค๋ฉด MineGame๋ด์์, ์ง๋ขฐ๋ฅผ ์์ฑํ๊ณ , markํ๋ ๋น์ฆ๋์ค๋ก์ง์ ๋ถ๋ฆฌํด๋ณด๋ฉด ์ด๋จ๊น์?
์๋ ํ์ธ์ ๋ฆฌ๋ทฐ์ด๋!!
๊ฐ์ ์ข ๋ฃ ํ์๋ ๋ฆฌ๋ทฐํด์ฃผ์ ๋ค๋ ๊ทธ์ ๊ฐ์ฌํ ๋ฐ๋ฆ์ ๋๋ค ๐
์ด๋ฒ 2๋จ๊ณ ๋ฆฌ๋ทฐ๋ ์ ๋ถํ๋๋ฆฝ๋๋ค!!!