GARDEN SWEEPER
버섯을 밟지 않게 꽃을 올려두세요! 🍄🌸
1. Finite State Machine (FSM): The game runs on a loop that switches between states (Menu, Playing, GameOver). This ensures inputs are only processed when appropriate (e.g., no clicking during game over).
• 유한 상태 머신: 게임은 상태(메뉴, 플레이, 종료)를 전환하며 실행됩니다. 이는 적절한 시점에만 입력이 처리되도록(예: 종료 후 클릭 방지) 보장합니다.
2. First-Click Safety (Lazy Initialization): The minefield is generated after the user's first input. The first clicked cell is guaranteed to be safe, preventing instant game-overs.
• 첫 클릭 안전 보장 (지연 초기화): 지뢰밭은 유저의 첫 입력 직후에 생성됩니다. 첫 번째로 클릭한 칸은 무조건 안전하도록 보장하여 허무한 게임 종료를 방지합니다.
3. Recursive Flood Fill: If a cell with '0' mines is revealed, the algorithm recursively opens all adjacent valid neighbors until it hits numbered cells.
• 재귀적 플러드 필: 지뢰가 '0'개인 칸이 열리면, 알고리즘이 숫자가 있는 칸을 만날 때까지 인접한 모든 유효한 이웃을 재귀적으로 엽니다.
4. Data-Driven Grid: The visual board is a direct reflection of a 2D data structure. UI updates are purely a reaction to changes in this data model.
• 데이터 기반 그리드: 화면에 보이는 보드는 2차원 데이터 구조를 그대로 반영합니다. UI 업데이트는 오직 이 데이터 모델의 변화에 반응하여 이루어집니다.
1. Finding the Box (Grid Mapping): When you click the screen, the game calculates exactly which box in the grid you touched based on the click position and the box size.
• 위치 찾기 (그리드 매핑): 화면을 클릭하면, 클릭한 위치와 상자의 크기를 계산하여 격자(그리드) 중 몇 번째 칸을 눌렀는지 정확히 알아냅니다.
2. Counting Neighbors: To decide what number to show, the game looks at the 8 boxes surrounding a specific cell and counts how many mines are hidden there.
• 이웃 살피기: 표시할 숫자를 정하기 위해, 특정 칸을 둘러싼 8개의 칸을 하나씩 확인하여 숨겨진 지뢰가 총 몇 개인지 셉니다.
3. Winning Strategy: You don't need to find every mine. The game simply counts how many safe boxes you've opened. If you open them all, you win!
• 승리 확인: 모든 지뢰를 찾을 필요는 없습니다. 게임은 '안전한 칸'을 몇 개 열었는지 세어보고, 모두 열었다면 승리로 처리합니다!
4. Unified Controls: Whether using a mouse or a finger, the game treats the input simply as 'Dig' or 'Plant Flower', making it work easily on any device.
• 통합 컨트롤: 마우스 클릭이든 손가락 터치든, 게임은 단순히 '땅파기' 또는 '꽃심기' 동작으로 인식하여 모든 기기에서 쉽게 작동하도록 설계했습니다.

댓글
댓글 쓰기