Skip to content
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

나는 허브의 내일이란다 #12

Open
wants to merge 88 commits into
base: main
Choose a base branch
from

Conversation

greeng00se
Copy link
Member

No description provided.

woowahan-neo and others added 30 commits March 13, 2023 12:57
* docs: 요구사항 정리

Co-authored-by: iamjooon2 <[email protected]>

* docs: 요구사항 수정

Co-authored-by: iamjooon2 <[email protected]>

* feat: 랭크 생성 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 파일 생성 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: given-when-then 주석 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: Position 생성 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: Color Enum 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 기물에 대한 추상 클래스 추가

Co-authored-by: iamjooon2 <[email protected]>

* chore: 패키지 변경

Co-authored-by: iamjooon2 <[email protected]>

* feat: 체스 기물 생성 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* refactor: 체스 기물 생성시 정적 팩터리 메서드를 사용하도록 변경

Co-authored-by: iamjooon2 <[email protected]>

* feat: 빈 칸을 생성하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 보드 초기화 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 출력 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 체스 게임 생성 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* style: Board 클래스 포맷팅 변경

Co-authored-by: iamjooon2 <[email protected]>

* feat: 입력 반복 제한 횟수 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: Command 추가 및 적용

Co-authored-by: iamjooon2 <[email protected]>

* feat: 각 기물의 추상 메서드 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: Rank의 차이를 반환하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: File의 차이를 반환하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* test: 랭크 차이 테스트에 ParameterizedTest 적용

Co-authored-by: iamjooon2 <[email protected]>

* fix: 랭크와 파일 의미 변경

Co-authored-by: iamjooon2 <[email protected]>

* feat: 나이트 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* feat: 룩 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* feat: 비숍 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* refactor: 나이트 상수명 수정

Co-authored-by: iamjooon2 <[email protected]>

* refactor: 킹 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* refactor: 퀸 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* feat: 폰 이동 확인 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* feat: 위치값으로 Rank랑 File 받는 메서드 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 랭크, 파일 사이의 값을 반환하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 시작과 끝 사이의 위치를 구하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 위치를 입력받아 position을 리턴하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 위치를 입력받아 position을 리턴하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 기물을 이동하는 기능 구현

Co-authored-by: iamjooon2 <[email protected]>

* refactor: 예외 자세하게 출력하도록 수정

Co-authored-by: iamjooon2 <[email protected]>

* feat: START 커맨드 검증 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: ChessGame의 기물을 움직이는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 체스 게임 입력 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* feat: 이동 경로에 기물이 존재하는지 확인하는 기능 추가

Co-authored-by: iamjooon2 <[email protected]>

* test: 루이로페즈 모든 슈타이니츠 바리에이션 테스트 추가

Co-authored-by: iamjooon2 <[email protected]>

* test: 테스트 도와주는 메서드 추가

Co-authored-by: iamjooon2 <[email protected]>

* test: 테스트 주석 수정

Co-authored-by: iamjooon2 <[email protected]>

* refactor: final 빠진 부분 추가

Co-authored-by: iamjooon2 <[email protected]>

* docs: 요구사항 수정

Co-authored-by: iamjooon2 <[email protected]>

* feat: Lambda, Stream 이해하기

* refactor: 이동 로직 개선

* refactor: 폰의 초기 위치(랭크) 상수명 수정

* feat: 체스게임이 초기화되었는지 확인하는 기능 추가

* refactor: Controller 로직 개선

---------

Co-authored-by: iamjooon2 <[email protected]>
@greeng00se greeng00se self-assigned this Mar 26, 2023
@greeng00se greeng00se changed the title 지속적으로 코딩중.. 아직 미완성 문단속 잘하고 코딩해야지 나는 허브의 내일이란다 Mar 26, 2023
Copy link
Member

@drunkenhw drunkenhw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

당신 수료하세요


### 개요

체스는 가로와 세로가 각각 8줄씩 64칸으로 격자로 배열 된 체스보드에서 두 명의 플레이어가 기물들을 규칙에 따라 움직여 싸우는 보드 게임이다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나무위키 같아서 좋네요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떻게 알았지?

import java.util.HashMap;
import java.util.Map;

public class CommandMapper<K, V> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나만의 Map 쿨하네요

return Arrays.stream(values())
.filter(command -> command != EMPTY)
.filter(command -> command.name().equalsIgnoreCase(commands.get(COMMAND_INDEX)))
.findFirst()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findAny() 도 있는데 first를 쓰신 이유 궁금

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

둘다 똑같다고 생각합니다


public static GameCommand from(final List<String> commands) {
return Arrays.stream(values())
.filter(command -> command != EMPTY)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty를 거르는 모습 정말 꼼꼼하네요

}

private void move(final List<String> commands) {
final MoveDto moveDto = new MoveDto(commands.get(MOVE_SOURCE_INDEX), commands.get(MOVE_TARGET_INDEX));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index는 view가 알아야 할 정보아닐까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘못된 부분일수도 있지만 일단 이게 가장 간단...

Comment on lines +23 to +28
final List<MoveDto> moves = gameDao.findAllByRoomId(roomId);
for (MoveDto move : moves) {
final Position source = Position.from(move.getSource());
final Position target = Position.from(move.getTarget());
board.move(source, target);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

db에서 나오는 순서대로 move를 시켜주는데 db에서 나오는 순서가 무조건 보장되나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳~ 지금도 잘 돌아가지만 확실하게 하려면 orderBy를 해줘야겠군요

Comment on lines +44 to +47
final Board board = boards.get(roomId);
if (board == null) {
throw new IllegalArgumentException("게임을 찾을 수 없습니다.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이 계속 반복되는데 메소드로 분리하는건 어떸가요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그것도 굿~

Comment on lines +4 to +23
CREATE TABLE User
(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(255)
);

CREATE TABLE Room
(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
user_id int
);

CREATE TABLE Move
(
id int PRIMARY KEY AUTO_INCREMENT,
source varchar(2),
target varchar(2),
room_id int
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null이 들어가도 되나요? not null 옵션은 안되나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

곰곰하게 하려면 not null 굳


@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
@SuppressWarnings("NonAsciiCharacters")
public class GameResultTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트가 왤케 꼼꼼한가요

Comment on lines +24 to +35
static void beforeAll() {
connectionPool = new TestConnectionPool();
jdbcTemplate = new JdbcTemplate(connectionPool);
gameDao = new GameJdbcDao(jdbcTemplate);
final String query = "CREATE TABLE IF NOT EXISTS move ("
+ " id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"
+ " source VARCHAR(2) NOT NULL,"
+ " target VARCHAR(2) NOT NULL,"
+ " room_id INT NOT NULL"
+ ");";
jdbcTemplate.executeUpdate(query);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뭐해주는 놈이죠 알려주세요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 테스트 테이블을 만들었다 지웠다 하는 놈인강ㅅ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예압! 테스트용 테이블 생성

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants