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

fix #272 #273

Merged
merged 2 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/renderer/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,12 +1314,8 @@ export const store = new Vuex.Store({
// if the SAN in the pgn is the same than the SAN in states.moves
// and we are at the last move, return pgn result
if (state.selectedGame) {
let pgnBoard
if (state.selectedGame.headers('FEN')) {
pgnBoard = new ffish.Board(state.variant, state.selectedGame.headers('FEN'))
} else {
pgnBoard = state.board
}
const pgnBoard = new ffish.Board(state.variant, state.startFen)

const pgnMoves = state.selectedGame.mainlineMoves()
const san = pgnBoard.variationSan(pgnMoves, ffish.Notation.SAN, false)
let str = ''
Expand All @@ -1334,10 +1330,8 @@ export const store = new Vuex.Store({

if (typeof mate === 'number') {
return `#${calcForSide(mate, state.turn)}`
} else if (currentMove && currentMove.name.includes('#')) {
return state.turn ? '0-1' : '1-0'
} else if (state.legalMoves.length === 0) {
return '1/2-1/2'
} else if (state.board != null && state.board.isGameOver()) {
return state.board.result()
} else {
return cpToString(getters.cpForWhite)
}
Expand Down
Loading