-
Notifications
You must be signed in to change notification settings - Fork 10
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
[이동현] up nd down 구현 #9
Open
D5ng
wants to merge
13
commits into
whatever-mentoring:main
Choose a base branch
from
D5ng:mission-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f2754c6
✨ Feat: getRandomNumber 유틸 함수 추가
D5ng 5b63281
✨ Feat: readLine 유틸 함수 추가
D5ng dd5ff9f
✨ Feat: upAndDown에 상수 추가
D5ng a63aaf9
✨ Feat: upAndDown Game 로직 추가
D5ng da668db
자잘한 변경사항
D5ng 51bcfe8
📝 Docs: 기능 목록 작성
D5ng b6c0444
♻️ Refactor: PRINT 객체 만들어 일관성 유지하기
D5ng 9d96e4b
♻️ Refactor: eslint 적용 및 jsdoc 명세 추가
D5ng 5415fed
♻️ Refactor: console text color 변수화 작업
D5ng 6ec5244
♻️ Refactor: 네이밍 리팩토링
D5ng 8a044e8
♻️ Refactor: utils barrel pattern 적용
D5ng 329075f
✨ Feat: 규칙을 벗어날 때 재시작 기능 추가
D5ng 4fd4ea5
📝 Docs: docs update
D5ng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,74 @@ | ||
/** | ||
* 게임에서 사용되는 최대 숫자 | ||
* @constant | ||
*/ | ||
export const MAX_NUMBER = 50 | ||
|
||
/** | ||
* 게임에서 사용되는 최소 숫자 | ||
* @constant | ||
*/ | ||
export const MIN_NUMBER = 1 | ||
|
||
/** | ||
* 숫자 추측 가능 횟수 제한 | ||
* @constant | ||
*/ | ||
export const LIMIT_COUNT = 5 | ||
|
||
/** | ||
* 게임에서 출력되는 메시지 상수 모음 | ||
* @constant | ||
*/ | ||
export const PRINT = Object.freeze({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍👍👍 객체로 관리하는것, |
||
/** | ||
* 게임 시작 메세지 | ||
* @type {string} | ||
*/ | ||
init: `컴퓨터가 1~50 사이의 숫자를 선택했습니다. 숫자를 맞춰보세요.`, | ||
|
||
/** | ||
* 사용자가 잘못된 숫자를 입력했을 때 표시되는 에러 메시지 | ||
* @type {string} | ||
*/ | ||
userInputError: `\x1b[31m${"숫자는 1~50 사이로 입력해주세요."}\x1b[0m`, | ||
|
||
/** | ||
* 사용자 입력 프롬프트 메시지 | ||
* @type {string} | ||
*/ | ||
input: `\x1b[1m\x1b[96m숫자 입력: \x1b[0m`, | ||
|
||
/** | ||
* 게임 재시작 여부를 묻는 메시지 | ||
* @type {string} | ||
*/ | ||
reStart: `\x1b[1m\x1b[96m게임을 다시 시작하시겠습니까? (yes/no): \x1b[0m`, | ||
|
||
/** | ||
* 게임 종료 메시지 | ||
* @type {string} | ||
*/ | ||
end: `\x1b[1m\x1b[96m게임을 종료합니다.\x1b[0m`, | ||
|
||
/** | ||
* 정답 메시지 생성 함수 | ||
* @param {number} playCount - 사용자가 정답을 맞추는 데 걸린 시도 횟수 | ||
* @returns {string} 축하 메시지 | ||
*/ | ||
answer: (playCount) => `\x1b[1m\x1b[32m${`축하합니다! ${playCount}번 만에 숫자를 맞추셨습니다.`}\x1b[0m`, | ||
|
||
/** | ||
* 이전 추측 목록 메시지 생성 함수 | ||
* @param {number[]} prevInputList - 사용자가 입력한 이전 숫자 목록 | ||
* @returns {string} 이전 추측 메시지 | ||
*/ | ||
prevGuess: (prevInputList) => `\x1b[93m${`이전 추측: ${prevInputList.join(", ")} \n`}\x1b[0m`, | ||
|
||
/** | ||
* 제한 횟수를 초과했을 때의 메시지 생성 함수 | ||
* @param {number} answer - 정답 숫자 | ||
* @returns {string} 실패 메시지 | ||
*/ | ||
excced: (answer) => `\x1b[1m\x1b[31m${`5회 초과! 숫자를 맞추지 못했습니다. (정답: ${answer})`}\x1b[0m`, | ||
}) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/** | ||
* @param {number} min 최소값 | ||
* @param {number} max 최대값 | ||
* @returns | ||
*/ | ||
export function getRandomNumber(min, max) { | ||
return Math.floor(Math.random() * (max - min + 1) + min) | ||
} |
File renamed without changes.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint를 조금 빡빡하게 ? 사용해보는 것도 좋을것 같아요
가령
airbnb
의 lint rule을 도입해본다던지참고로
off
처리한 rule들은 리즈너블 해보입니다