Skip to content

Commit

Permalink
v5.0.0-alpha.275: Pure Draw Analysis included in Statistics Message (#…
Browse files Browse the repository at this point in the history
…105)

* Added Draw Level and Remotness with dummy values to Game Body

* GG and Horse SVGs

* update package.json

---------

Co-authored-by: Arihant Choudhary <arihant@Arihants-MacBook-Pro.local>
  • Loading branch information
cameroncheung00 and Arihant Choudhary committed Nov 27, 2023
1 parent 42e1895 commit 99c580d
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
"preview:https": "serve dist",
"reinstall": "rm -rf node_modules; yarn; vue-tsc --noEmit"
},
"version": "5.0.0-alpha.274"
"version": "5.0.0-alpha.275"
}
16 changes: 14 additions & 2 deletions src/components/units/GameBody/AppGameBodyStatisticsMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
<b class="uni-turn-1">{{ currentLeftPlayerName }}</b> and
<b class="uni-turn-2">{{ currentRightPlayerName }}</b> are in a
<mark :class="`uni-${currentPositionValue}`">draw</mark>!
<span v-if="currentDrawLevel != -1">
<br/>
The current position is a
<mark :class="`uni-${currentPositionValue}`"> draw </mark>
<mark :class="`uni-${currentDrawValue}`"> {{currentDrawValue}}</mark>.
<br/>
<strong> Draw Level: </strong> <mark :class="`uni-${currentPositionValue}`">{{ currentDrawLevel }} </mark> ;
Draw Remoteness: <mark :class="`uni-${currentPositionValue}`"> {{currentDrawRemoteness}}</mark>
</span>
</p>
<!-- Games: Special handling if current position is unsolved -->
<p v-else-if="!isPuzzleGame && currentPositionValue === 'unsolved'">
Expand Down Expand Up @@ -76,6 +85,9 @@
const currentPlayerIsComputer = computed(() => (store.getters.currentPlayer ? store.getters.currentPlayer.isComputer : false));
const currentRemoteness = computed(() => store.getters.currentRemoteness);
const currentPositionValue = computed(() => store.getters.currentPositionValue);
const currentDrawValue = computed(() => store.getters.currentPositionDrawRemoteness % 2 == 0 ? "lose": "win");
const currentDrawRemoteness = computed(() => store.getters.currentPositionDrawRemoteness);
const currentDrawLevel = computed(() => store.getters.currentPositionDrawLevel);
const currentWinBy = computed(() => store.getters.currentWinBy);
const mexStr = computed(() => (store.getters.currentPositionMex !== "") ? "[Grundy #: " + store.getters.currentPositionMex + "]" : "");
</script>
Expand All @@ -87,10 +99,10 @@
> p {
padding: 1rem;
text-align: center;
> mark {
mark {
border-radius: 1rem;
padding: 0.25rem 0.5rem;
}
}
}
}
</style>
6 changes: 6 additions & 0 deletions src/components/units/GameBody/AppGameBodyStatisticsStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
#app-game-body-statistics-status {
border-radius: 1rem;
border: 0.1rem solid var(--neutralColor);
align-content: stretch;
align-items: center;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-around;
> p {
padding: 1rem;
text-align: center;
Expand Down
5 changes: 4 additions & 1 deletion src/models/datas/defaultApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const defaultAvailableMove: Types.Move = {
remoteness: 0,
winby: 0,
mex: "",
animationPhases: []
drawLevel: -1,
drawRemoteness: -1
};

export const defaultAvailableMoveNames: Types.MoveNames = {};
Expand All @@ -48,6 +49,8 @@ export const defaultPosition: Types.Position = {
remoteness: 0,
mex: "",
winby: 0,
drawLevel: -1,
drawRemoteness: -1
};

export const defaultPositions: Types.Positions = {};
Expand Down
83 changes: 83 additions & 0 deletions src/models/images/svg/graphgame/board.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/models/images/svg/horse/board.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/models/images/thumbnail/graphgame-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/models/images/thumbnail/horse-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/scripts/apis/gamesCrafters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ export type Position = Status & {
remoteness: number;
winby: number;
mex: string;
animationPhases: Array<Array<string>>;
drawLevel: number;
drawRemoteness: number;
}>;
position: string;
positionValue: string;
remoteness: number;
winby: number;
mex: string;
drawLevel: number;
drawRemoteness: number;
};
};

Expand Down
5 changes: 4 additions & 1 deletion src/scripts/gamesmanUni/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ const formatMoves = (source: Array<{
remoteness: number;
winby: number;
mex: string;
animationPhases: Array<Array<string>>;
drawLevel: number;
drawRemoteness: number;
}>) => {
const target: Types.Moves = { ...Defaults.defaultAvailableMoves };
if (source.length) target[source[0].move] = { ...source[0], moveValueOpacity: 1 };
Expand Down Expand Up @@ -124,6 +125,8 @@ const loadPosition = async (app: Types.App, payload: { gameType: string; gameId:
remoteness: updatedPosition.response.remoteness,
winby: updatedPosition.response.winby,
mex: updatedPosition.response["mex"] || "",
drawLevel: "drawLevel" in updatedPosition.response ? updatedPosition.response["drawLevel"] : -1,
drawRemoteness: "drawRemoteness" in updatedPosition.response ? updatedPosition.response["drawRemoteness"] : -1
};
return app;
};
Expand Down
5 changes: 4 additions & 1 deletion src/scripts/gamesmanUni/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export type Position = Update & {
remoteness: number;
winby: number;
mex: string;
drawLevel: number;
drawRemoteness: number;
};

export type Moves = Record<string, Move>;
Expand All @@ -99,7 +101,8 @@ export type Move = {
remoteness: number;
winby: number;
mex: string;
animationPhases: Array<Array<string>>;
drawLevel: number;
drawRemoteness: number;
};

export type Commits = Update & {
Expand Down
6 changes: 6 additions & 0 deletions src/scripts/plugins/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Getters = {
currentMoveValue(state: State): string;
currentPlayer(state: State): GMUTypes.Player;
currentPosition(state: State): string;
currentPositionDrawLevel(state: State): number;
currentPositionDrawRemoteness(state: State): number;
currentPositionMex(state: State): string;
currentPositionValue(state: State): string;
currentRemoteness(state: State): number;
Expand Down Expand Up @@ -133,6 +135,10 @@ const getters: Vuex.GetterTree<State, State> & Getters = {
state.app.currentMatch.secondPlayer,
currentPosition: (state: State) =>
state.app.currentMatch.round.position.position,
currentPositionDrawLevel: (state: State) =>
state.app.currentMatch.round.position.drawLevel,
currentPositionDrawRemoteness: (state: State) =>
state.app.currentMatch.round.position.drawRemoteness,
currentPositionMex: (state: State) =>
state.app.currentMatch.round.position.mex,
currentPositionValue: (state: State) =>
Expand Down

0 comments on commit 99c580d

Please sign in to comment.