code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,79 @@
+package lotto.model;
+
+import lotto.model.constants.LottoPrize;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import static lotto.constants.ErrorMessage.DUPLICATION;
+import static lotto.constants.ErrorMessage.SIXNUMBER;
+import static lotto.model.const... | Java | set์ ์ด์ฉํ์ง ์๋ ๋ฐฉ๋ฒ๋ ์์๋ค์. |
@@ -0,0 +1,79 @@
+package lotto.model;
+
+import lotto.model.constants.LottoPrize;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import static lotto.constants.ErrorMessage.DUPLICATION;
+import static lotto.constants.ErrorMessage.SIXNUMBER;
+import static lotto.model.const... | Java | ํด๋น ๋ถ๋ถ์ LottoPrize์์ ํด์ฃผ๋ฉด lotto์ ์ญํ ์ ์ค์ผ ์ ์์ ๊ฒ์ด๋ผ๊ณ ์๊ฐํ๋๋ฐ ์ด๋ ์ ๊ฐ์?
stream์ ์ด์ฉํด์ filter๋ฅผ ํ๋ฉด ์กฐ๊ธ ๋ ๊น๋ํด ์ง ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,67 @@
+package lotto.model;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import lotto.controller.LottoController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static lotto.constants.ErrorMessage.ISNOTINTEGER;
+... | Java | ๋งค์ง ๋๋ฒ ํด์ฃผ์๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,62 @@
+package lotto.view;
+
+import camp.nextstep.edu.missionutils.Console;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static lotto.constants.ErrorMessage.*;
+import static lotto.view.ConstantsMessage.*;
+
+public class LottoInput {
+ public String ... | Java | ๋ฉ์์ง ์์ %n๋ฅผ ์ด์ฉํด์ printf๋ฅผ ์ด์ฉํ๋ค๋ฉด printNewLine ์ฝ๋๋ฅผ ์์จ๋ ๋ ๊ฒ ๊ฐ์๋ฐ ์ด ๋ถ๋ถ์ ๋ํด์ ์ด๋ป๊ฒ ์๊ฐํ์๋์ง ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,21 @@
+package lotto.constants;
+
+public enum ErrorMessage {
+ DUPLICATION("[ERROR] ๊ฐ์ด ์ค๋ณต๋์์ต๋๋ค"),
+ ISNOTINTEGER("[ERROR] ์ซ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์"),
+ SIXNUMBER("[ERROR] ๋ฒํธ 6๊ฐ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์"),
+ OUTFRANGE("[ERROR] ๋ก๋ ๋ฒํธ๋ 1๋ถํฐ 45 ์ฌ์ด์ ์ซ์์ฌ์ผ ํฉ๋๋ค."),
+ ONENUMBER("[ERROR] ์ซ์ ๋ฒํธ 1๊ฐ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์"),
+ NOTTHOUSAND("[ERROR] ... | Java | constants ํจํค์ง๊ฐ ๋๊ฐ๊ฐ ์กด์ฌํ๋๋ฐ ์ด๋ฆ์ ๋ฌ๋ฆฌํด์ ๊ตฌ๋ถํ๋๊ฒ ์กฐ๊ธ ๋ ๊ฐ๋
์ฑ์๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,34 @@
+# ๋ก๋
+
+## ๊ธฐ๋ฅ ๋ชฉ๋ก
+- [V] ๋๋ค ํ๊ฒ ์์ฑํ ๋ก๋ ๋ฒํธ์ ์ฌ์ฉ์๊ฐ ์์๋ก ์ ์ ํ ๋น์ฒจ ๋ฒํธ๋ฅผ ๋น๊ตํ์ฌ
+ ๋น์ฒจ๋ ๋ฑ์์ ์์ต๋ฅ ์ ๊ณ์ฐํ๋ค.
+ - [V] ์ฌ์ฉ์๋ก๋ถํฐ ๋ก๋ ๊ตฌ์
๊ธ์ก์ ์
๋ ฅ ๋ฐ๋๋ค.
+ - [V] ์
๋ ฅ ๋ฐ์ ๊ธ์ก์ ๋ฐ๋ผ ๋๋คํ๊ฒ 6๊ฐ์ ์ซ์๋ฅผ ์์ฑํ์ฌ ๋ก๋ ๋ฒํธ๋ฅผ ์์ฑํ๋ค.(1~45๋ฒ์, ์ค๋ณตX, ์ค๋ฆ์ฐจ์ ์ ๋ ฌ)
+ - [V] ์ฌ์ฉ์๋ก๋ถํฐ ๋น์ฒจ ๋ฒํธ์ ๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅ ๋ฐ์ ํ, ์์ฑํ ๋ก๋ ๋ฒํธ์ ๋น๊ตํ์ฌ ๋ฑ์๋ฅผ ์ถ๋ ฅํ๋ค.
+ - [V] ์์ต๋ฅ ์ ๊ณ์ฐํ์ฌ ์ถ๋ ฅํ๋ค.(์์์ ... | Unknown | ์๋ฃ๋ ๋ถ๋ถ ์ฒดํฌํ์ฌ ๋ฆฌ๋๋ฏธ๋ ๊ผผ๊ผผํ๊ฒ ๊ด๋ฆฌํด์ฃผ์๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค~ |
@@ -0,0 +1,50 @@
+package lotto.controller;
+
+import lotto.model.Lotto;
+import lotto.model.LottoNumberMaker;
+import lotto.model.LottoPercentageCalculation;
+import lotto.model.constants.LottoPrize;
+import lotto.view.LottoInput;
+import lotto.view.LottoOutput;
+
+import java.util.ArrayList;
+import java.util.List;
+... | Java | set์ด๋ผ๋ ๋ฉ์๋๋ช
์ Setter์ ๋๋์ด ๊ฐํ๋ฐ ํน์ ๋ค๋ฅธ ๋ณ์๋ช
์ ๊ณ ๋ คํด๋ณด์๋๊ฑด ์ด๋ ์ค๊น์? |
@@ -0,0 +1,79 @@
+package lotto.model;
+
+import lotto.model.constants.LottoPrize;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import static lotto.constants.ErrorMessage.DUPLICATION;
+import static lotto.constants.ErrorMessage.SIXNUMBER;
+import static lotto.model.const... | Java | ์ ๋ ๋์น ๋ถ๋ถ์ด๊ธดํ๋ฐ ๋งค์ง๋๋ฒ ์ฒ๋ฆฌํด์ฃผ์๋๊ฒ ์ข์๋ฏ ํฉ๋๋ค! |
@@ -0,0 +1,79 @@
+package lotto.model;
+
+import lotto.model.constants.LottoPrize;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import static lotto.constants.ErrorMessage.DUPLICATION;
+import static lotto.constants.ErrorMessage.SIXNUMBER;
+import static lotto.model.const... | Java | ```suggestion
.filter(i -> this.numbers
.stream()
.anyMatch(Predicate.isEqual(i)))
```
๋ค์๊ณผ ๊ฐ์ด ๊ฐํ์ฒ๋ฆฌ ํด์ฃผ์๋๊ฒ ๊ฐ๋
์ฑ์ ์ข์๋ณด์
๋๋ค! |
@@ -0,0 +1,79 @@
+package lotto.model;
+
+import lotto.model.constants.LottoPrize;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import static lotto.constants.ErrorMessage.DUPLICATION;
+import static lotto.constants.ErrorMessage.SIXNUMBER;
+import static lotto.model.const... | Java | ๋งค์ง๋๋ฒ ์ฒ๋ฆฌ๋ฅผ ํด์ฃผ์
์ผ ํ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,67 @@
+package lotto.model;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import lotto.controller.LottoController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static lotto.constants.ErrorMessage.ISNOTINTEGER;
+... | Java | ์ด๋ถ๋ถ๋ง ๋ฐ๋ก ์ ์ญ ๋ฉ์๋๋ก ์ ์ธํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์??? |
@@ -0,0 +1,67 @@
+package lotto.model;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import lotto.controller.LottoController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static lotto.constants.ErrorMessage.ISNOTINTEGER;
+... | Java | ํด๋น ํด๋์ค๊ฐ ๋๋ฌด ๋ง์ ์ฑ
์์ ๊ฐ์ง๊ณ ์๋๊ฒ ๊ฐ์ต๋๋ค. ๊ตฌ๋งค๊ธ์ก์ ๊ฒ์ฆํ๋ ๋ถ๋ถ๊ณผ ๋ก๋ ๋ฒํธ๋ฅผ ๊ฒ์ฆํ๋ ๋ถ๋ถ์ ๋ถ๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ผ๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,39 @@
+package lotto.model.constants;
+
+public enum LottoPrize {
+ FIRST_PRIZE(0,"6๊ฐ ์ผ์น (2,000,000,000์) - ","๊ฐ",2000000000),
+ SECOND_PRIZE(0,"5๊ฐ ์ผ์น, ๋ณด๋์ค ๋ณผ ์ผ์น (30,000,000์) - ","๊ฐ", 30000000),
+ THIRD_PRIZE(0,"5๊ฐ ์ผ์น (1,500,000์) - ","๊ฐ", 1500000),
+ FOURTH_PRIZE(0,"4๊ฐ ์ผ์น (50,000์) - ","๊ฐ", 5000... | Java | ์ถ๋ ฅ ํ์๊ณผ ๊ด๋ จ๋ ๋ถ๋ถ์ view์์ ์ฒ๋ฆฌํด์ผํ ๊ฑฐ ๊ฐ์๋ฐ ์ด์ ๋ํด์ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,100 @@
+# Domain ๊ตฌํ
+
+## ์งํ ํ๋ก์ธ์ค (์์คํ
์ฑ
์)
+
+1. ๊ฒ์ด๋จธ๋ ์๋ํ ๋ณด์ค ๋ชฌ์คํฐ์ HP๋ฅผ ์ค์ ํ๋ค.
+2. ๊ฒ์ด๋จธ๋ ํ๋ ์ดํ ํ๋ ์ด์ด์ ์ด๋ฆ๊ณผ HP, MP๋ฅผ ์ค์ ํ๋ค.
+3. ๊ฒ์์ด ์์๋๋ค.
+4. ๊ฒ์์ ํด์ ์ด๋ฉฐ, ๋งค ํด๋ง๋ค ๋ค์๊ณผ ๊ฐ์ ํ๋์ด ๋ฐ๋ณต๋๋ค.
+ 1) ๋ณด์ค ๋ชฌ์คํฐ์ ํ๋ ์ด์ด์ ํ์ฌ ์ํ๋ฅผ ๋ณด์ฌ์ค๋ค.
+ 2) ํ๋ ์ด์ด๊ฐ ๊ณต๊ฒฉํ ๋ฐฉ์์ ์ ํํ๋ค.
+ 3) ํ๋ ์ด์ด๊ฐ ์ ํ๋ ๋ฐฉ์์ผ๋ก ๊ณต๊ฒฉํ๋ค. (๋ณด์ค ๋ชฌ์คํฐ์๊ฒ ๋ฐ๋ฏธ์ง๋ฅผ ์
ํ)
+ 4) ๋ฐ๋ฏธ์ง๋ฅผ ์
์ ๋ณด์ค ๋ชฌ์คํฐ์ ์ํ๋ฅผ ํ์ธํ๋ค.
+ ... | Unknown | ์์ฒญ ์ฌํญ์ ๊ต์ฅํ ๊น๋ํ๊ฒ ์ ์ด์ฃผ์ ๊ฒ ๊ฐ์์!
ํ์ง๋ง ์ฐ๋ ค๋๋ ์ ๋ ์๋๋ฐ์. ์ ์ฑ์ค๋ ์์ฑํด์ฃผ์ ๋ฌธ์์ง๋ง ๋๋ฃ ์
์ฅ์์๋ ํจ์ ์ด๋ฆ์ด๋ ์ธ์ ๋ฑ์ ๊ธ๋ก ํํํ๋ ๊ฒ๋ณด๋ค ํจ์ ํํ๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ด ๊ฐ๋
์ฑ์ด ๋ ์ข์ ์๋ ์๊ฒ ๋ค๋ ์๊ฐ์ ํ์ด์!
์ฑ
๋ค๋ ๋ณด๋ฉด ๊ธ๋ณด๋ค๋ ์ฝ๋๋ก ๋จผ์ ๋ณด์ฌ์ฃผ์์์:)
```java
public void start() {
// ๊ฒ์ ์์ ๋ก์ง
}
```
์ด๋ฐ ๋๋์ผ๋ก์!
์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,17 @@
+package bossmonster.exception;
+
+import bossmonster.view.OutputView;
+import java.util.function.Supplier;
+
+public class ExceptionHandler {
+
+ public static <T> T retryInput(Supplier<T> supplier) {
+ while (true) {
+ try {
+ return supplier.get();
+ } ... | Java | ์ด๋ ๊ฒ ๋ง๋ค ์๊ฐ์ ํ์ง ๋ชปํ๋๋ฐ, ์ ๋ค๋ฆญ์ ์ ๋ง ์ ํ์ฉํ์ ๊ฒ ๊ฐ์์!
ํ์ง๋ง ํจ์๋ช
์์ ์คํด์ ์์ง๊ฐ ์๋ค๊ณ ์๊ฐํด์. ์ฒซ ์๋๋ฅผ ํ ๋๋ ํด๋น ํจ์๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ธ๋ฐ์. ์ค๋ฅ๊ฐ ๋์ง ์์๋๊น์ง ๊ณ์ ์ฌ์
๋ ฅ ๋ฐ๋ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ๋ค์ด๋ฐ์ด ์ด์ธ๋ฆด ๊ฒ ๊ฐ์์! ์... ๋ง๋
ํ ๋ ์ค๋ฅด๋ ๋ค์ด๋ฐ์ ์๋ค์ใ
ใ
|
@@ -0,0 +1,17 @@
+package bossmonster.exception;
+
+import bossmonster.view.OutputView;
+import java.util.function.Supplier;
+
+public class ExceptionHandler {
+
+ public static <T> T retryInput(Supplier<T> supplier) {
+ while (true) {
+ try {
+ return supplier.get();
+ } ... | Java | ์ถ๊ฐ์ ์ผ๋ก ํด๋์ค๋ช
์ด ์ด์ธ๋ฆฌ์ง ์๋๋ฏํ ๋๋์ ๋ฐ์์ด์. ์คํ๋ง์ ์๊ฐํด์ ๋ค์ด๋ฐ์ ์ ํ์ ๊ฒ ๊ฐ์์ ์คํ๋ง์ ExceptionHandler์ ๋น๊ตํด์ ๋ง์๋๋ฆฌ๊ฒ ์ต๋๋ค!
`ExceptionHandler`์ ๊ฒฝ์ฐ ๋ง ๊ทธ๋๋ก ์์ธ๋ฅผ ํธ๋ค๋งํด์ฃผ๋ ์ญํ ์
๋๋ค. A๋ผ๋ ์์ธ๊ฐ ๋ฐ์ํ๋ฉด ExceptionHandler๊ฐ ๊ทธ์ ๋ง๊ฒ ์ฒ๋ฆฌํด์ฃผ๊ณ , B๋ผ๋ ์์ธ๊ฐ ๋ฐ์ํ๋ฉด ๊ทธ๊ฒ๋ ๊ทธ๊ฒ์ ExceptionHandler์ ๋ง๊ฒ ์ฒ๋ฆฌํด์ฃผ๋ ์ญํ ์ด์ฃ . ์คํ๋ง์ ExceptionHandler์ฒ๋ผ ์์ธ๋ฅผ ํธ๋ค๋งํ๋ ๊ทธ ์์ฒด์๋ง ๋ชฉ์ ์ด ์์ด์ผํ๋ค๊ณ ์๊ฐํด์.
ํ์ง๋ง ์์ฑํ์ ์ฝ๋์์๋ ์... |
@@ -0,0 +1,78 @@
+package bossmonster.exception;
+
+import bossmonster.view.constants.Message;
+
+public class Validator {
+
+ public static String validateInputOfNumber(String inputValue) {
+ validateEmpty(inputValue);
+ validateInteger(inputValue);
+ return inputValue;
+ }
+
+ public sta... | Java | ํด๋น ํด๋์ค๋ฅผ exception ํจํค์ง์ ๋ฃ์ผ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค!
hp + mp๋ 200์ด์ด์ผํ๋ค ๋ฑ... ๋น์ฆ๋์ค ๋ก์ง์ด ๋ด๊ธด ๋ถ๋ถ์ด ์๋๋ฐ domain ํจํค์ง์ ๋ถ๋ฆฌ๋์ด ์์ด์์! |
@@ -0,0 +1,61 @@
+package bossmonster.domain;
+
+import bossmonster.exception.Validator;
+
+public class Player {
+
+ private String name;
+ private PlayerStatus status;
+
+ public Player(String name, int maxHP, int maxMP) {
+ this.name = Validator.validatePlayerName(name);
+ Validator.validatePl... | Java | controller์์ Validator๋ฅผ ์ฌ์ฉํ ๋๋ ์๊ณ , domain์์ ์ฌ์ฉํ ๋๋ ์๊ตฐ์.
์ด๋ค ๊ธฐ์ค์ผ๋ก ๋ถ๋ฆฌํ์
จ๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,70 @@
+package bossmonster.domain;
+
+import bossmonster.domain.dto.GameHistoryDto;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameHistory {
+
+ private class Turns {
+
+ private int turnCount;
+ private String playerName;
+ private String playerAttackType;
+... | Java | ํด๋น ๊ฐ์ฒด๋ฅผ ๋ง๋์ ๋ชฉ์ ์ด ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,82 @@
+package bossmonster.domain.dto;
+
+public class GameHistoryDto {
+
+ private int turnCount;
+ private String playerName;
+ private String playerAttackType;
+ private int playerAttackDamage;
+ private int monsterAttackDamage;
+ private int playerMaxHP;
+ private int playerCurrentHP... | Java | `isFinish()`๋ `isPlaying()`์ ๊ฐ์ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,119 @@
+package bossmonster.controller;
+
+import bossmonster.domain.AttackType;
+import bossmonster.domain.BossMonster;
+import bossmonster.domain.Player;
+import bossmonster.domain.RaidGame;
+import bossmonster.domain.dto.GameHistoryDto;
+import bossmonster.exception.ExceptionHandler;
+import bossmonster.e... | Java | DTO๋ก ๋ฐ์๋ค๋ฉด ์ธ๋ฑ์ค๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ํ๋ ์ด์ด ์ ๋ณด๋ฅผ ๋ฐ์์ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,73 @@
+package bossmonster.domain;
+
+import bossmonster.domain.dto.GameHistoryDto;
+
+public class RaidGame {
+
+ private static final int DEFAULT_VALUE = 0;
+
+ private BossMonster bossMonster;
+ private Player player;
+ private GameHistory gameHistory;
+ private boolean status;
+ private... | Java | ์ปจํธ๋กค๋ฌ์ ๋๋ฉ์ธ์ ์ ๋ง ์ ๋ถ๋ฆฌํ์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,61 @@
+package bossmonster.domain;
+
+import bossmonster.exception.Validator;
+
+public class Player {
+
+ private String name;
+ private PlayerStatus status;
+
+ public Player(String name, int maxHP, int maxMP) {
+ this.name = Validator.validatePlayerName(name);
+ Validator.validatePl... | Java | ์ด ๋ถ๋ถ ์ด๋ ค์ฐ์
จ์ํ
๋ฐ ์ญํ ๋ถ๋ฐฐ ์ํ์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,63 @@
+package bossmonster.view.constants;
+
+public enum Message {
+
+ /* Input Request */
+ INPUT_MONSTER_HP("๋ณด์ค ๋ชฌ์คํฐ์ HP๋ฅผ ์
๋ ฅํด์ฃผ์ธ์."),
+ INPUT_PLAYER_NAME("\n" + "ํ๋ ์ด์ด์ ์ด๋ฆ์ ์
๋ ฅํด์ฃผ์ธ์"),
+ INPUT_PLAYER_HP_MP("\n" + "ํ๋ ์ด์ด์ HP์ MP๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.(,๋ก ๊ตฌ๋ถ)"),
+ INPUT_ATTACK_TYPE_SELECT("\n" + "์ด๋ค ๊ณต๊ฒฉ์ ํ์๊ฒ ์ต๋๊น?"... | Java | ์ ๋ ์์๋ฅผ ํ ํ์ผ๋ก ๊ด๋ฆฌํ์๋๋ฐ์.
์์๋ฅผ ํ ํ์ผ๋ก ๊ด๋ฆฌํ๊ฒ ๋๋ฉด ํ ํ๋ก์ ํธ๋ฅผ ์งํํ ๋ ์์ ํ์ผ์์ ์ถฉ๋์ด ๋ง์ด ์ผ์ด๋๋๋ผ๊ตฌ์.
์ด๋ฐ ๋ฌธ์ ๋ฅผ ์ด๋ป๊ฒ ํด๊ฒฐํ๋ฉด ์ข์๊น์? |
@@ -0,0 +1,63 @@
+package bossmonster.view.constants;
+
+public enum Message {
+
+ /* Input Request */
+ INPUT_MONSTER_HP("๋ณด์ค ๋ชฌ์คํฐ์ HP๋ฅผ ์
๋ ฅํด์ฃผ์ธ์."),
+ INPUT_PLAYER_NAME("\n" + "ํ๋ ์ด์ด์ ์ด๋ฆ์ ์
๋ ฅํด์ฃผ์ธ์"),
+ INPUT_PLAYER_HP_MP("\n" + "ํ๋ ์ด์ด์ HP์ MP๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.(,๋ก ๊ตฌ๋ถ)"),
+ INPUT_ATTACK_TYPE_SELECT("\n" + "์ด๋ค ๊ณต๊ฒฉ์ ํ์๊ฒ ์ต๋๊น?"... | Java | ์
์ถ๋ ฅ์ ์ฌ์ฉ๋๋ ๋ฉ์์ง๋ค์ InputView์ OutputView์์ ๊ฐ๊ฐ ์ฌ์ฉํ๋ค ๋ณด๋ ๋ฉ์์ง๊ฐ ๋ง์ ๊ฒฝ์ฐ์๋ ์๋ฆฌ๋ฅผ ๋ง์ด ์ฐจ์งํ๋ ๊ฒ ๊ฐ์์ ํ ํ์ผ๋ก ๊ด๋ฆฌํ๊ณ ๊ฐ์ ธ๋ค ์ฐ๋ ํํ๋ก ํด์ผ๊ฒ ๋ค๊ณ ์๊ฐํ์ต๋๋ค. ์ ๊ฐ ๊ณต๋ถํ์ง ์ผ๋ง ๋์ง ์์ ํ ํ๋ก์ ํธ๋ฅผ ๊ฒฝํํด๋ณธ ์ ์ด ์์ง ์์ด ์ด๋ค ๋ถ๋ถ์์ ์ถฉ๋์ด ์ผ์ด๋๋์ง๋ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๋ถ๋ช
์์๋ฅผ ํ ํ์ผ๋ก ๊ด๋ฆฌํ๋ค๋ณด๋ฉด ๋ฌธ์ ๊ฐ ์๊ธธ ์๋ ์์ ๊ฒ ๊ฐ์๋ฐ์. ์ด ๋ถ๋ถ์ ์ฌ๋ฌ ํ๋ก์ ํธ๋ฅผ ์งํํ๋ฉด์ ์กฐ๊ธ ๋ ๊ณ ๋ฏผํด ๋ด์ผ ํ ๋ถ๋ถ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,78 @@
+package bossmonster.exception;
+
+import bossmonster.view.constants.Message;
+
+public class Validator {
+
+ public static String validateInputOfNumber(String inputValue) {
+ validateEmpty(inputValue);
+ validateInteger(inputValue);
+ return inputValue;
+ }
+
+ public sta... | Java | ์ฒ์์๋ ์
๋ ฅ ๋จ๊ณ์์ ๊ฒ์ฆํ๋ ๋ถ๋ถ๋ง ๋ฐ๋ก ๋ฃ๊ณ , ๋๋ฉ์ธ ๋ถ๋ถ์์ ๊ฒ์ฆํ ๋ก์ง์ ๊ฐ ๋๋ฉ์ธ ํด๋์ค์์ ์งํํ๋ ๊ฒ์ผ๋ก ํ์๋๋ฐ์. ํ๋ค๋ณด๋ ๊ฒน์น๋ ๋ถ๋ถ์ด ์๋ ๊ฒ ๊ฐ์์ ์ ํ์ฉํ์ง ๋ชปํ์ต๋๋ค. ์์์ ์๊ฒฌ์ ์ฃผ์ ๊ฒ ์ฒ๋ผ DTO๋ฅผ ํ์ฉํ๋ฉด ๋ ๊น๋ํ๊ฒ ๊ฒ์ฆ ๋ก์ง์ ๋ถ๋ฐฐํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,17 @@
+package bossmonster.exception;
+
+import bossmonster.view.OutputView;
+import java.util.function.Supplier;
+
+public class ExceptionHandler {
+
+ public static <T> T retryInput(Supplier<T> supplier) {
+ while (true) {
+ try {
+ return supplier.get();
+ } ... | Java | ์ ๋ ์๋ฌ ๋ฐ์ ์, ์ฌ์
๋ ฅ์ ๋ฐ์์ผ ํ๋ ๋ถ๋ถ์ ๋ํด์ ๊ณ ๋ฏผ์ ๋ง์ด ํ๋ค๊ฐ.. ๋ค๋ฅธ ๋ถ๋ค์ ์ฝ๋ ๋ฆฌ๋ทฐ๋ฅผ ๋ณด๊ณ ์ฌ๋ฌ๊ฐ์ง ์ฐพ์๋ณด๋ค ์ด๋ฐ ๋ฐฉ๋ฒ๋ ์๋ค๋ ๊ฒ์ ์๊ฒ ๋์์ต๋๋ค. ํ๋ ๋ง๋ค์ด ๋๋ฉด ํ์ฉ์ฑ์ด ์ข์ ๊ฒ ๊ฐ์์. ๋ค์ด๋ฐ์ ๋ํด์๋ ๋ง์ ์ฃผ์ ๋ถ๋ถ์ฒ๋ผ ๊ฐ๋
์ฑ์ด ์ ์ข์ ์ง ์ ์๊ธฐ ๋๋ฌธ์ ๋ ๊ณ ๋ฏผ์ด ํ์ํ ๊ฒ ๊ฐ์ต๋๋ค. ๋ง์ ๋ค์ด๋ฐ์ ๋ํด์๋ ๋ง์ด ์ ๊ฒฝ์ ์ฐ์ง ๋ชปํ๋ ๊ฒ ๊ฐ๋ค์.
ํด๋์ค๋ช
์ ๊ดํด ์๊ฒฌ ์ฃผ์ ๋ถ๋ถ์ ๋ํด์๋ ๊ฐ์ฌํฉ๋๋ค. ์คํ๋ง์ ๋ํ ๊ฐ๋
์ด ์์ง ์์ด์ ์คํ๋ง์ ExceptionHandler๊ฐ ์ด๋ป๊ฒ ์ฌ์ฉ๋๋์ง ์ฒ์ ์์๋ค์.. ์ ๋ ๋จ์ํ ์... |
@@ -0,0 +1,82 @@
+package bossmonster.domain.dto;
+
+public class GameHistoryDto {
+
+ private int turnCount;
+ private String playerName;
+ private String playerAttackType;
+ private int playerAttackDamage;
+ private int monsterAttackDamage;
+ private int playerMaxHP;
+ private int playerCurrentHP... | Java | ๋จ์ํ ํ์ฌ ๊ฒ์ ์ํ๋ฅผ ๋ฌป๊ธฐ ์ํด ์ผ๋ ๊ฒ ๊ฐ์๋ฐ ์๊ฒฌ ์ฃผ์ ๋ฉ์๋๋ช
์ด ๋ฐํ๋๋ ๊ฐ์ ์ดํดํ๊ธฐ์ ๋ ์ง๊ด์ ์ด๋ค์! |
@@ -0,0 +1,73 @@
+package bossmonster.domain;
+
+import bossmonster.domain.dto.GameHistoryDto;
+
+public class RaidGame {
+
+ private static final int DEFAULT_VALUE = 0;
+
+ private BossMonster bossMonster;
+ private Player player;
+ private GameHistory gameHistory;
+ private boolean status;
+ private... | Java | ๊ฐ์ฌํฉ๋๋ค. ๊ฐ์ฒด์งํฅ์ ๊ณต๋ถํ๋ฉด์ MVC ํจํด์ ๊ตฌ์ ๋ฐ์ง ์๊ณ ๋๋ฉ์ธ ๋ก์ง์ ๋๋ฉ์ธ ๋ก์ง์์๋ง์ผ๋ก๋ ๋์๊ฐ ์ ์๋๋ก ๊ตฌํํ๊ณ ์ ์ฐ์ตํ๊ณ ์์ต๋๋ค. ์ปจํธ๋กค๋ฌ๊ฐ ์์ด๋ ๋๋ฉ์ธ ๋ด์์๋ ๋๋ฉ์ธ ๋ก์ง์ด ์ ๋์๊ฐ์ผ ํ๋ค๊ณ ์๊ฐํ๋ฉด์ ๊ณ ๋ฏผํ๋ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,61 @@
+package bossmonster.domain;
+
+import bossmonster.exception.Validator;
+
+public class Player {
+
+ private String name;
+ private PlayerStatus status;
+
+ public Player(String name, int maxHP, int maxMP) {
+ this.name = Validator.validatePlayerName(name);
+ Validator.validatePl... | Java | ์ ๋์๋ค๋ ๋คํ์ด๋ค์ ์ข๊ฒ ๋ด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,61 @@
+package bossmonster.domain;
+
+import bossmonster.exception.Validator;
+
+public class Player {
+
+ private String name;
+ private PlayerStatus status;
+
+ public Player(String name, int maxHP, int maxMP) {
+ this.name = Validator.validatePlayerName(name);
+ Validator.validatePl... | Java | ๋ฐ์ Validator์ ์ฌ์ฉ์ ๋ํด ์ฃผ์ ์๊ฒฌ๊ณผ ๋์ผํ ๋ฌธ์ ๋ค์.. ์
์ถ๋ ฅ์ ๊ด๋ จ๋ ๊ฒ์ฆ๊ณผ ๋๋ฉ์ธ ๋ถ๋ถ์ ๊ฒ์ฆ์ ๋ถ๋ฆฌํด์ ์ฌ์ฉํ๋๊ฒ ๋ง์ ๊ฒ ๊ฐ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,70 @@
+package bossmonster.domain;
+
+import bossmonster.domain.dto.GameHistoryDto;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameHistory {
+
+ private class Turns {
+
+ private int turnCount;
+ private String playerName;
+ private String playerAttackType;
+... | Java | ์ปจํธ๋กค๋ฌ์์ ๊ฒ์์ ์ ์ดํ๋ ๊ฒ ๋ณด๋ค RaidGame ํด๋์ค์์ ์ ์ฒด์ ์ธ ๊ฒ์ ๋ก์ง์ด ๋์๊ฐ๋ ํํ๋ก ์๊ฐํ๊ณ ๊ตฌํํ๋ค ๋ณด๋ ๊ฒ์์ด ์คํ๋๋ฉด์ ํ์คํ ๋ฆฌ๋ฅผ ๋จ๊ธฐ๊ณ ์ปจํธ๋กค๋ฌ์์ ์ถ๋ ฅ์ ์ํด์๋ ๊ธฐ๋ก์ ๋จ๊ฒจ์ง ๋ถ๋ถ์ ๊ฐ์ ธ๋ค๊ฐ ๋ณด์ฌ์ค์ผ ์์กด์ฑ์ด ๋จ์ด์ง ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํ์ต๋๋ค. ์ค์ ๋ก ํด ์ ๊ฒ์์ ํ๋ฉด ๋งค ํด๋ง๋ค ํด์ ๋ํ ๊ธฐ๋ก์ด ๊ฒ์์์๋ ๋จ๊ฒ ๋๋๋ฐ ์ด๊ฑธ ์๊ฐํด์ ๋ง๋ค์๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,119 @@
+package bossmonster.controller;
+
+import bossmonster.domain.AttackType;
+import bossmonster.domain.BossMonster;
+import bossmonster.domain.Player;
+import bossmonster.domain.RaidGame;
+import bossmonster.domain.dto.GameHistoryDto;
+import bossmonster.exception.ExceptionHandler;
+import bossmonster.e... | Java | ์ ๊ฐ ์์ฑํ ์ฝ๋์ InputView๋ ๋จ์ํ ์
๋ ฅ์ ๋ฐ๋ ๋ฉ์๋๋ง ์กด์ฌ ํ๋๋ฐ์. ์ด๋ ๊ฒ ๊ตฌ์ฑํ๋ค ๋ณด๋ ์ปจํธ๋กค๋ฌ์์ ์
๋ ฅ๋ฐ์ ๋ถ๋ถ์ ๋ํด์ ๊ฒ์ฆ์ ํ๊ณ ๋ณํํด์ ๋๋ฉ์ธ์ ์์ฑํ๊ฑฐ๋ ๋ฐ์ดํฐ๋ฅผ ๋๊ฒจ์ค์ผ ํด์ ํ ์ผ์ด ๋ง์์ง๋ ๋จ์ ์ด ์๋ค์. ๋ง์์ฃผ์ ๊ฒ์ฒ๋ผ InputView ์ชฝ์์ ์
๋ ฅ์ ๋ฐ๊ณ ๋ฐ๋ก ์
๋ ฅ์ ๋ํ ๋ถ๋ถ์ ๊ฒ์ฆํด์ DTO๋ฅผ ์์ฑํ์ฌ ๊ฑด๋ค์ฃผ๋ ๋ฐฉ์์ ์ฐ์ตํด๋ด์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,100 @@
+# Domain ๊ตฌํ
+
+## ์งํ ํ๋ก์ธ์ค (์์คํ
์ฑ
์)
+
+1. ๊ฒ์ด๋จธ๋ ์๋ํ ๋ณด์ค ๋ชฌ์คํฐ์ HP๋ฅผ ์ค์ ํ๋ค.
+2. ๊ฒ์ด๋จธ๋ ํ๋ ์ดํ ํ๋ ์ด์ด์ ์ด๋ฆ๊ณผ HP, MP๋ฅผ ์ค์ ํ๋ค.
+3. ๊ฒ์์ด ์์๋๋ค.
+4. ๊ฒ์์ ํด์ ์ด๋ฉฐ, ๋งค ํด๋ง๋ค ๋ค์๊ณผ ๊ฐ์ ํ๋์ด ๋ฐ๋ณต๋๋ค.
+ 1) ๋ณด์ค ๋ชฌ์คํฐ์ ํ๋ ์ด์ด์ ํ์ฌ ์ํ๋ฅผ ๋ณด์ฌ์ค๋ค.
+ 2) ํ๋ ์ด์ด๊ฐ ๊ณต๊ฒฉํ ๋ฐฉ์์ ์ ํํ๋ค.
+ 3) ํ๋ ์ด์ด๊ฐ ์ ํ๋ ๋ฐฉ์์ผ๋ก ๊ณต๊ฒฉํ๋ค. (๋ณด์ค ๋ชฌ์คํฐ์๊ฒ ๋ฐ๋ฏธ์ง๋ฅผ ์
ํ)
+ 4) ๋ฐ๋ฏธ์ง๋ฅผ ์
์ ๋ณด์ค ๋ชฌ์คํฐ์ ์ํ๋ฅผ ํ์ธํ๋ค.
+ ... | Unknown | ์์ง์ ๊ธฐ๋ฅ ๋ชฉ๋ก ๋ฌธ์์ ๋ํด์ ๋๊ตฐ๊ฐ ๋ณธ๋ค๋ ์๊ฐ๋ณด๋ค๋ ์ ๊ฐ ๊ตฌํ์ ์์์ ๊ณต๋ถํ ๋ด์ฉ์ผ๋ก ์ดํดํ๊ธฐ ์ฝ๊ฒ ์ ๋ฆฌํ๋ ๊ฒ์ ๋ชฉ์ ์ผ๋ก ์์ฑํ์๋๋ฐ์. ๊ฐ๋ฐ์ ํผ์ ํ๋ ๊ฒ์ด ์๋๊ธฐ์ ๋ง์ ์ฃผ์ ๋ถ๋ถ์ ๋ํด์๋ ์ ๊ฒฝ์ ์ฐ๋ฉด์ ์์ฑ์ ํด์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
์ ๊ฐ ๋ฐ์์๋ถํฐ ๋ฆฌ๋ทฐ์ ๋ํ ๋ต๊ธ์ ๋จ๊ฒผ์ต๋๋ค. ๋ฆฌ๋ทฐ๋ฅผ ์์ฒญํ๊ณ ๋ฐ์ ๋ณด๋๊ฒ ์ฒ์์ด๋ผ ์ด๋ ๊ฒ ๋์์ด ๋ง์ด ๋๋์ง ๋ชฐ๋๋ค์. ์์ง ๊ณต๋ถ๋ฅผ ์์ํ์ง ์ผ๋ง ๋์ง ์์ ์ฝ๋ ์ฝ๊ธฐ๊ฐ ๋ง์ด ํ๋์
จ์ํ
๋ฐ ๋ฆ์ ์๊ฐ์๋ ๋ฆฌ๋ทฐ ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค. ์ฃผ์ ์๊ฒฌ๋ค ๋ชจ๋ ์ฐธ๊ณ ํด์ ์ ๊ฐ ๊ฐ์ ํด ๋๊ฐ์ผ ํ ๋ฐฉํฅ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ... |
@@ -0,0 +1,6 @@
+package racingcar;
+
+public interface RacingNumberGenerator {
+
+ int generate();
+} | Java | ๋ค๋ฆฌ ๋ฏธ์
์์ ์ด ์ธํฐํ์ด์ค๋ฅผ ํจ์ํ์ธํฐํ์ด์ค๋ก ๊ตฌํ์ ํ๋๋ผ๊ตฌ์.
`@FunctionalInterface` ์ด๋
ธํ
์ด์
์ ๋ถ์ฌ์
ํ๋ฒ์ฏค, ๊ณ ๋ คํด๋ณผ๋ง ํ ๊ฒ ๊ฐ์, ๊ด๋ จ ํฌ์คํ
๋งํฌ ๋จ๊ฒจ๋์ต๋๋ค!
https://codechacha.com/ko/java8-functional-interface/ |
@@ -0,0 +1,47 @@
+package racingcar.model;
+
+public class Car implements Comparable<Car> {
+ private static final int MOVABLE_LOWER_BOUND = 4;
+
+ private final CarName name;
+ private final Position position = Position.init();
+
+ private Car(String name) {
+ this.name = CarName.from(name);
+ }
... | Java | ์ ์ด๊ฑฐ ์ถฉ๊ฒฉ์ ์ธ๋ฐ์...
Comparable<Car>๋ฅผ ํตํด Car ํด๋์ค๋ฅผ ์ ์ํ์ ๊ฑฐ ์ง์ง ์์ด๋์ด ์ข๋ค์.
๋ฐฐ์ ๊ฐ๋๋ค! |
@@ -0,0 +1,48 @@
+package racingcar.model;
+
+import java.util.Objects;
+
+public class Position implements Comparable<Position> {
+
+ private static final int STARTING_POSITION = 0;
+
+ private int position;
+
+ public Position(int position) {
+ this.position = position;
+ }
+
+ public static Pos... | Java | Position์ ์ผ๊ธ๊ฐ์ฒดํํ ํ์๊ฐ ์๋?์ ๋ํ ์๋ฌธ์ด ๋ญ๋๋ค. Car ๊ฐ์ฒด์ int ํ๋๋ก ์ ์ธํด๋ ์ถฉ๋ถํด ๋ณด์ฌ์์.
์์ฑ์ validation์ด ํ์ํ ๊ฒ๋ ์๋๊ณ , ์ด๊ธฐ๊ฐ ์ค์ ๋ Car ๊ฐ์ฒด์์ ์ถฉ๋ถํ ๊ฐ๋ฅํ๊ณ ,
Car์์ compareTo๋ฅผ ์ค๋ฒ๋ผ์ด๋ฉํ ๋, Car์ ๋ํ getter๋ง ์ค์ ํ๋ค๋ฉด ๋ฉ์๋ ๊ตฌํ์ด ๊ฐ๋ฅํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํน ๋ค๋ฅธ ์๋๊ฐ ์๊ฑฐ๋, ์ ์๊ฐ์ด ํ๋ ธ๋ค๋ฉด ํผ๋๋ฐฑ ๋ถํ๋๋ฆฝ๋๋ค:) |
@@ -0,0 +1,65 @@
+package racingcar.model;
+
+import racingcar.RacingNumberGenerator;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class Cars {
+
+ private static final String DUPLICATED_CAR_NAMES = "์๋์ฐจ๋ค์ ์ด๋ฆ... | Java | from์ด๋ผ๋ ๋ฉ์๋๊ฐ ๋ชจ๋ ํด๋์ค์์ ๋ฐ๋ณต๋๋๋ฐ,
Cars.from(names)์ด๋ฐ ์์ผ๋ก ์ฐ๊ฒฐ๋ ๊ฒฝ์ฐ ์๋ฏธ๊ฐ ๋๋ฌ๋์ง๋ง
๋ฉ์๋ ์ด๋ฆ์ด๋ ๊ฒฐ๊ตญ ๊ฐ์ฒด์๊ฒ ๋ณด๋ด๋ ๋ฉ์ธ์ง๋ผ๋ ๊ด์ ์์๋ 'from'์ด๋ผ๋ ๋ฉ์๋ ์ด๋ฆ๋ง ๋ณผ ๊ฒฝ์ฐ ์ด๋ค ์ฉ๋์ธ์ง ์๊ธฐ ํ๋ ๊ฒ ์ฌ์ค์ธ๊ฒ ๊ฐ์ต๋๋ค.
`setNewCars()`๋ฑ๋ฑ ์ ์ ํ๊ฒ ๋ฉ์๋๋ช
์ ๋ฐ๊ฟ๋ณด์๋ฉด ์ด๋จ๊น ์๊ฐํด๋ณด์์ต๋๋ค.ใ
ใ
|
@@ -0,0 +1,24 @@
+package racingcar.model;
+
+public class AttemptCount {
+
+ private static final int IS_OVER = 0;
+
+ private int count;
+
+ public AttemptCount(int count) {
+ this.count = count;
+ }
+
+ public static AttemptCount from(int count) {
+ return new AttemptCount(count);
+ }... | Java | AttemptCount ํด๋์ค๋ ์๋ ํ์์ ๋ํ ์ผ๊ธ ๊ฐ์ฒด๋ก์์ ์ฑ๊ฒฉ๋ณด๋ค,
RacingGame์ ์ ์ฒด ์ฝ๋ ํ๋ฆ์ ์ ์ดํ๋ ์ญํ ์ ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
isPlayable ๋ฉ์๋๋ฅผ ํตํด ๊ฒ์ ์งํ์ฌ๋ถ๋ฅผ ํ๋จํด looping์ ์ด๋๊น์ง ๋ ์ง ํ๋จํด์ฃผ๋ ๊ฒ์ด ํต์ฌ์ด๋๊น์.
`RacingGame`๋ฑ์ผ๋ก ํด๋์ค๋ช
์ ๋ฐ๊พธ๊ณ , attemptCount๋ฅผ ์ธ์คํด์ค ํ๋ํ ํด๋ณด๋ฉด ์ด๋จ๊น์?ใ
ใ
|
@@ -0,0 +1,24 @@
+package racingcar.model;
+
+public class AttemptCount {
+
+ private static final int IS_OVER = 0;
+
+ private int count;
+
+ public AttemptCount(int count) {
+ this.count = count;
+ }
+
+ public static AttemptCount from(int count) {
+ return new AttemptCount(count);
+ }... | Java | ์ ๋ ์ฌ์ฉํ๋ฉด์ ์ฐ์ฐํ๋๋ฐ `RacingGame` ๊ฐ์ฒด๋ก ๊ฒ์์ ์งํํ๋ ์ญํ ์ ๋ถ๋ฆฌํด๋ด์ผ๊ฒ ๋ค์...!
์ข์ ์ง์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,47 @@
+package racingcar.model;
+
+public class Car implements Comparable<Car> {
+ private static final int MOVABLE_LOWER_BOUND = 4;
+
+ private final CarName name;
+ private final Position position = Position.init();
+
+ private Car(String name) {
+ this.name = CarName.from(name);
+ }
... | Java | ์์ ์ ์์ด๋์ด๋ ์๋๊ตฌ... **Tecoble** ์์ `getter()` ์ ๊ด๋ จ๋ ๋ด์ฉ์ ์ฝ๋ค๊ฐ ์๊ฒ ๋ ๋ด์ฉ์ ๊ทธ๋๋ก ์ ์ฉํด๋ณธ ๊ฑฐ์์... ํํ... ์ ๋ ์ฒ์ ์ด ์์ด๋์ด๋ฅผ ์ ํ๊ณ ์ถฉ๊ฒฉ์ ๋ง์ด ๋ฐ์์ต๋๋ค ใ
- [getter() ๋ฅผ ์ฌ์ฉํ๋ ๋์ ๊ฐ์ฒด์ ๋ฉ์์ง๋ฅผ ๋ณด๋ด์ง](https://tecoble.techcourse.co.kr/post/2020-04-28-ask-instead-of-getter/)
- [Comparator ์ Comparable ์ ์ดํด](https://st-lab.tistory.com/243)
๋๋ฌด ์ข์ ์๋ฃ๋ค์ด๋ผ ํ๋ฒ ์ฝ์ด... |
@@ -0,0 +1,65 @@
+package racingcar.model;
+
+import racingcar.RacingNumberGenerator;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class Cars {
+
+ private static final String DUPLICATED_CAR_NAMES = "์๋์ฐจ๋ค์ ์ด๋ฆ... | Java | ์ ์ ํฉํ ๋ฆฌ ๋ฉ์๋ ๋ค์ด๋ฐ์ ์ปจ๋ฒค์
์ด ์กด์ฌํ๋ค๊ณ ์๊ณ ์์ต๋๋ค!
์ ๋ ๊ฐ์ธ์ ์ผ๋ก๋ ์ ์ ํ ์ด๋ฆ์ ์ง์ด์ฃผ๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํ์ง๋ง ์ปจ๋ฒค์
์ด๋๊น...! ์ปจ๋ฒค์
์ ์งํค๋ ๋ฐฉํฅ์ผ๋ก ์งํํ๊ณ ์์ด์...
- [์ ์ ํฉํ ๋ฆฌ ๋ฉ์๋์ ๋ค์ด๋ฐ ๋ฐฉ์](https://velog.io/@saint6839/%EC%A0%95%EC%A0%81-%ED%8C%A9%ED%86%A0%EB%A6%AC-%EB%A9%94%EC%84%9C%EB%93%9C-%EB%84%A4%EC%9D%B4%EB%B0%8D-%EB%B0%A9%EC%8B%9D) |
@@ -0,0 +1,48 @@
+package racingcar.model;
+
+import java.util.Objects;
+
+public class Position implements Comparable<Position> {
+
+ private static final int STARTING_POSITION = 0;
+
+ private int position;
+
+ public Position(int position) {
+ this.position = position;
+ }
+
+ public static Pos... | Java | ๋ง์ํด์ฃผ์ ๋๋ก ํ์ฌ ๋ฏธ์
์์๋ ๊ตณ์ด ์ผ๊ธ ๊ฐ์ฒดํํ ํ์๊ฐ ์๋ค๋ ๊ฒ์ ๋์ํฉ๋๋ค.
๋์ดํด์ฃผ์ ๊ทผ๊ฑฐ๋ค๋ ๋ชจ๋ ํ๋นํ๋ค๊ณ ์๊ฐํด์..!
๋ค๋ง ๋ฏธ์
์ ์งํํ๋ฉด์ ์ต๋ํ ๊ฐ์ฒด์งํฅ ์ํ ์ฒด์กฐ ์์น๋ค์ ์งํค๋ฉด์ ๊ตฌํํด๋ณด๋ ๊ฒ์ ๋ชฉํ๋ก ํ๊ณ ์์ด์. (๊ฐ์ฒด์งํฅ ์ํ ์ฒด์กฐ ์์น์ **๋ชจ๋ ์์ ๊ฐ๊ณผ ๋ฌธ์์ด์ ํฌ์ฅํ๋ค.** ๋ผ๋ ํญ๋ชฉ์ด ์๋๋ผ๊ตฌ์!) ์ผ์ข
์ ์ฐ์ต์ด๋ผ๊ณ ๋ด์ฃผ์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค! ์์ ๊ฐ์ ํฌ์ฅํ๋ ๊ฒ์ด ์ถํ์ ์๊ตฌ์ฌํญ์ด ๋ณํ์ ๋ ์ ์ง ๋ณด์์๋ ํฐ ์ด์ ์ด ์๋ค๋ ๊ฒ์ ๊ณ ๋ คํด์ ์ต์ง๋ก๋ผ๋ Wrapping ํ๋ ค๊ณ ๋
ธ๋ ฅํ๊ณ ์์ต๋๋ค...
- [์์ ํ์
์ ํฌ... |
@@ -0,0 +1,6 @@
+package racingcar;
+
+public interface RacingNumberGenerator {
+
+ int generate();
+} | Java | ์ ์ข์ ์๋ฃ ๊ฐ์ฌํฉ๋๋ค! ์ต๊ทผ์ ๋๋ค๋ฅผ ํ์ตํ๋ฉด์ ํจ์ํ ์ธํฐํ์ด์ค๋ ํจ๊ป ๊ณต๋ถํ์๋๋ฐ
์ง์ ํ์ฉํด๋ณผ ์๊ฐ์ ๋ชปํด๋ดค๋ค์. ์ง๊ธ ๋น์ฅ ๋ฆฌํฉํ ๋ง ํด๋ด์ผ๊ฒ ์ต๋๋ค! ๊ฐ์ฌํฉ๋๋ค!! |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ์ด ๋ถ๋ถ์ ๋ฉ์ธ์ง ๋ถ๋ถ์ด๋ผ view์์ ์ฒ๋ฆฌํ์ ๊ฒ ๊ฐ์๋ฐ, ์ด ๊ฒฝ์ฐ `cars`๊ฐ ์ง์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์๋ ์ง์ ๊บผ๋ด์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ธ ๊ฒ ๊ฐ์์ ์ฐจ๋ผ๋ฆฌ ๋ฉ์์ง๋ฅผ `cars`์์ ์ฒ๋ฆฌํ๋ ๊ฒ ๋ ๊ฐ์ฒด๋ฅผ ๋
๋ฆฝ์ ์ผ๋ก ๋ง๋๋ ๊ฒ ์๋๊น ํ๋ ์๊ฐ์ด ๋๋ค์! |
@@ -0,0 +1,37 @@
+package racingcar.view;
+
+import camp.nextstep.edu.missionutils.Console;
+import racingcar.model.AttemptCount;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class InputView {
+
+ private static final String SPLIT_REGEX = ",";
+ private static... | Java | ์ด๋ฌํ ๋ฉ์์ง๋ค์ ์ผ์ผ์ด ์์์ฒ๋ฆฌํ๋ฉด ๋์ค์ ๊ท๋ชจ๊ฐ ์ปค์ก์ ๋, ๊ด๋ฆฌํ๊ธฐ ํ๋ค์ด์ง๋ค๊ณ ํฉ๋๋ค. ์ฌ์ฌ์ฉ๋์ง ์๋ ๋ฉ์์ง๋ค์ ์ง์ ๊ฐ์ ๋ด์๋ณด๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,24 @@
+package racingcar.model;
+
+public class AttemptCount {
+
+ private static final int IS_OVER = 0;
+
+ private int count;
+
+ public AttemptCount(int count) {
+ this.count = count;
+ }
+
+ public static AttemptCount from(int count) {
+ return new AttemptCount(count);
+ }... | Java | ์ ๋ ๋ง์ด ๋ฐฐ์๊ฐ๋ค์ ๊ฐ์ฌํฉ๋๋ค :D |
@@ -0,0 +1,47 @@
+package racingcar.model;
+
+public class Car implements Comparable<Car> {
+ private static final int MOVABLE_LOWER_BOUND = 4;
+
+ private final CarName name;
+ private final Position position = Position.init();
+
+ private Car(String name) {
+ this.name = CarName.from(name);
+ }
... | Java | ์ ๋ ์ฌ๊ธฐ์ ๋๋๋๋ฐ ๋๋ถ์ ์ข์ ์ปจํ
์ธ ๋ค์ ๋ฐฐ์๊ฐ๋ค์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,44 @@
+package racingcar.model;
+
+import org.junit.jupiter.api.DisplayNameGeneration;
+import org.junit.jupiter.api.DisplayNameGenerator;
+import org.junit.jupiter.api.Test;
+import racingcar.RacingNumberGenerator;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+impor... | Java | ์ด ๋ถ๋ถ์ `RacingNumberGenerator`๋ผ๊ณ ํจ์ํ ์ธํฐํ์ด์ค๋ก ์ด๋ฏธ ์ ์ํด ๋์
จ์ผ๋ ์ง์ ๊ตฌํํ ํ์ ์์ด ๊ฐ๋จํ๊ฒ ๋๋ค๋ก ์ฒ๋ฆฌ๊ฐ ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,44 @@
+package racingcar.model;
+
+import org.junit.jupiter.api.DisplayNameGeneration;
+import org.junit.jupiter.api.DisplayNameGenerator;
+import org.junit.jupiter.api.Test;
+import racingcar.RacingNumberGenerator;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+impor... | Java | ```java
cars.race(() -> new Integer[]{4, 1, 4, 4, 1, 4})
```
์ด๋ฐ ๋๋์ผ๋ก์! |
@@ -0,0 +1,65 @@
+package racingcar.model;
+
+import racingcar.RacingNumberGenerator;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class Cars {
+
+ private static final String DUPLICATED_CAR_NAMES = "์๋์ฐจ๋ค์ ์ด๋ฆ... | Java | ์ซ์ ์์ฑํ๋ ๋ถ๋ถ์ ์์ฑ์๊ฐ ์๋ `race`์์ ์ฃผ์
๋ฐ์ ์๋ ์๋ค์! ํ๋ ๋ฐฐ์๊ฐ๋๋ค |
@@ -0,0 +1,44 @@
+package racingcar.model;
+
+import org.junit.jupiter.api.DisplayNameGeneration;
+import org.junit.jupiter.api.DisplayNameGenerator;
+import org.junit.jupiter.api.Test;
+import racingcar.RacingNumberGenerator;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+impor... | Java | ์ ๋ ํผ๋๋ฐฑ ๋ฐ๊ณ ๋ ๋ค ๋๋ค๋ก ํํํด๋ณด๋ ค๊ณ ํ๋๋ฐ `TestRacingNumberGenerator` ์ฒ๋ผ ๋ด๋ถ์ ์ํ๊ฐ ํ์ํ ๊ฒฝ์ฐ์ ์จ์ ํ ๋๋ค๋ก ํํํ๋๊ฒ ํ๋ค๋๋ผ๊ตฌ์!
๋ง์ฝ ๋๋ค๋ก ์ฒ๋ฆฌํ๋ ค๋ฉด
```java
cars.race(() -> newArrayList(4, 1, 4, 4, 1, 4).remove(0));
```
๊ณผ ๊ฐ์ ํํ๋ก ์ฌ์ฉํด์ผ ํ๋๋ฐ ์ด๋ ๊ฒ ๋๋ฉด ์ผ๋จ ๊ฐ๋
์ฑ์ด ๋๋ฌด ๋จ์ด์ง๋๋ผ๊ตฌ์.
๋ฌด์๋ณด๋ค๋ `race()` ๋ฅผ ์ฌ๋ฌ ๋ฒ ๋ฐ๋ณตํ๋๋ผ๋ ํญ์ *List*๊ฐ ์ด๊ธฐํ ๋๊ธฐ ๋๋ฌธ์ ํญ์ ๊ฐ์ ๊ฐ๋ง ๋ฐ๋ณตํ๊ฒ ๋๊ธฐ๋ ํ๊ตฌ์.
... |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ๋ง์ํด์ฃผ์ ๋๋ก *UI* ๋ฅผ ๋ค๋ฃจ๋ ๋ก์ง์ ๋๋ฉ์ธ ๋ด๋ถ์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ๋ง์์ ๊ฑธ๋ฆฌ๋๋ผ๊ตฌ์...
*UI* ์๊ตฌ์ฌํญ์ด ๋ณํ๋ฉด ๋๋ฉ์ธ ๋ด๋ถ์๋ ๋ณํ๊ฐ ๊ฐ์ ๋๋ค ๋ ๊ฒ ์คํ๋ ค ๊ฐ์ฒด ๋
๋ฆฝ์ฑ์ ํด์น๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๊ทธ๋์ ๊ฐ์ฒด๋ฅผ ์ง์ ๊บผ๋ด์ค๋ ๋์ ๋ค์๊ณผ ๊ฐ์ด ๋ถ๋ณ ๊ฐ์ฒด๋ก ๋ฆฌ์คํธ๋ฅผ ๋ฐํํ๋๋ก ์ฒ๋ฆฌํด์ฃผ์์ต๋๋ค.
```java
public List<Car> get() {
return Collections.unmodifiableList(cars);
}
```
๊ทธ๋๋ ์ญ์ ์ผ๊ธ ์ปฌ๋ ์
๋ด์ ์ํ๋ฅผ ์ง์ ๊บผ๋ด์์ ์ฌ์ฉํ๋ ๊ฒ ๋๋ฌด ์ฐ์ฐํ๊ธด ํ๋๋ผ๊ตฌ์... |
@@ -0,0 +1,37 @@
+package racingcar.view;
+
+import camp.nextstep.edu.missionutils.Console;
+import racingcar.model.AttemptCount;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class InputView {
+
+ private static final String SPLIT_REGEX = ",";
+ private static... | Java | ์ ๊ฐ ์๊ฐํ์ ๋ ์์๋ฅผ ์ฌ์ฉํ๋ ์ด์ ์๋
- ํด๋์ค ๊ฐ, ๋ฉ์๋ ๊ฐ ๊ฐ์ ์ฌ์ฌ์ฉํ๋ ์ธก๋ฉด๋ ์์ง๋ง
- **์ธ์คํด์ค ๊ฐ์ ๊ฐ์ ๊ณต์ **ํ๋ ์ธก๋ฉด๋ ์๋ค๊ณ ์๊ณ ์์ต๋๋ค!
- (์ด๋ฆ์ ์ง์ด์ค์ผ๋ก์จ ๊ฐ๋
์ฑ์ ๊ณ ๋ คํ๋ ์ธก๋ฉด๋ ์๊ตฌ์!)
`InputView` ์์ ์ฌ์ฉ๋๋ ์๋ฌ ๋ฉ์์ง๋ค ๊ฐ์ ๊ฒฝ์ฐ ์ธ์คํด์ค์ ์ํ์ ๋ฌด๊ดํ๊ฒ ํญ์ ๊ฐ์ด ๊ณ ์ ๋์ด ์์ต๋๋ค.
์ด๋ฐ ๊ฒฝ์ฐ ํ๋์ฝ๋ฉ๋ ๊ฐ์ `static final` ๋ก ์ ์ธํด์ฃผ๋ฉด ํ๋ก๊ทธ๋จ ์คํ ๋จ๊ณ์์ ๋ฑ ํ๋ฒ๋ง ์ด๊ธฐํ๋๊ธฐ ๋๋ฌธ์
์๋ก ๋ค๋ฅธ ์ธ์คํด์ค๋ฅผ ์ฌ๋ฌ ๋ฒ ํธ์ถํ๋๋ผ๋ ์ธ์คํด์ค์ ํจ๊ป ๋งค๋ฒ ์ด๊ธฐํํด ์ค ํ์๊ฐ ์... |
@@ -0,0 +1,37 @@
+package racingcar.view;
+
+import camp.nextstep.edu.missionutils.Console;
+import racingcar.model.AttemptCount;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class InputView {
+
+ private static final String SPLIT_REGEX = ",";
+ private static... | Java | ์คํธ ์ข์ ์ต๊ด์ธ ๊ฒ ๊ฐ์์ ใ
ใ
ํ๋์ฝ๋ฉ๋ ๊ฐ์ ์ฌ์ฉํ์ง ์๋ค๊ฐ ์ฌ์ฉํ๋ ๊ฑด ์ผ์ผ์ด ์์ํ๊ธฐ ํ๋ค์ง๋ง, ์์๋ฅผ ์ฌ์ฉํ๋ ์์ผ๋ก ์ฝ๋ฉํ๋ค๊ฐ ๊ฐ์ ์ง์ ์ฐ๋ ๋ฐฉ์์ผ๋ก ์ ํํ๊ธฐ ์ฌ์ธ ํ
๋๊น์
์ด๋ฌํ ํผ๋๋ฐฑ์ ๋๋ฆฐ ์ด์ ๋ ํ๋ฆฌ์ฝ์ค ์ธ์ ์ธํดํ๋ ํ์ฌ์์ `์์ธ ๋ฉ์ธ์ง์ ์์ ๊ฐ์ ์ง์ ๋ค ๋ฐ์ ๊ฒฝ์ฐ ์์๋ฅผ ๋ฌด๋ถ๋ณํ๊ฒ ๋ง์ด ์ฌ์ฉํ๊ฒ ๋ผ์ ์ฝ๋๋ฅผ ์ฝ์ ๋ ์ ์ ๋ฌด์์ด ์ค์ํ์ง ํ๋ณํ๊ธฐ ํ๋ค์ด์ง๊ณ ์ฝ๋๊ฐ ๊ธธ์ด์ง๋ค๋ ๋ฌธ์ ์ ์ด ๋ฐ์ํ๋ค` ๋ผ๋ ํผ๋๋ฐฑ์ ๋ฐ์๊ธฐ ๋๋ฌธ์ธ๋ฐ์
๋ง์ํ์ ๊ฒ์ฒ๋ผ ์ฐ์ต์ ๊ณผ์ ์ด๋ผ๋ฉด ์คํ๋ ค ์ข์ ์ ํธ๊ฒ ๋ค์! ๐ |
@@ -0,0 +1,44 @@
+package racingcar.model;
+
+import org.junit.jupiter.api.DisplayNameGeneration;
+import org.junit.jupiter.api.DisplayNameGenerator;
+import org.junit.jupiter.api.Test;
+import racingcar.RacingNumberGenerator;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+impor... | Java | ๊ทธ๋ ๊ตฐ์! ์ฌ์ค ์ด ๋ถ๋ถ์ ์ทจํฅ์ด๋ผ ๋ ๊ฐ๋จํ๊ฒ ํํ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์ ๋ง์๋๋ฆฐ ๋ถ๋ถ์ด์์ต๋๋ค ใ
ใ
์ ๊ฐ์ ๊ฒฝ์ฐ์๋ js๋ง ์ฌ์ฉํ๋ค๊ฐ ์ด๋ฒ ํ๋ฆฌ์ฝ์ค์์ ์๋ฐ๋ฅผ ์์ํ๋๋ฐ ์คํ๋ ค ๋ฉ์๋์ ์ฌ๊ณ ํ๋๊ฒ ํ๋ค๋๋ผ๊ตฌ์ ์์ด๋ ๊ฒ ์ง์ ์ ๋๋ ๋ถ๋ถ๋ค์ด ๋ง์์ง...ใ
ใ
์ฒจ๋ถํด์ฃผ์ ๋ด์ฉ์ ๋ํด ๋ง๋ถ์ด์๋ฉด ์ ์ค๋ช
์์ ๋งํ๊ณ ์๋๊ฑด ํจ์ํ ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋ฉด ์ธ์๋ก ํจ์๋ฅผ ๋๊ธธ ์ ์๊ฒ ๋๋ค๋ ๊ฑธ ๋งํ๋ ๊ฒ ๊ฐ์ต๋๋ค. (js์ฒ๋ผ์!) ์ด๋ฐ ํน์ง์ `์ผ๊ธํจ์`๋ผ๊ณ ๋ถ๋ฅด๋๋ฐ์, ์ด ์ผ๊ธํจ์๋ ํจ์ํ ํ๋ก๊ทธ๋๋ฐ ์ํํ๊ธฐ ์ํ ์ต์ํ์ ์กฐ๊ฑด์ด ๋ฉ๋๋ค.
๋ฐ๋ผ์, ํจ... |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ์ ์ฐ์ ์ ์ ๋ ๋ฉ์ธ์ง๋ฅผ ๋ง๋๋ ๋ถ๋ถ ์์ฒด๋ฅผ UI ๋ก์ง์ด๋ผ๊ณ ์๊ฐํ๊ธฐ ๋ณด๋ค๋ ๋๋ฉ์ธ์์ ํด๊ฒฐ ๊ฐ๋ฅํ ์์ญ์ด๋ผ๊ณ ์๊ฐํ์ต๋๋ค. ์๋ํ๋ฉด ์ด๋ฏธ `Car`์์ ํด๋น ์ํ์ ๋ํด ๋ชจ๋ ๊ฑธ ์๊ณ ์๋๋ฐ ์ด๋ฅผ ๊ตณ์ด ๋ฐ์ผ๋ก ๊บผ๋ธ๋ค๋ฉด ์บก์ํ๊ฐ ๊นจ์ง๋ค๊ณ ์๊ฐํ๊ฑฐ๋ ์. ๊ทธ๋ฐ๋ฐ ๋ง์ํด์ฃผ์ ๋ด์ฉ์ ์ฝ์ด๋ณด๋ ์ด๋ฅผ UI๋ผ๊ณ ์๊ฐํ๋ฉด ์ ์ด์ ๋ค๋ฅธ ์์ญ์ผ๋ก ๋์ ธ์ฃผ๋ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ ๊ทธ๋๋ก ๊บผ๋ธ๋ค๊ณ ํด์ ์บก์ํ๊ฐ ๊นจ์ง๋ ๊ฑด ์๋๊ฐ? ํ๋ ์๊ฐ๋ ๋ค๊ณ ์ด๋ ต๋ค์ ใ
ใ
์ฌ์ค ์ ๋ `getter`๋ฅผ ๋ฌด์กฐ๊ฑด์ ์ผ๋ก ๋ฐฐ์ ํ๋ ๊ฒ์ ์ณ์ง ์๋ค๊ณ ์๊ฐํ๋ ์ฃผ์๊ธฐ๋ ํ๊ตฌ์! ๋ค ํ์ํ๋๊น ์ฐ๋ ๊ฒ์ธ๋ฐ ํ๋ ์๊ฐ... |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ์์์ฒ๋ฆฌ๊ฐ ์ ๋ง ๊น๋ํ๋ค์!
ํนํ SCORE_BOARD ๋ถ๋ถ ๋ฐฐ์๊ฐ๋๋ค. |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ์ ๋ @khj1 ๋๊ณผ ๊ฐ์ ์ด์ ๋ก getter๋ฅผ ์ฌ์ฉํ๋๋ฐ์,
๊ฐ์ธ์ ์ผ๋ก๋ `์ถ๋ ฅ์ ์ํ getter๋ ์บก์ํ๋ฅผ ์๋ฐฐํ๋ ๊ฒ ์๋๋ค` ๋ผ๊ณ ์๊ฐํฉ๋๋ค.
๋ฌผ๋ก ์๋์ ๋ค๋ฅด๊ฒ ์ฌ์ฉ๋๋ ๊ฒฝ์ฐ ์บก์ํ๋ฅผ ์ ํด์ํฌ ์ ์์ต๋๋ค. ์ด ๋ถ๋ถ์ ์ด์ฉ ์ ์๋ ๋จ์ ์ด๋ผ๊ณ ์๊ฐํด์.
๊ฐ์ธ์ ์ผ๋ก ํ๋ฆฌ์ฝ์ค ๊ธฐ๊ฐ ๋์ '๊ฐ์ฒด์ ์์จ์ฑ์ ์ผ๋ง๋ ํ์ฉํด์ค์ผ ํ๋์ง' ๋ฅผ ๊ณ์ ๊ณ ๋ฏผํ๋๋ฐ, ์ ๊ฐ ๋ค๋ค๋ฅธ ๊ฒฐ๋ก ์ '๊ฐ์ฒด๋ UI ๋ก์ง ์ธ์ ๊ฒฝ์ฐ์์ ์์จ์ฑ์ ๋ณด์ฅํด์ค์ผ ํ๋ค' ์์ต๋๋ค.
๊ฐ์ฒด์งํฅ์ ์ฌ์ฉํ๋ ์ด์ ๋ ๊ฒฐ๊ตญ '์์จ์ฑ'๋ณด๋ค๋ '์ ์ฐ์ฑ'์ด๋๊น์! UI ๋ก์ง์ ๋ณ๊ฒฝ์ด ๋๋ฉ์ธ ์์ญ์... |
@@ -0,0 +1,57 @@
+package racingcar.view;
+
+import racingcar.model.Car;
+import racingcar.model.CarName;
+import racingcar.model.Cars;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OutputView {
+
+ private static final String NEW_LINE = "\n";
+ private static final String SCORE_U... | Java | ์ ๋ ๊ฐ์ธ์ ์ผ๋ก MVC ์์ View๋ ์ปจํธ๋กค๋ฌ๋ก๋ถํฐ ๋์ ์ธ ์ ๋ณด๋ง ๋ฐ์์ผ ํ๋ค๊ณ ์๊ฐํ๋๋ฐ์! ํน์ ์ด๋ฐ ์ ๊ทผ ๋ฐฉ๋ฒ์ ์ด๋ ์ค๊น์?
์ ๊ฐ ์ด๋ ๊ฒ ์๊ฐํ๋ ์ด์ ๋, ๊ด์ฌ์ฌ๊ฐ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์
๋๋ค.
์๋ฌ ์ฒ๋ฆฌ์ ๊ดํ ์ถ๋ ฅ์ ํด๋น try-catch ๋ธ๋ก์ ์ฑ
์์ด ์๋ค๊ณ ์๊ฐํด์.
์ฌ์ค ์ ๋ต์ ์๋ ๊ฒ ๊ฐ์ผ๋, ์ ๊ฐ ๊ณ ์ํ๋ ๋ฐฉ๋ฒ์ ์ด๋ค์ง ์ ์๋๋ ค ๋ด
๋๋ค. |
@@ -0,0 +1,47 @@
+package racingcar.model;
+
+public class Car implements Comparable<Car> {
+ private static final int MOVABLE_LOWER_BOUND = 4;
+
+ private final CarName name;
+ private final Position position = Position.init();
+
+ private Car(String name) {
+ this.name = CarName.from(name);
+ }
... | Java | ์ ๋ ๋ฐฐ์๊ฐ๋๋ค!! ์ด๋ฐ ์์ผ๋ก ๋น๊ต๋ ๊ฐ๋ฅํ๊ตฐ์.. |
@@ -0,0 +1,52 @@
+package racingcar.model;
+
+import java.util.Objects;
+
+public class CarName {
+
+ private static final String INVALID_NAME_LENGTH = "์๋์ฐจ ์ด๋ฆ์ 5์๋ฅผ ์ด๊ณผํ ์ ์์ต๋๋ค.";
+ private static final int NAME_LENGTH_UPPER_BOUND = 5;
+
+ private final String name;
+
+ public CarName(String name) {
+ ... | Java | hashCode๊ฐ ์ฌ์ฉ๋์ง ์๋ ๊ฒ ๊ฐ์, ๋ฐ๋ก ์ค๋ฒ๋ผ์ด๋ฉ ํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,52 @@
+package racingcar.model;
+
+import java.util.Objects;
+
+public class CarName {
+
+ private static final String INVALID_NAME_LENGTH = "์๋์ฐจ ์ด๋ฆ์ 5์๋ฅผ ์ด๊ณผํ ์ ์์ต๋๋ค.";
+ private static final int NAME_LENGTH_UPPER_BOUND = 5;
+
+ private final String name;
+
+ public CarName(String name) {
+ ... | Java | get ๋ฉ์๋๊ฐ toString๊ณผ ์ค๋ณต๋๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,63 @@
+package racingcar.cotroller;
+
+import racingcar.RandomRacingNumberGenerator;
+import racingcar.model.AttemptCount;
+import racingcar.model.Cars;
+import racingcar.view.InputView;
+import racingcar.view.OutputView;
+
+import java.util.List;
+import java.util.function.Supplier;
+
+public class RacingCa... | Java | ๋ฐ๋ก ์ปจํธ๋กค๋ฌ์์ RandomRacingNumberGenerator๋ฅผ ์ฃผ์
ํด์ฃผ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค.
์ ์๊ฐ์๋, RandomRacingNumberGenerator๋ฅผ race ๋ฉ์๋ ๋ด์์ ์ ์ธํ๋ฉด ์ปจํธ๋กค๋ฌ์์ ์์์ผ ํ ๊ด์ฌ์ฌ๊ฐ ํ๋ ์ค์ด๋๋ ์ด์ ์ด ์์ ๊ฒ ๊ฐ์์์! |
@@ -1,29 +1,51 @@
package lotto.domain;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.stream.Collectors;
public class Lotto {
- private List<Integer> lotto;
+ private List<LottoNumber> lotto;
- public Lotto(List<Integer> list) {
- lotto = n... | Java | ๋ญ ํฌํจํ๊ณ ์๋ค๋๊ฑฐ์ฃ ? |
@@ -1,29 +1,51 @@
package lotto.domain;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.stream.Collectors;
public class Lotto {
- private List<Integer> lotto;
+ private List<LottoNumber> lotto;
- public Lotto(List<Integer> list) {
- lotto = n... | Java | Builder ํจํด๊ณผ ๋ฉ์๋ ์ฒด์ด๋ ๊ณต๋ถํ์๊ณ stringBuilder ๋ค์ ์จ๋ณด์ธ์ |
@@ -1,29 +1,51 @@
package lotto.domain;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.stream.Collectors;
public class Lotto {
- private List<Integer> lotto;
+ private List<LottoNumber> lotto;
- public Lotto(List<Integer> list) {
- lotto = n... | Java | ๊ทธ๋ฆฌ๊ณ ์ ๋ง toString์ ์ด๋ ๊ฒ ๊ตฌํํ์๊ฒ ์ต๋๊น? |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | text ๋ณด๋ค ์ข์ ๋ค์ด๋ฐ์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | contrivedNumber ๋ณด๋ค ์ข์ ๋ค์ด๋ฐ์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | ์ด๋์๋ menual์ด๊ณ ์ฌ๊ธฐ์๋ manual์ด๊ณ ์คํ ๋ง์ด ๋๋์ฒด ๋ญ์ฃ ? |
@@ -0,0 +1,67 @@
+package lotto.domain;
+
+import java.util.Arrays;
+
+public enum Rank {
+ FIRST(6, 2000000000),
+ SECOND(5, 30000000),
+ THIRD(5, 1500000),
+ FOURTH(4, 50000),
+ FIFTH(3, 5000),
+ MISS(0, 0);
+
+ private static final int PRIZE_MIN_NUMBER = 3;
+
+ private int matchCount;
+ pr... | Java | ์ข ๋ ์ข์ ๋ฉ์๋ ๋ค์ด๋ฐ |
@@ -0,0 +1,67 @@
+package lotto.domain;
+
+import java.util.Arrays;
+
+public enum Rank {
+ FIRST(6, 2000000000),
+ SECOND(5, 30000000),
+ THIRD(5, 1500000),
+ FOURTH(4, 50000),
+ FIFTH(3, 5000),
+ MISS(0, 0);
+
+ private static final int PRIZE_MIN_NUMBER = 3;
+
+ private int matchCount;
+ pr... | Java | set์ด๋ผ๋ ๋ช
์นญ์ ํด๋์ค ํ๋๋ค์ ๊ฐ์ ์ธํ
ํ ๋ ์ฌ์ฉํ๋๊น ๋ค๋ฅธ ๋ช
์นญ์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | ์คํ์
๋๋ค |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | 1000์ด๋ ๊ฐ์ ํ๋์ฝ๋ฉ์ค |
@@ -0,0 +1,17 @@
+package lotto.domain;
+
+public class WinningLotto extends Lotto {
+ private Lotto lotto;
+ private int matchCount;
+ private boolean hasbonusNumber;
+
+ public WinningLotto(Lotto lotto, int matchCount, LottoNumber bonusNumber) {
+ this.hasbonusNumber = lotto.hasThisNumber(bonusNumb... | Java | get set ์ง์๋ณด๊ณ ์๊ฐํด๋ณด์ญ์ผ (๊ฐ์ฒด์งํฅ ์ํ์ฒด์กฐ ๊ท์น get set ์ฌ์ฉ์ ์์ ํ๋ค) |
@@ -3,77 +3,78 @@
import lotto.utils.Splitter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class LottoGame {
- private List<Lotto> lottos = new ArrayList<Lotto>();
+ private static final int LOTTO_PRICE = 1000;
+ private List<Lotto> lottos;
+ private List... | Java | ์ด ํด๋์ค๊ฐ ๋๋ฌด ๋ฌด๊ฑฐ์๋ณด์
๋๋ค. ๋๋ฌด ๋ง์ ์ฑ
์์ ๊ฐ๊ณ ์๋๊ฑด ์๋์ง ํ๋ฒ ๋ด๋ณด์ธ์ |
@@ -0,0 +1,32 @@
+package lotto.domain;
+
+import lotto.utils.Splitter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class LottoGenerator {
+ List<LottoNumber> randomNumbers;
+
+ public LottoGenerator() {
+ randomNumbers = new ArrayList<>();
+ }
+
+ ... | Java | generateAuto() ๊ฐ ๋ซ์ง ์์๊น์ |
@@ -0,0 +1,32 @@
+package lotto.domain;
+
+import lotto.utils.Splitter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class LottoGenerator {
+ List<LottoNumber> randomNumbers;
+
+ public LottoGenerator() {
+ randomNumbers = new ArrayList<>();
+ }
+
+ ... | Java | generateMenual ์ด ๋ซ์ง ์์๊น์. menual์ธ์ง manual์ธ์ง ํต์ผ ์์ผ๋ฌ๋ผ๋๊น ๋ฌด์๋นํ๋ค์ |
@@ -6,13 +6,14 @@ import ReviewContent from "./ReviewContent";
import ArrowDown from "@/assets/images/icons/arrow_down.svg";
import MenuCircle from "@/assets/images/icons/menu-circle.svg";
import Dropdown from "@/components/common/Dropdown";
+import useReviewModals from "@/hooks/review/useReviewModals";
import { ty... | Unknown | @ITHPARK ๋ฆฌ๋ทฐ ์ญ์ api ์ฐ๊ฒฐํ๋ฉด์ ํด๋น ์ปดํฌ๋ํธ ์ผ๋ถ ์์ ๋์์ต๋๋ค! |
@@ -11,6 +11,8 @@ export interface ReviewInfo {
isMyWritten?: boolean;
eventId?: number;
eventType?: string;
+ reviewId: number;
+ editable?: boolean;
}
export interface ReviewInfoProps { | TypeScript | ๋ฆฌ๋ทฐ ํ์
์ `reviewId`, `editable` ์ถ๊ฐํ์ต๋๋ค |
@@ -0,0 +1,79 @@
+import React, { useState } from "react";
+import { useNavigate } from 'react-router-dom';
+import "../../../style/reset.scss";
+import "../../../style/common.scss";
+import "../../../style/variables.scss"
+import "./Login.scss";
+
+
+const Login = () => {
+
+ const [userInfo, setUserInfo] = useSt... | JavaScript | ๐ ์ข์ต๋๋ค! ๊ณ์ํด์ ์ด๋ ๊ฒ ์ธ์
๋ด์ฉ ๋ฐ๋ก๋ฐ๋ก ์ ์ฉํด์ฃผ๋ฉด์ ๋ณธ์ธ์ ์ง์์ผ๋ก ๊ฐ์ ธ๊ฐ์ฃผ์๋ฉด ์ข๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,79 @@
+import React, { useState } from "react";
+import { useNavigate } from 'react-router-dom';
+import "../../../style/reset.scss";
+import "../../../style/common.scss";
+import "../../../style/variables.scss"
+import "./Login.scss";
+
+
+const Login = () => {
+
+ const [userInfo, setUserInfo] = useSt... | JavaScript | ์ฝ๋์ ์ฃผ์์ด ๋ง์ต๋๋ค!
์ถํ์ ๋ค์ ํ์ตํ ์ฉ๋๋ก ๋จ๊ฒจ๋์ ์ฃผ์์ด๋ผ๋ฉด, ํด๋น๋ด์ฉ์ ๋ฐ๋ก ๋ธ๋ก๊ทธ๋ ๊ฐ์ธ ๋ฉ๋ชจ์ ์์ฑ์ ํด ์ฃผ์๊ณ , ์ฝ๋๋ฅผ github์ ํตํด ์ฌ๋ ค์ฃผ์ค๋๋ ๋ถํ์ํ ์ฝ๋๋ฅผ ์ต๋ํ ์ค์ฌ์ฃผ์ธ์! |
@@ -0,0 +1,79 @@
+import React, { useState } from "react";
+import { useNavigate } from 'react-router-dom';
+import "../../../style/reset.scss";
+import "../../../style/common.scss";
+import "../../../style/variables.scss"
+import "./Login.scss";
+
+
+const Login = () => {
+
+ const [userInfo, setUserInfo] = useSt... | JavaScript | ```suggestion
<div className="inputTxt">
```
์ ์ฝ๋ ์ฒ๋ผ js์ ๊ธฐ๋ณธ ์ปจ๋ฒค์
์ `camelCase`์
๋๋ค! className์ ์์ฑํ ๋์๋ ์ ๊ฒฝ์จ์ฃผ์
์ผํฉ๋๋ค! |
@@ -0,0 +1,79 @@
+import React, { useState } from "react";
+import { useNavigate } from 'react-router-dom';
+import "../../../style/reset.scss";
+import "../../../style/common.scss";
+import "../../../style/variables.scss"
+import "./Login.scss";
+
+
+const Login = () => {
+
+ const [userInfo, setUserInfo] = useSt... | JavaScript | ํด๋น scssํ์ผ๋ค์ Index.js์์ import ํด์์ ์ ์ญ์ผ๋ก ์ ์ฉ์ํค๋๊ฒ ์ข์ต๋๋ค. |
@@ -0,0 +1,87 @@
+@import '../../../style/variables.scss';
+@import '../../../style/reset.scss';
+
+
+body {
+ font-size: 14px;
+}
+input {
+ outline: none;
+}
+
+.login {
+ width: 100%;
+ height: 100vh;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ .box {
+ ... | Unknown | ๋ง์ฐฌ๊ฐ์ง ์
๋๋ค! font๊ฐ์ ์์ฑ๋ค๋ common.scss์ ์์ฑํด์ ์ ์ญ์ผ๋ก ๊ด๋ฆฌํ ์ ์๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,87 @@
+@import '../../../style/variables.scss';
+@import '../../../style/reset.scss';
+
+
+body {
+ font-size: 14px;
+}
+input {
+ outline: none;
+}
+
+.login {
+ width: 100%;
+ height: 100vh;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ .box {
+ ... | Unknown | variables.scssํ์ผ์ ์์ผ๋ฉด ๋ ๋ณ์๋ค์ด๋ค์! |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | index.js์์ ์ ์ญ์ผ๋ก importํ๋ค๋ฉด ์ด๋ ๊ฒ ํ์ผ๋ง๋ค ๋งค๋ฒ import ํ์ง์์๋ ๋ฉ๋๋ค! |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | `comment`๋ผ๋ ๋ณ์๋ช
์ด ์์ฑ๋์ด์๋ comment๋ค์ ๋ชจ์์ธ์ง, ๋ด๊ฐ input์ ์
๋ ฅํ ๊ฐ์ ๊ด๋ฆฌํ๋ ๋ณ์์ธ์ง ์ด๋ฆ๋ง ๋ดค์ ๋ ๋ฐ๋ก ์ถ์ธกํ๊ธฐ ์ด๋ ต์ต๋๋ค.
์๋์ commentArray๋ผ๋ ๋ณ์๋ ๋ง์ฐฌ๊ฐ์ง๋ก ์กฐ๊ธ ๋ ๋ณ์๊ฐ ์ด๋ค state๋ฅผ ๊ฐ์ง๊ณ ์๋์ง ๋ช
ํํ ์ด๋ฆ์ผ๋ก ์์ฑํด์ฃผ์๋ฉด ์ข๊ฒ ์ต๋๋ค |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | ```suggestion
setCommentArray(commentList => [ ...commentList,comment]);
```
์ด ๋๊ฐ์ ์ฐจ์ด์ ์ ํ์คํ ์๊ณ ๋์ด๊ฐ์ฃผ์
จ์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค!! |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | Input์ ๊ฐ์ด ๋น์ด์์๋ ํจ์๊ฐ ๊ทธ๋ฅ ์๋ฌด๋ฐ ๋์์ ํ์ง ์๋๋ค๋ฉด ๊ธฐ๋ฅ์ ์๋ฌ์ธ์ง, ์๋๋ ๋์์ธ์ง ํ์
ํ๊ธฐ ์ด๋ ต์ต๋๋ค.
`comment` ๊ฐ์ด ๋น์ด์๋ค๋ฉด ํจ์๊ฐ ํธ์ถ๋ ๋ `alert`๋ฅผ ํ์ํด์ฃผ๋ ๋ฑ์ ์ถ๊ฐ์ ์ธ ์กฐ์น๊ฐ ์์ผ๋ฉด ์ข์ต๋๋ค |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | map ๋ฉ์๋์ ์ฝ๋ฐฑํจ์์ ๋๋ฒ ์งธ ์ธ์, ์ฆ ์งํฌ๋์ ์ฝ๋์์ user๋ผ๊ณ ํ๋ ๋ณ์๋ ๊ธฐ์ค๋ฐฐ์ด(commnetArray)์ value(๋ฐฐ์ด์ ๊ฐ๊ฐ์ ์์)๋ง๋ค์ index(๋ฐฐ์ด๋ด์ ์์)๋ฅผ ๋ํ๋
๋๋ค. ๋ฆฌ์กํธ์์ ๋ฐ๋ณต๋ฌธ์ ์ฌ์ฉํด์ key ์์ฑ์ ๊ผญ ๋ถ์ฌํ๋ผ๊ณ ํ๋ ์ด์ ๋ ํด๋น์์๋ฅผ ๋ฆฌ์กํธ๊ฐ ๋ช
ํ์ด ์ธ์ํ๊ธฐ ์ํจ์ธ๋ฐ, ๋ฐฐ์ด์ index๋ฅผ key๊ฐ์ผ๋ก ๋ถ์ฌํ๋๊ฒ์ ์กฐ๊ธ ์ง์ํ๋ ๋ฐฉ๋ฒ์
๋๋ค. ์ด๋ค ๊ฐ์ผ๋ก key ์์ฑ์ ๋ถ์ฌํด์ผํ ์ง ์กฐ๊ธ ๋ ๊ณ ๋ฏผํด๋ณด์ธ์! |
@@ -0,0 +1,163 @@
+import React, { useState, useEffect } from "react";
+import MainFeeds from "./MainFeeds";
+import "./Main.scss";
+import compass from "../assets/icon/compass.png";
+import heart from "../assets/icon/heart.png";
+import instagram from "../assets/icon/instagram.png";
+import search from "../assets/icon... | JavaScript | ๊ตณ์ด ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ง์๋๋ผ๋ `<textarea></textarea>`ํ๊ทธ๋ฅผ ์ฌ์ฉํ๋ฉด multiline input์ ํ์ฉํ ์ ์์ต๋๋ค. |
@@ -0,0 +1,264 @@
+@import '../../../style/reset.scss';
+@import '../../../style/variables.scss';
+
+body {
+ font-size: 14px;
+}
+.logo {
+ font-family: "Lobster";
+ src: url(../assets/Lobster-Regular.ttf);
+}
+input {
+ outline: none;
+}
+
+.navIcon {
+ width: 24px;
+ margin-left: 20px;
+}
+
+.navLeft{
+ .icon... | Unknown | ์์ ๋จ๊ฒจ๋๋ฆฐ ๋ด์ฉ์ ๋ฆฌ๋ทฐ์ ๋์ผํฉ๋๋ค |
@@ -1,37 +1,20 @@
import java.util.List;
+import java.util.Set;
-import domain.LottoGame;
-import domain.LottoResults;
-import domain.WinningAnalyzer;
-import domain.WinningStatistics;
+import domain.ManualRequest;
import view.LottoInputView;
-import view.LottoOutputView;
public class LottoController {
- priv... | Java | ์ผ๊ธ ์ปฌ๋ ์
์ ์จ๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -1,13 +0,0 @@
-import view.LottoInputView;
-
-public class LottoMain {
-
- public static void main(String[] args) {
- int money = LottoInputView.getMoney();
- LottoController lottoController = new LottoController();
- lottoController.playLottoGames(money);
- lottoController.getLottoRes... | Java | - ๊ฐ ๋์
, ๋ฉ์๋ ํธ์ถ๊ณผ ๊ฐ์ด ๊ฐ๋
์ ์ ์ฌ์ฑ์ด ๋ค๋ฅธ ์ฝ๋๋ค๊ฐ์๋ ๊ฐํ์ผ๋ก ๊ฐ๋
์ฑ์ ๋ํ์ค ์ ์์ต๋๋ค.
- ์ปจํธ๋กค๋ฌ์๊ฒ ์ธ๋ถ ๊ธฐ๋ฅ๋ค์ ํธ์ถํ๊ณ ์์ต๋๋ค. ์ด๊ฑด ๋น์ฆ๋์ค๋ก์ง ์ค์ผ์คํธ๋ ์ด์
์ผ๋ก ๋ณด์ฌ์. ๊ทธ๋ฅ ์ ์ ํ Request ๊ฐ์ฒด๋ฅผ ์ ๋ฌํ๊ณ ์ต์ข
๊ฒฐ๊ณผ๋ง ๋ฐํ๋ฐ์์ ์ถ๋ ฅ๊ณ์ธต์๊ฒ ์ ๋ฌํ๋ฉด ๋ ๊ฒ ๊ฐ์์.
- ํ์ฌ ๊ตฌ์กฐ๋ฅผ ๋ณด๋ฉด LottoMain์ด ์ปจํธ๋กค๋ฌ์ ์ญํ ์ ํ๊ณ ์๊ณ , LottoController๊ฐ Service Layer์ ์ญํ ์ ํ๊ณ ์์ต๋๋ค. ๊ทธ๋ผ ์ฐจ๋ผ๋ฆฌ Controller์์ View Layer๋ฅผ ๋ถ๋ฆฌํด LottoMain์ผ๋ก ์ฎ๊ธฐ์๊ณ LottoCo... |
@@ -0,0 +1,15 @@
+package domain;
+
+public class GameCount {
+ private final int manualCount;
+ private final int automaticCount;
+
+ public GameCount(int totalCount, int manualCount) {
+ this.manualCount = manualCount;
+ this.automaticCount = totalCount - manualCount;
+ }
+
+ public int g... | Java | ๋ด๋ถ์ ์ผ๋ก ๊ฐ์ด ๋ณ๊ฒฝ๋์ง ์๋๋ค๋ฉด final ํค์๋๋ฅผ ํตํด ๋ถ๋ณ์ฑ ํ๋ณด๋ฅผ ํ ์ ์์ ๊ฒ ๊ฐ๋ค์. |
@@ -1,23 +1,47 @@
package domain;
+import java.util.List;
+import java.util.Set;
+
public class LottoGame {
private LottoResults lottoResults;
-
private Money money;
+ private WinningAnalyzer winningAnalyzer;
public LottoGame() {
this.lottoResults = new LottoResults();
}
- pub... | Java | ์ด๋ฐ ์ฐธ์กฐํ์
๋ ์ผ๊ธ ์ปฌ๋ ์
์ ์ด์ฉํด์ ๋ด๋ถ ์ธ๋ฑ์ค ์ ์ด๋ฅผ ์ฑ
์ ๋ถ๋ฆฌํ ์ ์์ ๊ฒ ๊ฐ์์. |
@@ -1,23 +1,47 @@
package domain;
+import java.util.List;
+import java.util.Set;
+
public class LottoGame {
private LottoResults lottoResults;
-
private Money money;
+ private WinningAnalyzer winningAnalyzer;
public LottoGame() {
this.lottoResults = new LottoResults();
}
- pub... | Java | Money๊ฐ์ฒด์ธ๋ฐ count์ ๋ณด๊น์ง ๋ด์๋ฒ๋ฆฌ๋ฉด ์ผ๊ธ ๊ฐ์ฒด๋ก์จ์ ํจ์ฉ์ด ๋จ์ด์ง๊ณ ๊ฐ์ฒด ์๊ทธ๋์ฒ๊ฐ ๋ถ๋ถ๋ช
ํด์ง ๊ฒ ๊ฐ๋ค์ ๐ค |
@@ -1,23 +1,47 @@
package domain;
+import java.util.List;
+import java.util.Set;
+
public class LottoGame {
private LottoResults lottoResults;
-
private Money money;
+ private WinningAnalyzer winningAnalyzer;
public LottoGame() {
this.lottoResults = new LottoResults();
}
- pub... | Java | ์๋,์๋ ๋ก๋๋ฉด ๊ทธ๋ฅ LottoNumber, Lotto, Lottos ์ ๋๋ก ๋ค์ด๋ฐ์ ์ง์ด๋ ๋ ๊ฒ ๊ฐ๋ค์ Result๋ผ๊ณ ํ๋ ๋ญ๊ฐ ๋น๊ต๊น์ง ๋ค ๋๋ ์ต์ข
๊ฒฐ๊ณผ๋ฅผ ์๋ฏธํ๋ ๊ฑธ๋ก ๋ณด์
๋๋ค. |
@@ -1,23 +1,47 @@
package domain;
+import java.util.List;
+import java.util.Set;
+
public class LottoGame {
private LottoResults lottoResults;
-
private Money money;
+ private WinningAnalyzer winningAnalyzer;
public LottoGame() {
this.lottoResults = new LottoResults();
}
- pub... | Java | ์๋์์ฑ๊ณผ ์๋์์ฑ์ ๋ฉ์๋๋ก ๊ตฌ๋ถํ๊ณ ์๋๋ฐ LottoGenerator -> LottoAutoGenerator, LottoManualGenerator ๋ฑ์ผ๋ก ์ ๋ตํจํด์ ์ฌ์ฉํ ์๋ ์์ ๊ฒ ๊ฐ๋ค์ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.