Open
Conversation
OmokSystem: - 오목 게임을 관리하는 클래스 - nowStone: 현재 착수할 돌 색깔 프로퍼티 registerClickListener: - 게임 보드의 각 imageView마다 클릭시 한턴을 수행하는 함수 등록 performTurn: - 한턴을 수행하는 함수 putStone: - 돌을 착수하는 함수 - performTurn함수 내부에서 호출 - 터치한 위치의 이미지뷰에 돌을 그림 - 이미 착수된 위치라면 착수하지 않음 getBoardImageView: - TableLayout에 존재하는 imageView에 간단하게 접근하게 도와주는 함수 - row, col정보를 전달하면 해당위치의 이미지 뷰 반환 isPositionEmpty: - 착수하려는 위치가 비어있는지 확인하는 함수 - 비어있으면 true를 반환, 비어있지 않으면 Toas메시지를 표시하고 false 반환 Cache: - Drawable을 얻어오는 동작을 줄여주는 클래스 - 착수할 때마다 돌을 불러오는 동작을 방지하기 위해 생성 - OmokSystem 객체가 생성될 때 내부에서 생성
calculateCombo: - 4가지 방향에 대해 가장 큰 연속 연결(Combo)수를 반환 checkVerticalCombo, checkHorizontalCombo, checkUpperRightCombo, checkUpperLeftCombo: - 각 방향 Combo 계산 - 대상에서 인접한 돌을 위/아래로 4개씩 검사하여 같은 drawable인지 확인 - 같으면 combo++ - 다르면 break
isGameEnd: - performTurn 내부에서 호출 - 기준 콤보(scoreCombo)를 넘으면 true 반환 alertEnd: - 게임 종료조건을 충족하였을 때 호출 - 승리한 색을 알림 - 재시작 여부를 확인 resetBoard: - 재시작 선택시 alertEnd내부에서 호출 - 보드에 놓여진 돌의 이미지를 모두 지움 - 처음 착수하는 돌의 색깔인 BLACK으로 설정
OmokSystem.kt: - 테스트코드를 위해 일부 함수, 프로퍼티를 public으로 변경
ActivityScenario launch후 close()
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.
No description provided.