-
Notifications
You must be signed in to change notification settings - Fork 166
[π μ¬μ΄ν΄2 - λ―Έμ (κΈ°λ¬Ό νμ₯ + DB μ μ©)] νκ³° λ―Έμ μ μΆν©λλ€. #273
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
Open
jyt6640
wants to merge
75
commits into
woowacourse:jyt6640
Choose a base branch
from
jyt6640:step2
base: jyt6640
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 all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
e8a296a
test: λ°μ΄ν°λ² μ΄μ€ init νΈμΆ μ ν
μ΄λΈ μμ± ν
μ€νΈ μΆκ°
jyt6640 1ddd06f
feat: λ°μ΄ν°λ² μ΄μ€ init νΈμΆ μ ν
μ΄λΈ μμ± κΈ°λ₯ ꡬν
jyt6640 3c0d493
refactor: ν
μ΄λΈμ΄ μμ μ λ€μ μμ± λμ§ μλλ‘ μ€ν€λ§ μμ
jyt6640 e6725b9
refactor: urlκ³Ό μ¬μ©μ, λΉλ°λ²νΈλ₯Ό μ£Όμ
λ°λλ‘ μ€μ
jyt6640 ff07bc8
docs: μΆκ°λ κΈ°λ₯ ꡬν λͺ©λ‘ μμ±
jyt6640 696902f
feat: κ²μ μ€λ
μ· λ° μμ½ dto μμ±
jyt6640 a9b161e
feat: κ²μ μ μ₯μ μΈν°νμ΄μ€ ꡬν
jyt6640 4b5d194
test: κ²μ μ μ₯ λ° λͺ¨λ κ²μμ μ°Ύμμ€λ ν
μ€νΈ μΆκ°
jyt6640 00b9850
feat: κ²μ μ μ₯ λ° λͺ¨λ κ²μμ μ°Ύμμ€λ κΈ°λ₯ ꡬν
jyt6640 4727d5b
test: κ²μ idλ‘ μ μ₯λ κ²μ μ‘°ν ν
μ€νΈ μΆκ°
jyt6640 db807d1
feat: κ²μ idλ‘ μ μ₯λ κ²μ μ‘°ν κΈ°λ₯ ꡬν
jyt6640 32a4ab0
test: κ²μ μν μμ ν
μ€νΈ μΆκ°
jyt6640 23c085e
feat: κ²μ μν μμ κΈ°λ₯ ꡬν
jyt6640 5a49376
refactor: state λ€μ΄λ° λ³κ²½ λ° κΈ°λ¬Ό/μμΉ λ°ν κΈ°λ₯ μΆκ°
jyt6640 6bd4415
test: Board ν
μ€νΈ μΆκ°
jyt6640 dd04223
test: Board νμ¬ μν λ°ν ν
μ€νΈ μΆκ°
jyt6640 1af2477
feat: Board νμ¬ μν λ°ν κΈ°λ₯ ꡬν
jyt6640 2ab4efc
test: μ₯κΈ° κ²μ ν
μ€νΈ λ³΄κ° λ° μΆκ°
jyt6640 42b8183
feat: μ₯κΈ° κ²μ κΈ°λ₯ μΆκ°
jyt6640 c5679d5
test: μ₯κΈ° κ²μ μ μ₯ κ²μ λͺ©λ‘ μ‘°ν ν
μ€νΈ μΆκ°
jyt6640 e9af6c7
test: μ¬μ©νμ§ μλ λΌμ΄λΈλ¬λ¦¬ μ κ±°
jyt6640 7fe74e2
feat: μ μ₯λ κ²μ λͺ©λ‘ μ‘°ν κΈ°λ₯ ꡬν
jyt6640 53fe18d
test: μ μ₯λ κ²μμ΄ μμ μ μ κ²μ μμ ν
μ€νΈ μΆκ°
jyt6640 cfadd1c
test: μ μ₯λ κ²μμ΄ μμ μ μ κ²μ μμ ν
μ€νΈ μμ
jyt6640 b0d55fe
feat: μ₯κΈ° κ²μ μμ κΈ°λ₯ ꡬν
jyt6640 4a57b58
test: μ₯κΈ° κ²μ μλΉμ€ ν
μ€νΈ μΆκ°
jyt6640 c8a327f
feat: μ νν κ²μ μ¬μμ κΈ°λ₯ ꡬν
jyt6640 b4fdc9b
test: ν΄μ΄ λμ΄κ°λ©΄ κ²μ μν μ μ₯ ν
μ€νΈ μΆκ°
jyt6640 cf3ea5b
feat: ν΄μ΄ λμ΄κ°λ©΄ κ²μ μν μ μ₯ κΈ°λ₯ ꡬν
jyt6640 8e7d362
refactor: save() λ¦¬ν΄ κΈ°λ₯ Long νμ
μΌλ‘ λ°ννλλ‘ λ³κ²½
jyt6640 4dbbd4e
test: μ κ²μμ μμ±νκ³ μ μ₯νλ ν
μ€νΈ μΆκ°
jyt6640 5682555
feat: μ κ²μμ μμ±νκ³ μ μ₯νλ κΈ°λ₯ ꡬν
jyt6640 1a122f7
feat: μμ°¨λ¦Ό κΈ°λ₯ ꡬν
jyt6640 67a37e8
feat: InputView ꡬν
jyt6640 cc71757
feat: OutputView ꡬν
jyt6640 1f89b60
feat: μ₯κΈ° κ²μ DB μ°λ ꡬν
jyt6640 b7dad1a
refactor: μλ¬ λ©μΈμ§ μμ
jyt6640 3487575
refactor: ν¨ν€μ§ λͺ
λ³κ²½ λ° ν΄λμ€ μμΉ μμ
jyt6640 c0f023d
refactor: ν¨ν€μ§ λͺ
λ³κ²½ λ° ν΄λμ€ μμΉ μμ
jyt6640 88461d4
test: μΆλ°κ³Ό λμ°© μμΉκ° κΆμ± μμ μλμ§ νμΈνλ κΈ°λ₯ ν
μ€νΈ μΆκ°
jyt6640 0ea1aa8
feat: μΆλ°κ³Ό λμ°© μμΉκ° κΆμ± μμ μλμ§ νμΈνλ κΈ°λ₯ ꡬν
jyt6640 e7ab8d2
test: μΆλ°κ³Ό λμ°© μμΉκ° κΆμ± μμμ λκ°μ μΌλ‘ μ΄λνλμ§ νλ¨νλ ν
μ€νΈ μΆκ°
jyt6640 a1134ad
feat: μΆλ°κ³Ό λμ°© μμΉκ° κΆμ± μμμ λκ°μ μΌλ‘ μ΄λνλμ§ νλ¨νλ κΈ°λ₯ ꡬν
jyt6640 911e2be
test: κΆμ± μμμ λκ°μ μΌλ‘ μ΄λνλ κΈ°λ₯
jyt6640 382fe5e
feat: κΆμ± μμμ λκ°μ μΌλ‘ μ΄λνλ κΈ°λ₯ ꡬν
jyt6640 b4f7691
test: κΆμ± λ΄μμ μ΄λνμ§ μμ μ μμΈ λ°μ ν
μ€νΈ μΆκ°
jyt6640 2a9a889
feat: κΆμ± λ΄μμ μ΄λνμ§ μμ μ μμΈ λ°μ κΈ°λ₯ ꡬν
jyt6640 152a826
test: μ¬κ° κΆμ± λ΄μμ μ΄λνμ§ μμ μ μμΈ λ°μ ν
μ€νΈ μΆκ°
jyt6640 aa8fa6d
feat: μ¬κ° κΆμ± λ΄μμ μ΄λνμ§ μμ μ μμΈ λ°μ μ²λ¦¬
jyt6640 baf1b2b
test: μ‘Έμ κΈ°λ³Έ λκ°μ μ΄λ μμΈ ν
μ€νΈ λ° κΆμ± λ΄μ λκ°μ μ΄λ ν
μ€νΈ μΆκ°
jyt6640 cee52ef
feat: μ‘Έμ κΈ°λ³Έ λκ°μ μ΄λ μμΈ λ° κΆμ± λ΄μ λκ°μ μ΄λ κΈ°λ₯ ꡬν
jyt6640 7e53d4d
test: ν¬μ κΆμ± λ΄μ λκ°μ μ΄λ κΈ°λ₯ ν
μ€νΈ μΆκ°
jyt6640 27c7674
feat: ν¬μ κΆμ± λ΄μ λκ°μ μ΄λ κΈ°λ₯ ꡬν
jyt6640 3a65a83
fix: κΆμ± λ΄μμ λκ°μ μ΄λμ μ¬λ°λ₯΄μ§ μμ λκ°μ μ΄λλ μ ν λλλ‘ μ§μ λͺ
μ
jyt6640 c0a9f97
test: κ° ν
μ€νΈμ κΈ°λ¬Ό κ°μ²΄λ₯Ό μλͺ» μμ±ν λ΄μ© μμ
jyt6640 c26f4ee
fix: κΆμ± λ΄μμ 2μΉΈλ§ μ΄λλλ λ²κ·Έ μμ
jyt6640 fd2cfc3
test: μ₯κ³Ό μ‘Έμ κΆμ± λ΄μμ μ‘λ κ²μ΄ μλμ¬μ ν
μ€νΈ μ½λ μμ
jyt6640 15e6fb6
style: κ°ν μΌκ΄ν λ° μλ¬ μ λμ¬ μΆκ°
jyt6640 7b85362
feat: κΈ°λ¬Ό νμ
λ³ μ μ μΆκ°
jyt6640 ade537c
test: νλ³ νμ¬ κΈ°λ¬Ό μ μ κ³μ° ν
μ€νΈ μΆκ°
jyt6640 fe56b44
feat: νλ³ νμ¬ κΈ°λ¬Ό μ μ κ³μ° κΈ°λ₯ ꡬν
jyt6640 ba9322f
feat: νλ³ μ΅μ’
κ²μ μ μ μΆλ ₯ κΈ°λ₯ ꡬν
jyt6640 3c14041
docs: 리λλ―Έ μ΅μ ν
jyt6640 514531d
refactor: μ
/μΆλ ₯ κ°ν μ¬μ©μ μΉνμ μΌλ‘ λ³κ²½
jyt6640 ae4682d
refactor: x,y λ‘ λ€μ΄λ° μΌκ΄ν
jyt6640 8a55cc8
refactor: pieceμ λ©μΈμ§λ₯Ό λμ Έμ νμ κ°μ Έμ€λλ‘ λ³κ²½
jyt6640 2539b16
test: ν½μ€μ³ ν΄λμ€λ₯Ό μ¬μ©νμ¬ ν
μ€νΈλ₯Ό μ©μ΄νκ² νλλ‘ μμ
jyt6640 ce01ab8
refactor: μλ¬ ν΄λμ€ λ³κ²½
jyt6640 7bfda5c
test: νμ€ μμΈ λ³κ²½μ λ°λ₯Έ ν
μ€νΈ μ½λ μμ
jyt6640 e23fc4a
test: μ μ₯λ κ²μμ΄ μμ μ μμΈ λ°μ ν
μ€νΈ μΆκ°
jyt6640 ca81857
feat: μ μ₯λ κ²μμ΄ μμ μ μμΈ λ°μ κΈ°λ₯ ꡬν
jyt6640 564d2ae
test: 보λ μΌκΈ 컬λ μ
ν
μ€νΈ μΆκ°
jyt6640 8c4bfbe
feat: 보λ μΌκΈ 컬λ μ
κΈ°λ₯ ꡬν
jyt6640 65897b1
test: ν
μ€νΈ μμ μ λ°λ₯Έ Board ν
μ€νΈ μμ
jyt6640 4f9debf
refactor: Boards κΈ°λ₯ ꡬνμ λ°λ₯Έ μ½λ μμ
jyt6640 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 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,70 @@ | ||
| package janggi; | ||
|
|
||
| import janggi.domain.Board; | ||
| import janggi.domain.status.Team; | ||
| import janggi.repository.CsvInitialBoardProvider; | ||
| import janggi.repository.GameRepository; | ||
| import janggi.repository.InitialBoardProvider; | ||
| import janggi.service.JanggiGameService; | ||
| import janggi.dto.GameSummary; | ||
| import janggi.domain.JanggiGame; | ||
| import janggi.domain.Point; | ||
| import janggi.dto.GameStatusInfo; | ||
| import janggi.dto.PositionInfo; | ||
| import janggi.util.DatabaseInitializer; | ||
| import janggi.util.JdbcConnectionManager; | ||
| import janggi.repository.JdbcGameRepository; | ||
| import janggi.ui.InputView; | ||
| import janggi.ui.OutputView; | ||
| import janggi.util.FileParser; | ||
| import java.util.List; | ||
|
|
||
| public class JanggiApplication { | ||
|
|
||
| public static void main(String[] args) { | ||
| List<PositionInfo> positionInfos = FileParser.readCsvFile("/janggi.csv"); | ||
| Board board = new Board(); | ||
| board.init(positionInfos); | ||
| JanggiGame game = new JanggiGame(board); | ||
| OutputView.printGameStatus(GameStatusInfo.from(game.getBoardStatus())); | ||
| JdbcConnectionManager connectionManager = new JdbcConnectionManager( | ||
| "jdbc:h2:file:./storage/janggi;AUTO_SERVER=TRUE", | ||
| "sa", | ||
| "" | ||
| ); | ||
| DatabaseInitializer databaseInitializer = new DatabaseInitializer(connectionManager); | ||
| databaseInitializer.init(); | ||
|
|
||
| GameRepository gameRepository = new JdbcGameRepository(connectionManager); | ||
| InitialBoardProvider initialBoardProvider = new CsvInitialBoardProvider(); | ||
| JanggiGameService janggiGameService = | ||
| new JanggiGameService(gameRepository, initialBoardProvider); | ||
|
|
||
| Long gameId = selectGame(janggiGameService); | ||
| playGame(janggiGameService, gameId); | ||
| } | ||
|
|
||
| private static Long selectGame(JanggiGameService janggiGameService) { | ||
| String command = InputView.readGameCommand(); | ||
| if (InputView.isNewGameCommand(command)) { | ||
| return janggiGameService.createGame(); | ||
| } | ||
| if (InputView.isLoadGameCommand(command)) { | ||
| return loadGame(janggiGameService); | ||
| } | ||
| throw new IllegalArgumentException("[ERROR] 1 λλ 2λ₯Ό μ λ ₯ν΄ μ£ΌμΈμ."); | ||
| } | ||
|
|
||
| private static Long loadGame(JanggiGameService janggiGameService) { | ||
| List<GameSummary> gameSummaries = janggiGameService.findAllGames(); | ||
| OutputView.printSavedGames(gameSummaries); | ||
| return InputView.readGameId(); | ||
| } | ||
|
|
||
| private static void playGame(JanggiGameService janggiGameService, Long gameId) { | ||
| JanggiGame janggiGame = janggiGameService.loadGame(gameId); | ||
| OutputView.printGameStatus(GameStatusInfo.from(janggiGame.getBoardStatus())); | ||
|
|
||
| while (!game.isFinished()) { | ||
| while (!janggiGame.isFinished()) { | ||
| OutputView.printCurrentTurn(janggiGame.currentTurn().getName()); | ||
| List<Point> points = InputView.readPoints(); | ||
| game.play(points.get(0), points.get(1)); | ||
| OutputView.printGameStatus(GameStatusInfo.from(game.getBoardStatus())); | ||
| janggiGameService.play(gameId, points.get(0), points.get(1)); | ||
| janggiGame = janggiGameService.loadGame(gameId); | ||
| OutputView.printGameStatus(GameStatusInfo.from(janggiGame.getBoardStatus())); | ||
| } | ||
| OutputView.printWinner(game.getWinner()); | ||
| OutputView.printWinner(janggiGame.getWinner()); | ||
| OutputView.printScore(janggiGame.scoreOf(Team.CHO), janggiGame.scoreOf(Team.HAN)); | ||
| } | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package janggi.domain; | ||
|
|
||
| import janggi.domain.piece.Piece; | ||
| import janggi.domain.piece.PieceType; | ||
| import janggi.domain.status.Team; | ||
| import janggi.dto.PositionInfo; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class Boards { | ||
|
|
||
| private static final int BOARD_HEIGHT = 10; | ||
|
|
||
| private final Board board; | ||
|
|
||
| public Boards(Board board) { | ||
| this.board = board; | ||
| } | ||
|
|
||
| public void move(Point from, Point to, Team team) { | ||
| board.move(from, to, team); | ||
| } | ||
|
|
||
| public int scoreOf(Team team) { | ||
| return board.getPiecesByPoint().values().stream() | ||
| .filter(piece -> piece.isSameTeam(team)) | ||
| .mapToInt(Piece::getScore) | ||
| .sum(); | ||
| } | ||
|
|
||
| public boolean isKingDie(Team team) { | ||
| return board.getPiecesByPoint().values().stream() | ||
| .noneMatch(piece -> piece.isSameType(PieceType.JANG) && | ||
| piece.isSameTeam(team)); | ||
| } | ||
|
|
||
| public List<PositionInfo> getBoardStatus() { | ||
| return PositionInfo.from(board.getPiecesByPoint()); | ||
| } | ||
|
|
||
| public List<List<Piece>> getPoints() { | ||
| List<List<Piece>> pieces = new ArrayList<>(); | ||
| for (int i = 0; i < BOARD_HEIGHT; i++) { | ||
| pieces.add( | ||
| Point.getPointsAtY(i).stream() | ||
| .map(board.getPiecesByPoint()::get) | ||
| .toList() | ||
| ); | ||
| } | ||
| return pieces; | ||
| } | ||
| } |
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
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.
[NIT] μ μ₯λ κ²μμ΄ μλ€λ©΄, μ¬κΈ°μμ μμΈλ₯Ό λμ§λ€κ±°λ νΉμ λλμκ° μ μλ μ νμ§κ° μμμ΄λ μ’μμ κ² κ°λ€μ.
(μ΄λ €μ£ΌμΈμ.. κ°νμ΄μ π’ )

Uh oh!
There was an error while loading. Please reload this page.
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.
μ.. νμΈνμ΅λλ€.. μΆκ°νκ³ λ³΄λ΄λλ¦¬κ² μ΅λλ€ !
(μ κ° μΌλ₯Έ ꡬμΆνλλ‘ ν΄λ³΄κ² μ΅λλ€...γ γ γ π)