Conversation
구현할 기능 목록을 정의한다. 총 7단계로 이루어 진다.
- 컴퓨터는 1에서 9까지의 숫자 중에서 서로 다른 임의의 수 세 개를 선택한다. - 선택된 숫자는 게임이 `재시작 및 종료`될 때까지 변경되지 않는다.
- 사용자는 세 자리의 숫자를 입력한다.
- 각 자리의 숫자가 1에서 9 사이인지 확인한다. - 각 자리의 숫자가 서로 중복되지 않는지 검사한다. - 위의 조건을 만족하지 않을 경우, alert()를 사용하여 오류 메시지를 출력한다. - 그 부분부터 사용자는 다시 숫자를 입력한다.
- `컴퓨터 랜덤 숫자`와 `사용자 숫자`를 비교한다. - 숫자와 위치가 일치하면, "스트라이크"로 카운트한다. - 숫자는 일치하지만 위치가 다르면, "볼"로 카운트한다. - 일치하는 숫자가 없으면, "낫싱"으로 카운트한다. - 사용자가 `컴퓨터 랜덤 숫자`를 맞출 때까지 과정을 반복한다.
- 비교 결과에 따라 "스트라이크", "볼", "낫싱"의 수를 화면에 출력한다. - 예: "1스트라이크 2볼", "낫싱" 등 - 결과가 "3 스트라이크"라면, 게임 종료 메시지를 출력한다.
- 게임 종료 메시지 후 재시작 버튼을 표시한다. - 재시작 버튼을 클릭하면, 컴퓨터는 새로운 숫자를 선택하고 게임을 다시 시작한다.
- 출력되는 문구를 수정한다.
- 과제 진행 소감을 수정한다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
javascript-baseball-precourse
구현 기능 목록
1. 컴퓨터 랜덤 숫자 선택
재시작 및 종료될 때까지 변경되지 않는다.2. 사용자 숫자 입력
3. 사용자 입력 유효성 판단
4. 숫자 비교
컴퓨터 랜덤 숫자와사용자 숫자를 비교한다.컴퓨터 랜덤 숫자를 맞출 때까지 과정을 반복한다.5. 결과 출력
6. 재시작
7. 종료
8. 추가 기능 구현