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

[Step2]: ๐Ÿš€ 2๋‹จ๊ณ„ - ์ง€๋ขฐ ์ฐพ๊ธฐ(์ง€๋ขฐ ๊ฐœ์ˆ˜) #414

Open
wants to merge 22 commits into
base: dlwnsgus777
Choose a base branch
from

Conversation

dlwnsgus777
Copy link

์•ˆ๋…•ํ•˜์„ธ์š” ๋ฆฌ๋ทฐ์–ด๋‹˜!!
๊ฐ•์˜ ์ข…๋ฃŒ ํ›„์—๋„ ๋ฆฌ๋ทฐํ•ด์ฃผ์‹ ๋‹ค๋‹ˆ ๊ทธ์ € ๊ฐ์‚ฌํ•  ๋”ฐ๋ฆ„์ž…๋‹ˆ๋‹ค ๐Ÿ™

์ด๋ฒˆ 2๋‹จ๊ณ„ ๋ฆฌ๋ทฐ๋„ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!!!

Copy link

@namjackson namjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ˆ๋…•ํ•˜์„ธ์š” ์ค€ํ˜„๋‹˜!
2๋‹จ๊ณ„ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค,
๋ช‡๊ฐ€์ง€ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒผ์œผ๋‹ˆ, ํ™•์ธํ•ด์ฃผ์„ธ์š” :)

Comment on lines 34 to 35
if (minePositions.contains(position)) return Mine()
return NormalPedal()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (minePositions.contains(position)) return Mine()
return NormalPedal()
if (minePositions.contains(position)) Mine() else NormalPedal()

๋” ๊ฐ„๋‹จํžˆ ์‚ฌ์šฉํ•ด๋ณด์•„์š”!

}

companion object {
private const val VALID_MESSAGE: String = "์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ตฌ์ฒด์ ์œผ๋กœ ์–ด๋–ค ์—๋Ÿฌ์ธ์ง€ ํ‘œ๊ธฐํ•˜๋ฉด ์–ด๋–จ๊นŒ์š”?

Comment on lines +8 to +9
return (x - 1..x + 1).flatMap { xVal ->
(y - 1..y + 1).map { yVal -> Position(xVal, yVal) }

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("*")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var ๋กœ ์ •์˜ํ•œ ์ด์œ ๊ฐ€ ์ž‡์„๊นŒ์š”?
์™ธ๋ถ€์—์„œ ์‰ฝ๊ฒŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•œ ๊ตฌ์กฐ๋„ค์š”!

var mark: Mark?

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)

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)

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)

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)
}

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ํ•˜๋Š” ๋น„์ฆˆ๋‹ˆ์Šค๋กœ์ง์„ ๋ถ„๋ฆฌํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants