From fd4eae3a9aefff9c06f86a90f4a58793e65024da Mon Sep 17 00:00:00 2001 From: mig Date: Mon, 22 May 2017 12:31:59 +0200 Subject: [PATCH] fixed calling engine with moves not defined --- src/core/jocly.game.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/jocly.game.js b/src/core/jocly.game.js index 2006afb..b53c599 100644 --- a/src/core/jocly.game.js +++ b/src/core/jocly.game.js @@ -748,6 +748,8 @@ JocGame.prototype.Engine = function(aBoard, aLevel, aBAlpha, aAlpha, aPotential) context.mBoard.mFinished = false; context.mBoard.mWinner = JocGame.DRAW; this.mCurrentLevel=aLevel; + if(typeof context.mBoard.mMoves == "undefined") + context.mBoard.mMoves = []; if(context.mBoard.mMoves.length==0) context.mBoard.GenerateMoves(this); @@ -995,6 +997,7 @@ JocGame.prototype.BackTo = function(aIndex,moves) { this.mBoard.InitialPosition(this); if(this.mInitial && this.mInitial.turn) this.mWho = this.mInitial.turn; + this.mBoard.mMoves=[]; this.mBoard.mWho = this.mWho; this.mBestMoves = []; this.mVisitedBoards={}; @@ -1033,6 +1036,7 @@ JocGame.prototype.ExportInitialBoardState = function(format) { JocGame.prototype.Load = function(gameData) { this.mWho = JocGame.PLAYER_A; this.mBoard = new (this.GetBoardClass())(this); + this.mBoard.mMoves=[]; if(gameData.initialBoard) { if(typeof this.Import!="function")