finished game is finished

This commit is contained in:
Thibault Duplessis 2015-05-06 20:06:30 +02:00
parent 8078e7c68a
commit ad83f24ece
5 changed files with 8 additions and 7 deletions

View file

@ -77,7 +77,7 @@ private[api] final class RoundApi(
} yield Step.Move(pos._1, pos._2, san),
fen = Forsyth >> g,
check = g.situation.check,
dests = possibleMoves ?? g.situation.destinations)
dests = (possibleMoves && !g.situation.end) ?? g.situation.destinations)
}
a.fold(steps) {
case (pgn, analysis) => applyAnalysis(steps, pgn, analysis, game.variant, possibleMoves)
@ -117,7 +117,7 @@ private[api] final class RoundApi(
} yield Step.Move(orig, dest, san),
fen = Forsyth >> g,
check = g.situation.check,
dests = possibleMoves ?? g.situation.destinations)
dests = (possibleMoves && !g.situation.end) ?? g.situation.destinations)
}
private def withNote(note: String)(json: JsObject) =

@ -1 +1 @@
Subproject commit 46251c175f1331068b79aebee4da62abf02fde99
Subproject commit ca8ea65c36f1460db3d6ea86c80cd4fd957ffbb7

View file

@ -19,6 +19,6 @@ case class AnaMove(
},
fen = chess.format.Forsyth >> game,
check = game.situation.check,
dests = game.situation.destinations)
dests = !game.situation.end ?? game.situation.destinations)
}
}

View file

@ -54,12 +54,13 @@ module.exports = function(opts) {
s = this.analyse.getStep(this.vm.path);
}
var color = s.ply % 2 === 0 ? 'white' : 'black';
var dests = readDests(s.dests);
var config = {
fen: s.fen,
turnColor: color,
movable: {
color: color,
dests: readDests(s.dests)
color: Object.keys(dests).length === 0 ? null : color,
dests: dests
},
check: s.check,
lastMove: s.uci ? [s.uci.substr(0, 2), s.uci.substr(2, 2)] : null,

View file

@ -3,7 +3,7 @@ var piotr2key = require('game').piotr.piotr2key;
module.exports = {
readDests: function(lines) {
var dests = {};
lines.split(' ').forEach(function(line) {
if (lines) lines.split(' ').forEach(function(line) {
dests[piotr2key[line[0]]] = line.split('').slice(1).map(function(c) {
return piotr2key[c];
});