Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Refactor : Use state in AR Chess board #251

Merged
merged 48 commits into from
Apr 26, 2022
Merged

Conversation

KurohanaJuri
Copy link
Contributor

@KurohanaJuri KurohanaJuri commented Apr 13, 2022

This PR refactors the AR chess board.

Now the chess board takes a state that represent the state of a specific game, which means that the tab in the bottom bar is now removed.

For now, we use SnapshotChessBoardState which is not perfect, some methods aren't required for the AR screen (e.g.onArClick). But it's the faster way to have something that works with state. We can fix with a cleaner code later.

The test mentioned in #215 is up again, updated with the new implementation. I tested locally on devices with and without AR Core. It seems that the bug disappears.

Fixed #239

KurohanaJuri and others added 30 commits April 10, 2022 00:00
- Create `ClassicChessBoardState` that correspond to the old one;
  This state is used to display a classic 2D board
- The new `ChessBoardState` is more generic which means that this
  class only contains general information that need to be display
  (Pieces position, King in check position)
Delete useless files

Modifications:

- The contents descriptions for `Rank` and `Color` are moved outside,
  Now they are defined in `ChessBoard`
- Piece icon are now outside of the state -> In `ChessBoard`
    - The default implmentation  implements `pieces` and `checkPosition` that are commun for AR and 2D
      board
…sBoardState`

The defautl chess board state was removed because it's difficule to deal with generic type.
For the moement, we have duplicate on Ar and classic chess board state, We need to fix this
later.
This class implment values that are commun in classic chess board and AR
chess board
- Add `ArGameScreenState` that describe what is needed to display a AR board
- Add converstion between engine rank and AR model path
- Same for the colours
- Modify the `StatefulArScreen` parameter, now the screen need a match id
The test is broken and doesn't use the new implementation
Copy link
Contributor

@alexandrepiveteau alexandrepiveteau left a comment

Choose a reason for hiding this comment

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

Thanks ! Overall the PR looks good to me

Copy link
Contributor

@matt989253 matt989253 left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Just a few minor things and it should be good to go!

Co-authored-by: Matthieu Burguburu <[email protected]>
@codeclimate
Copy link

codeclimate bot commented Apr 25, 2022

Code Climate has analyzed commit 34d371c and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 94.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 97.7% (0.7% change).

View more on Code Climate.

@KurohanaJuri KurohanaJuri merged commit 4ae8d03 into main Apr 26, 2022
@KurohanaJuri KurohanaJuri deleted the refactor/cyk/new_ar_board branch April 26, 2022 07:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Chau) Refactor the AR and ChessboardState by extracting common interfaces to represent a chess view
3 participants