generated from wafflestudio/seminar-2024-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor/overalls #8
Merged
Merged
Conversation
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
…introduce constants for better maintainability
… removing localStorage utility functions
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
변경 이유
utils/Map2048.ts
를 기능별로 분리:constants.ts
,utils/helpers.ts
,utils/rule.ts
utils/localStorage.ts
를repositories/storage.ts
로 이동. 일반적인 로컬 저장을 포괄적으로 포함하도록 함2048 게임 구현과 게임 로직 인터페이스를 분리. 모듈화를 강화
변경 내용
utils/rule.ts
:다음과 같이 2048 게임 조작을 move, reset으로 구현하고, 게임 진행 상태는 State2048로 통일
utils/helpers.ts
에는 rule 구현을 위한 보조 함수가 있으며constants.ts
는 앱 전반에서 사용하는 상수를 모아둠.repositories/storage.ts
Storage2048
에서 중간저장 기능 수행. IO type을 State2048로 통일src/App.tsx
게임 리셋과 move 처리 함수는 상수(
NUM_ROWS
,NUM_COLS
,WINNING_SCORE
)과 독립적임. 해당 상수는 초기 1회만 제공해주면 됨.모듈화로 간결한 상태 처리 가능