From e837cf7213ef9417704452b8309d1ad112ca6de5 Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:08:33 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?=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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/README.md b/docs/README.md index e69de29bb..f18f1df91 100644 --- a/docs/README.md +++ b/docs/README.md @@ -0,0 +1,7 @@ +# 기능 구현 목록 +- 사용자 자동차 입력 +- 자동차 객체 생성 +- 사용자 시도 횟수 입력 +- 무작위 값 생성 후 전진 여부 결정 +- 실행 결과 출력 +- 전반전인 게임 진행 \ No newline at end of file From 3cc71fb5ff1870b029593133cef3e207f2f855ab Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:23:50 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=B0=A8=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/racingcar/User.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/kotlin/racingcar/User.kt diff --git a/src/main/kotlin/racingcar/User.kt b/src/main/kotlin/racingcar/User.kt new file mode 100644 index 000000000..e38641192 --- /dev/null +++ b/src/main/kotlin/racingcar/User.kt @@ -0,0 +1,15 @@ +import camp.nextstep.edu.missionutils.Console + +class User { + var carNameList: List = emptyList() + + fun inputCarNames() { + print("경주할 자동차 이름을 입력하세요. (이름은 쉼표(,)로 구분)") + var names = Console.readLine() + } + + fun separateCommas(names: String) { + val carNameList = names.split(",").toList() + } + +} \ No newline at end of file From a8e2b5c8ae83f3fabfeeb88c99371cbda852a2b4 Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:25:59 +0900 Subject: [PATCH 3/8] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=B0=A8=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/racingcar/User.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/racingcar/User.kt b/src/main/kotlin/racingcar/User.kt index e38641192..27d1415db 100644 --- a/src/main/kotlin/racingcar/User.kt +++ b/src/main/kotlin/racingcar/User.kt @@ -6,6 +6,7 @@ class User { fun inputCarNames() { print("경주할 자동차 이름을 입력하세요. (이름은 쉼표(,)로 구분)") var names = Console.readLine() + separateCommas(names) } fun separateCommas(names: String) { From 470e538127c7c1dfffef9b26f72066429bbddd6e Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:28:27 +0900 Subject: [PATCH 4/8] =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=B0=A8=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/racingcar/Car.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/kotlin/racingcar/Car.kt diff --git a/src/main/kotlin/racingcar/Car.kt b/src/main/kotlin/racingcar/Car.kt new file mode 100644 index 000000000..eb1d50e66 --- /dev/null +++ b/src/main/kotlin/racingcar/Car.kt @@ -0,0 +1,10 @@ +class Car { + var name: String = "" + var score: Int = 0 + + constructor(name: String) { + this.name = name + } + + +} \ No newline at end of file From 68fd846af3aa90e51eb4feb25baa735f8fd5aafb Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:31:03 +0900 Subject: [PATCH 5/8] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=8B=9C?= =?UTF-8?q?=EB=8F=84=ED=95=A0=20=ED=9A=9F=EC=88=98=20=EC=9E=85=EB=A0=A5?= =?UTF-8?q?=EB=B0=9B=EB=8A=94=20=EA=B8=B0=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 --- src/main/kotlin/racingcar/User.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/racingcar/User.kt b/src/main/kotlin/racingcar/User.kt index 27d1415db..a272041e7 100644 --- a/src/main/kotlin/racingcar/User.kt +++ b/src/main/kotlin/racingcar/User.kt @@ -2,6 +2,7 @@ import camp.nextstep.edu.missionutils.Console class User { var carNameList: List = emptyList() + var tryCount: Int = 0 fun inputCarNames() { print("경주할 자동차 이름을 입력하세요. (이름은 쉼표(,)로 구분)") @@ -13,4 +14,9 @@ class User { val carNameList = names.split(",").toList() } + fun inputTryCount() { + print("시도할 횟수는 몇 회인가요?") + this.tryCount = Console.readLine().toInt() + } + } \ No newline at end of file From c61ab6b27afec608ff0942497b9fd2c23f4e61c2 Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:35:13 +0900 Subject: [PATCH 6/8] =?UTF-8?q?=EB=AC=B4=EC=9E=91=EC=9C=84=20=EA=B0=92=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=ED=9B=84=20=EC=A0=84=EC=A7=84=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20=EA=B2=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/racingcar/Car.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/racingcar/Car.kt b/src/main/kotlin/racingcar/Car.kt index eb1d50e66..7a8906273 100644 --- a/src/main/kotlin/racingcar/Car.kt +++ b/src/main/kotlin/racingcar/Car.kt @@ -1,3 +1,5 @@ +import camp.nextstep.edu.missionutils.Randoms + class Car { var name: String = "" var score: Int = 0 @@ -6,5 +8,13 @@ class Car { this.name = name } + fun confirmProgress(): Boolean { + var randomNumber = Randoms.pickNumberInRange(0, 9) + + if (randomNumber >= 4) { + return true + } + return false + } } \ No newline at end of file From 7f2e0eb9af4bc7598ea290973a3fc71f29ed3718 Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:36:21 +0900 Subject: [PATCH 7/8] =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=B0=A8=20=EC=A0=84?= =?UTF-8?q?=EC=A7=84=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=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 --- docs/README.md | 1 + src/main/kotlin/racingcar/Car.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/README.md b/docs/README.md index f18f1df91..3ba7ea1b9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,5 +3,6 @@ - 자동차 객체 생성 - 사용자 시도 횟수 입력 - 무작위 값 생성 후 전진 여부 결정 +- 자동차 전진 - 실행 결과 출력 - 전반전인 게임 진행 \ No newline at end of file diff --git a/src/main/kotlin/racingcar/Car.kt b/src/main/kotlin/racingcar/Car.kt index 7a8906273..68b305691 100644 --- a/src/main/kotlin/racingcar/Car.kt +++ b/src/main/kotlin/racingcar/Car.kt @@ -16,5 +16,9 @@ class Car { } return false } + + fun progressScore() { + this.score += 1 + } } \ No newline at end of file From 7649759e31f52452c0252c04a1b075cdc5499828 Mon Sep 17 00:00:00 2001 From: sea Date: Wed, 1 Nov 2023 18:50:43 +0900 Subject: [PATCH 8/8] =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=B0=A8=20=EC=A0=84?= =?UTF-8?q?=EC=A7=84=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/racingcar/Car.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/racingcar/Car.kt b/src/main/kotlin/racingcar/Car.kt index 68b305691..01af94ed6 100644 --- a/src/main/kotlin/racingcar/Car.kt +++ b/src/main/kotlin/racingcar/Car.kt @@ -17,8 +17,10 @@ class Car { return false } - fun progressScore() { - this.score += 1 + fun progressScore(progressBool: Boolean) { + if (progressBool) { + this.score += 1 + } } } \ No newline at end of file