Skip to content

Commit

Permalink
forksが空の場合fix
Browse files Browse the repository at this point in the history
  • Loading branch information
na2hiro committed Feb 11, 2015
1 parent 6bda0a5 commit a5f9a9c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions out/kifuplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,8 @@ var JKFPlayer = (function () {
if (addToFork) {
// 最終手でなければ分岐に追加
var next = this.getMoveFormat(this.tesuu + 1);
if (!next.forks)
next.forks = [];
next.forks.push([newMove]);
}
else {
Expand Down
2 changes: 2 additions & 0 deletions out/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,8 @@ var JKFPlayer = (function () {
if (addToFork) {
// 最終手でなければ分岐に追加
var next = this.getMoveFormat(this.tesuu + 1);
if (!next.forks)
next.forks = [];
next.forks.push([newMove]);
}
else {
Expand Down
1 change: 1 addition & 0 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class JKFPlayer{
if(addToFork){
// 最終手でなければ分岐に追加
var next = this.getMoveFormat(this.tesuu+1);
if(!next.forks) next.forks = [];
next.forks.push([newMove]);
}else{
// 最終手に追加
Expand Down
2 changes: 2 additions & 0 deletions test/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
res.inputMove({from: {x: 3, y: 1}, to: {x: 2, y: 2}});
res.inputMove({to: {x: 6, y: 5}, piece: "KA"});
res.inputMove({to: {x: 4, y: 5}, piece: "KA"});
res.backward();
res.inputMove({to: {x: 5, y: 5}, piece: "KA"});
}
</script>

0 comments on commit a5f9a9c

Please sign in to comment.