Skip to content

Commit

Permalink
fix Analysis breaks during Horde #272 (closes #273)
Browse files Browse the repository at this point in the history
* fix cpForWhiteStr

* Update store.js

Add "const" to pgnBoard

---------

Co-authored-by: Johannes Czech <[email protected]>
  • Loading branch information
ksthicke and QueensGambit authored May 7, 2024
1 parent de7e3a3 commit 3cc602b
Showing 1 changed file with 4 additions and 10 deletions.
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

0 comments on commit 3cc602b

Please sign in to comment.