From 9c15d0591beb5ff323c30e2ab26d03f50fb13317 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 5 Jan 2024 16:23:44 +0900 Subject: [PATCH 01/11] =?UTF-8?q?DOCS:=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20=EB=AA=A9=EB=A1=9D=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" new file mode 100644 index 0000000..57ae978 --- /dev/null +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -0,0 +1,34 @@ +# 기능 구현 목록 + +## Jpark2 + +- [ ] 3개의 문자열 프로퍼티 + - [x] `당신의~` + - [x] `코딩~` + - [x] `오늘 저녁은~` + +- [ ] 도발 문자열 중 랜덤하게 하나를 반환하는 기능 + - [ ] 랜덤한 값을 생성하는 기능 + - [ ] 인덱스에 따라 property를 반환하는 기능 + +## Daewoole + +- [ ] 프로퍼티 + - [ ] 현재 분노 수치 + - [ ] 초기값 0 + - [ ] 분노 임계값 + - [ ] 80 ~ 120 사이의 랜덤 값 + - [ ] 도발 분노 맵 + - [ ] 도발에 대응되는 문자열마다 분노 수치 저장 + - [ ] 당신의 ~ -> 0 ~ 20 + - [ ] 코딩 ~ -> 10 ~ 30 + - [ ] 오늘 저녁은~ -> 30 ~ 50 + +- [ ] 지정된 범위 내의 랜덤한 값을 생성하는 기능 +- [ ] 랜덤 값은 클래스 생성 시, 생성자에서 정해진다 +- [ ] 도발당하기 기능 + - [ ] 문자열을 입력받아 분노를 축적하는 기능 + +## Main + +- [ ] 출력사 \ No newline at end of file From 80800cd740304cf237389e59e5d52c37e108bc66 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 5 Jan 2024 16:33:02 +0900 Subject: [PATCH 02/11] =?UTF-8?q?FEAT:=20=EB=9E=9C=EB=8D=A4=ED=95=9C=20?= =?UTF-8?q?=EB=8F=84=EB=B0=9C=20=EB=AC=B8=EC=9E=90=EC=97=B4=EC=9D=84?= =?UTF-8?q?=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 8 ++++---- .../java/com/example/maddaewoole/Jpark2.java" | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" index 57ae978..08ad4f4 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -2,14 +2,14 @@ ## Jpark2 -- [ ] 3개의 문자열 프로퍼티 +- [x] 3개의 문자열 프로퍼티 - [x] `당신의~` - [x] `코딩~` - [x] `오늘 저녁은~` -- [ ] 도발 문자열 중 랜덤하게 하나를 반환하는 기능 - - [ ] 랜덤한 값을 생성하는 기능 - - [ ] 인덱스에 따라 property를 반환하는 기능 +- [x] 도발 문자열 중 랜덤하게 하나를 반환하는 기능 + - [x] 랜덤한 값을 생성하는 기능 + - [x] 인덱스에 따라 property를 반환하는 기능 ## Daewoole diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" index a786814..50866a7 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" @@ -1,5 +1,20 @@ package com.example.maddaewoole; +import java.util.List; +import java.util.Random; + public class Jpark2 { + private final List mentions = List.of("당신의 지각비, 회식비로 대체되었다", "코딩 그렇게 하는거 아닌데", "오늘 저녁은 감탄계"); + + + public String provoke() { + return mentions.get(generateRandomNumberByIndex()); + } + + private int generateRandomNumberByIndex() { + int range = mentions.size(); + Random random = new Random(); + return random.nextInt(range); + } } From 36761c13db91043d12555c39ddd80175a7fda6a2 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 5 Jan 2024 16:45:36 +0900 Subject: [PATCH 03/11] =?UTF-8?q?FEAT:=20=ED=98=84=EC=9E=AC=20=EB=B6=84?= =?UTF-8?q?=EB=85=B8=20=EC=88=98=EC=B9=98=EA=B0=80=20=ED=95=9C=EA=B3=84?= =?UTF-8?q?=EB=A5=BC=20=EB=84=98=EC=97=88=EB=8A=94=EC=A7=80=20=EA=B2=80?= =?UTF-8?q?=EC=88=98=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 1 + .../com/example/maddaewoole/Daewoole.java" | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" index 08ad4f4..a797c98 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -28,6 +28,7 @@ - [ ] 랜덤 값은 클래스 생성 시, 생성자에서 정해진다 - [ ] 도발당하기 기능 - [ ] 문자열을 입력받아 분노를 축적하는 기능 +- [x] 현재 지수가 limit을 넘었는지 판별하는 기능 ## Main diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" index 40d4298..d986ad5 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" @@ -1,5 +1,38 @@ package com.example.maddaewoole; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + public class Daewoole { + private static final int MIN_LIMIT = 80; + private static final int MAX_LIMIT = 120; + private int anger; + private final int limit; + private Map provokeMap = new HashMap<>(); + + public Daewoole(List mentions) { + anger = 0; + limit = generateRandomNumberInRange(MIN_LIMIT, MAX_LIMIT); + provokeMap = learnMentions(mentions); + } + + private Map learnMentions(List mentions) { + return null; + } + + // 범위 내의 랜덤값 생성 + private int generateRandomNumberInRange(int min, int max) { + Random random = new Random(); + return random.nextInt((max - min) + 1) + min; + } + + public boolean isOverLimit() { + return anger >= limit; + } + public int getAnger() { + return anger; + } } From f24d1ef31e0094863c3ac3bffd34a5325980a40a Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 10:39:43 +0900 Subject: [PATCH 04/11] =?UTF-8?q?REFACTOR:=20=EB=8F=84=EB=B0=9C=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EA=B8=B8=EC=9D=B4=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=EB=9E=9C=EB=8D=A4=20=EC=88=98=20=EB=B0=98=ED=99=98=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit generateRandomNumberByIdx -> ByMentionCount --- .../main/java/com/example/maddaewoole/Daewoole.java" | 8 +++++--- .../main/java/com/example/maddaewoole/Jpark2.java" | 11 ++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" index d986ad5..717a5e7 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" @@ -15,11 +15,13 @@ public class Daewoole { public Daewoole(List mentions) { anger = 0; limit = generateRandomNumberInRange(MIN_LIMIT, MAX_LIMIT); - provokeMap = learnMentions(mentions); + learnMentions(mentions); } - private Map learnMentions(List mentions) { - return null; + private void learnMentions(List mentions) { + for (String mention : mentions) { + provokeMap.put(mention, generateRandomNumberInRange(0, 20)) + } } // 범위 내의 랜덤값 생성 diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" index 50866a7..544e47b 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Jpark2.java" @@ -6,15 +6,20 @@ public class Jpark2 { private final List mentions = List.of("당신의 지각비, 회식비로 대체되었다", "코딩 그렇게 하는거 아닌데", "오늘 저녁은 감탄계"); - public String provoke() { - return mentions.get(generateRandomNumberByIndex()); + int randomIdx = generateRandomNumberByMentionCount(); + + return mentions.get(randomIdx); } - private int generateRandomNumberByIndex() { + private int generateRandomNumberByMentionCount() { int range = mentions.size(); Random random = new Random(); return random.nextInt(range); } + + public List getMentions() { + return mentions; + } } From fa6c3e02b5735169fcaa51e5250f57285a9fa1f0 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 10:51:58 +0900 Subject: [PATCH 05/11] =?UTF-8?q?FEAT:=20=EB=8F=84=EB=B0=9C=20=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=B6=84=EB=85=B8=20?= =?UTF-8?q?=EC=88=98=EC=B9=98=20=ED=95=99=EC=8A=B5=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" index a797c98..f3cd9a4 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -14,17 +14,17 @@ ## Daewoole - [ ] 프로퍼티 - - [ ] 현재 분노 수치 - - [ ] 초기값 0 - - [ ] 분노 임계값 - - [ ] 80 ~ 120 사이의 랜덤 값 - - [ ] 도발 분노 맵 - - [ ] 도발에 대응되는 문자열마다 분노 수치 저장 - - [ ] 당신의 ~ -> 0 ~ 20 - - [ ] 코딩 ~ -> 10 ~ 30 - - [ ] 오늘 저녁은~ -> 30 ~ 50 - -- [ ] 지정된 범위 내의 랜덤한 값을 생성하는 기능 + - 현재 분노 수치 + - [x] 초기값 0 + - 분노 임계값 + - [x] 80 ~ 120 사이의 랜덤 값 + - 도발 분노 맵 + - [x] 도발에 대응되는 문자열마다 분노 수치 저장 + - [x] 당신의 ~ -> 0 ~ 20 + - [x] 코딩 ~ -> 10 ~ 30 + - [x] 오늘 저녁은~ -> 30 ~ 50 + +- [x] 지정된 범위 내의 랜덤한 값을 생성하는 기능 - [ ] 랜덤 값은 클래스 생성 시, 생성자에서 정해진다 - [ ] 도발당하기 기능 - [ ] 문자열을 입력받아 분노를 축적하는 기능 From 471b0962a65dca47be624132021c829dd70c6d76 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 10:55:45 +0900 Subject: [PATCH 06/11] =?UTF-8?q?FEAT:=20=EC=9E=85=EB=A0=A5=EB=B0=9B?= =?UTF-8?q?=EC=9D=80=20=EB=A9=98=ED=8A=B8=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=EB=B6=84=EB=85=B8=20=EC=B6=95=EC=A0=81=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/maddaewoole/Daewoole.java" | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" index 717a5e7..ccda25c 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" @@ -8,6 +8,8 @@ public class Daewoole { private static final int MIN_LIMIT = 80; private static final int MAX_LIMIT = 120; + private static final int ADD_MAX_POINT = 20; + private static final int ADD_LAST_POINT = 10; private int anger; private final int limit; private Map provokeMap = new HashMap<>(); @@ -18,15 +20,29 @@ public Daewoole(List mentions) { learnMentions(mentions); } + public void provoked(String mention) { + int angerPoint = provokeMap.getOrDefault(mention, 0); + + addAngerPoint(angerPoint); + } + private void learnMentions(List mentions) { - for (String mention : mentions) { - provokeMap.put(mention, generateRandomNumberInRange(0, 20)) + int startPoint = 0; + for (int i = 0; i < mentions.size(); i++) { + String mention = mentions.get(i); + + provokeMap.put(mention, generateRandomNumberInRange(startPoint, startPoint + ADD_MAX_POINT)); + if (i == mentions.size() - 1) { + startPoint += ADD_MAX_POINT; + } + startPoint += ADD_LAST_POINT; } } // 범위 내의 랜덤값 생성 private int generateRandomNumberInRange(int min, int max) { Random random = new Random(); + return random.nextInt((max - min) + 1) + min; } @@ -34,6 +50,10 @@ public boolean isOverLimit() { return anger >= limit; } + private void addAngerPoint(int point) { + anger += point; + } + public int getAnger() { return anger; } From 191f91762652afa0ca1343580b9c196a8d51bcaa Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 10:56:10 +0900 Subject: [PATCH 07/11] =?UTF-8?q?DOCS:=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20=EB=AA=A9=EB=A1=9D=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" index f3cd9a4..7801950 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -25,9 +25,9 @@ - [x] 오늘 저녁은~ -> 30 ~ 50 - [x] 지정된 범위 내의 랜덤한 값을 생성하는 기능 -- [ ] 랜덤 값은 클래스 생성 시, 생성자에서 정해진다 -- [ ] 도발당하기 기능 - - [ ] 문자열을 입력받아 분노를 축적하는 기능 +- [x] 랜덤 값은 클래스 생성 시, 생성자에서 정해진다 +- [x] 도발당하기 기능 + - [x] 도발 문자별로 학습했던 분노를 축적하는 기능 - [x] 현재 지수가 limit을 넘었는지 판별하는 기능 ## Main From c64a0cfb13e409fce31adf7aa910c3cb07d21072 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 11:13:12 +0900 Subject: [PATCH 08/11] =?UTF-8?q?FEAT:=20=EC=B6=9C=EB=A0=A5=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/README.md" | 3 -- .../com/example/maddaewoole/Daewoole.java" | 7 ++++- .../java/com/example/maddaewoole/Main.java" | 31 +++++++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" index 7801950..5ed7b1e 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/docs/README.md" @@ -30,6 +30,3 @@ - [x] 도발 문자별로 학습했던 분노를 축적하는 기능 - [x] 현재 지수가 limit을 넘었는지 판별하는 기능 -## Main - -- [ ] 출력사 \ No newline at end of file diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" index ccda25c..b9ace85 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" @@ -21,11 +21,16 @@ public Daewoole(List mentions) { } public void provoked(String mention) { - int angerPoint = provokeMap.getOrDefault(mention, 0); + int angerPoint = getLearnedAngerPoint(mention); addAngerPoint(angerPoint); } + public int getLearnedAngerPoint(String mention) { + return provokeMap.getOrDefault(mention, 0); + } + + private void learnMentions(List mentions) { int startPoint = 0; for (int i = 0; i < mentions.size(); i++) { diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" index b8d6ddd..fa05bc9 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" @@ -2,7 +2,34 @@ public class Main { - public static void main(String[] args) { + public static void main(String[] args) { + Jpark2 jpark2 = new Jpark2(); + Daewoole daewoole = new Daewoole(jpark2.getMentions()); - } + int count = 0; + while (daewoole.isOverLimit()) { + String provokeMention = jpark2.provoke(); + int learnedAngerPoint = daewoole.getLearnedAngerPoint(provokeMention); + + printProvokeMention(provokeMention, learnedAngerPoint); + // 외부에서 property를 직접 수정하는 것보단.. 중복이 나을듯 + daewoole.provoked(provokeMention); + printAngerPoint(daewoole.getAnger()); + count++; + } + printPunchCount(count); + } + + private static void printProvokeMention(String mention, int angerPoint) { + System.out.println("지원은 '" + mention + "'를 시전하여 대욱의 본노를 " + angerPoint + " 증가시켰다."); + } + + private static void printAngerPoint(int angerPoint) { + System.out.println("현재 대욱의 분노 수치: " + angerPoint); + } + + private static void printPunchCount(int count) { + System.out.println("참지 못한 대욱은 결국 지원에게 잼민 펀치를 날렸다."); + System.out.println("대욱을 도발한 횟수 : " + count + "회"); + } } From 062bd4f5ae21f62846c0b78de64afe1f14864a81 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 11:19:43 +0900 Subject: [PATCH 09/11] =?UTF-8?q?FIX:=20=EB=B0=98=EB=B3=B5=20=EC=8B=9C?= =?UTF-8?q?=ED=96=89=EC=9D=B4=20=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 오탈자 수정 및 누락된 논리부정 연산자 추가 --- .../src/main/java/com/example/maddaewoole/Main.java" | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" index fa05bc9..a7e53f7 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" @@ -7,7 +7,7 @@ public static void main(String[] args) { Daewoole daewoole = new Daewoole(jpark2.getMentions()); int count = 0; - while (daewoole.isOverLimit()) { + while (!daewoole.isOverLimit()) { String provokeMention = jpark2.provoke(); int learnedAngerPoint = daewoole.getLearnedAngerPoint(provokeMention); @@ -21,11 +21,12 @@ public static void main(String[] args) { } private static void printProvokeMention(String mention, int angerPoint) { - System.out.println("지원은 '" + mention + "'를 시전하여 대욱의 본노를 " + angerPoint + " 증가시켰다."); + System.out.println("지원은 '" + mention + "'를 시전하여 대욱의 분노를 " + angerPoint + " 증가시켰다."); } private static void printAngerPoint(int angerPoint) { System.out.println("현재 대욱의 분노 수치: " + angerPoint); + System.out.print(System.lineSeparator()); } private static void printPunchCount(int count) { From 64471fd3edf0bdf4b8c332ea96f7bb95a92ab6f7 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 11:20:17 +0900 Subject: [PATCH 10/11] =?UTF-8?q?STYLE:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/example/maddaewoole/Main.java" | 1 - 1 file changed, 1 deletion(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" index a7e53f7..c27bf84 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Main.java" @@ -12,7 +12,6 @@ public static void main(String[] args) { int learnedAngerPoint = daewoole.getLearnedAngerPoint(provokeMention); printProvokeMention(provokeMention, learnedAngerPoint); - // 외부에서 property를 직접 수정하는 것보단.. 중복이 나을듯 daewoole.provoked(provokeMention); printAngerPoint(daewoole.getAnger()); count++; From 61b0e7867be923d0522f13b5dd70e1b10238ae20 Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Sat, 6 Jan 2024 11:33:13 +0900 Subject: [PATCH 11/11] =?UTF-8?q?REFACTOR:=20provokeMap=20final=20?= =?UTF-8?q?=EC=A0=91=EA=B7=BC=EC=A0=9C=EC=96=B4=EC=9E=90=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/example/maddaewoole/Daewoole.java" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" index b9ace85..348697d 100644 --- "a/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" +++ "b/v1/backend/JAVA_LV_0_\354\236\274\353\257\274_\355\216\200\354\271\230/src/main/java/com/example/maddaewoole/Daewoole.java" @@ -12,7 +12,7 @@ public class Daewoole { private static final int ADD_LAST_POINT = 10; private int anger; private final int limit; - private Map provokeMap = new HashMap<>(); + private final Map provokeMap = new HashMap<>(); public Daewoole(List mentions) { anger = 0;