/***********************************************************************************************************
 * su.bot.checkers.javascript.Node
 * Location: http://www.bot.su/library/su/bot/checkers/javascript/Node.js
 * Index Version Location: http://www.bot.su/library/su/bot/checkers/javascript/node/index.html
 * © Bot.Su (http://www.bot.su/)
***********************************************************************************************************/

if (typeof su == "undefined") {su = {};};
if (typeof su.bot == "undefined") {su.bot = {};};
if (typeof su.bot.checkers == "undefined") {su.bot.checkers = {};};
if (typeof su.bot.checkers.javascript == "undefined") {su.bot.checkers.javascript = {};};

if (typeof su.bot.checkers.javascript.Node == "undefined") {
 su.bot.checkers.javascript.Node = function() {}; 
 su.bot.checkers.javascript.Node.prototype = new com.oclib.javascript.lang.Root();

 su.bot.checkers.javascript.Node.prototype.className = "Node"; 
 su.bot.checkers.javascript.Node.prototype.classNamespace = "su.bot.checkers.javascript.Node"; 
 su.bot.checkers.javascript.Node.prototype.classCreated = "20070403"; 
 su.bot.checkers.javascript.Node.prototype.classCreator = "http://www.bot.su/"; 
 su.bot.checkers.javascript.Node.prototype.classLocation = "http://www.bot.su/library/su/bot/checkers/javascript/Node.js"; 
 su.bot.checkers.javascript.Node.prototype.classIndexLocation = "http://www.bot.su/library/su/bot/checkers/javascript/node/index.html"; 
 su.bot.checkers.javascript.Node.prototype.classVersion = "20070528"; 
 su.bot.checkers.javascript.Node.prototype.classVersionLocation = "http://www.bot.su/library/su/bot/checkers/javascript/node/builds/20070528/Node.js"; 
 su.bot.checkers.javascript.Node.prototype.classVersionIndexLocation = "http://www.bot.su/library/su/bot/checkers/javascript/node/index.html"; 
 
 su.bot.checkers.javascript.Node.prototype.board;
  su.bot.checkers.javascript.Node.prototype.getBoard = function () {return this.board;};
  su.bot.checkers.javascript.Node.prototype.setBoard = function (board) {this.board = board;}; 
 su.bot.checkers.javascript.Node.prototype.hasNode = true;
  su.bot.checkers.javascript.Node.prototype.getHasNode = function () {return this.hasNode;};
  su.bot.checkers.javascript.Node.prototype.setHasNode = function (hasNode) {this.hasNode = hasNode;}; 
 su.bot.checkers.javascript.Node.prototype.maxDepthTake = 0;
  su.bot.checkers.javascript.Node.prototype.getMaxDepthTake = function () {return this.maxDepthTake;};
  su.bot.checkers.javascript.Node.prototype.setMaxDepthTake = function (maxDepthTake) {this.maxDepthTake = maxDepthTake;}; //* */
 su.bot.checkers.javascript.Node.prototype.move = null;
  su.bot.checkers.javascript.Node.prototype.getMove = function () {return this.move;};
  su.bot.checkers.javascript.Node.prototype.setMove = function (move) {this.move = move;}; 
 su.bot.checkers.javascript.Node.prototype.nodes = new Array();
  su.bot.checkers.javascript.Node.prototype.getNodes = function () {return this.nodes;};
  su.bot.checkers.javascript.Node.prototype.resetNodes = function () {this.nodes = new Array();};
  su.bot.checkers.javascript.Node.prototype.setNodes = function (nodes) {this.nodes = nodes;}; 
 su.bot.checkers.javascript.Node.prototype.parentNode = null;
  su.bot.checkers.javascript.Node.prototype.getParentNode = function () {return this.parentNode;};
  su.bot.checkers.javascript.Node.prototype.setParentNode = function (parentNode) {this.parentNode = parentNode;}; 
 su.bot.checkers.javascript.Node.prototype.processed = false;
  su.bot.checkers.javascript.Node.prototype.getProcessed = function () {return this.processed;};
  su.bot.checkers.javascript.Node.prototype.setProcessed = function (processed) {this.processed = processed;}; 
 su.bot.checkers.javascript.Node.prototype.whoseMove; /*Владелец узла "min", "max"*/
  su.bot.checkers.javascript.Node.prototype.getWhoseMove = function () {return this.whoseMove;};
  su.bot.checkers.javascript.Node.prototype.setWhoseMove = function (whoseMove) {this.whoseMove = whoseMove;};  
  
 su.bot.checkers.javascript.Node.prototype.getCopy = function() {
  var node = this.clone();
  node.board = this.board.getCopy();
  return node;
 }; 
  
 su.bot.checkers.javascript.Node.prototype.getFullCopy = function(node) {
  var newNode = node.getCopy();
  var newNodes = new Array();
  for(var i = 0; i < node.nodes.length; i++) {
   newNodes[i] = node.nodes[i].getFullCopy(node.nodes[i]);
  };
  newNode.nodes = newNodes;
  return newNode;
 }; 
  
 su.bot.checkers.javascript.Node.prototype.similarTo = function(node) {return this.move.similarTo(node.move);};
 
 // for su.bot.checkers.javascript.bot.e.E002
 su.bot.checkers.javascript.Node.prototype.kingWeight = 0; /*-1, 0, 1*/
  su.bot.checkers.javascript.Node.prototype.getKingWeight = function () {return this.kingWeight;};
  su.bot.checkers.javascript.Node.prototype.setKingWeight = function (kingWeight) {this.kingWeight = kingWeight; this.addKingWeights(kingWeight);}; 
 su.bot.checkers.javascript.Node.prototype.kingWeights = 0;
  su.bot.checkers.javascript.Node.prototype.addKingWeights = function (kingWeight) {
   if(kingWeight == 0) {return 0;};
   this.kingWeights += kingWeight;
   if(this.parentNode != null){this.parentNode.addKingWeights(kingWeight);};
  };
  su.bot.checkers.javascript.Node.prototype.getKingWeights = function () {return this.kingWeights;};
  su.bot.checkers.javascript.Node.prototype.setKingWeights = function (kingWeights) {this.kingWeights = kingWeights;}; 
 su.bot.checkers.javascript.Node.prototype.status = 0; /*-1, 0, 1*/
  su.bot.checkers.javascript.Node.prototype.getStatus = function () {return this.status;};
  su.bot.checkers.javascript.Node.prototype.setStatus = function (status) {this.status = status; this.addStatuses(status);}; 
 su.bot.checkers.javascript.Node.prototype.statuses = 0;
  su.bot.checkers.javascript.Node.prototype.addStatuses = function (status) {
   if(status == 0) {return 0;};
   this.statuses += status;
   if(this.parentNode != null){
    this.parentNode.addStatuses(status);
   };
  };
  su.bot.checkers.javascript.Node.prototype.getStatuses = function () {return this.statuses;};
  su.bot.checkers.javascript.Node.prototype.setStatuses = function (statuses) {this.statuses = statuses;}; 
 su.bot.checkers.javascript.Node.prototype.takeWeight = 0; /*-1, 0, 1*/
  su.bot.checkers.javascript.Node.prototype.getTakeWeight = function () {return this.takeWeight;};
  su.bot.checkers.javascript.Node.prototype.setTakeWeight = function (takeWeight) {this.takeWeight = takeWeight; this.addTakeWeights(takeWeight);}; 
 su.bot.checkers.javascript.Node.prototype.takeWeights = 0;
  su.bot.checkers.javascript.Node.prototype.addTakeWeights = function (takeWeight) {
   if(takeWeight == 0) {return 0;};
   this.takeWeights +=takeWeight;
   if(this.parentNode != null){
    this.parentNode.addTakeWeights(takeWeight);
   };
  };
  su.bot.checkers.javascript.Node.prototype.getTakeWeights = function () {return this.takeWeights;};
  su.bot.checkers.javascript.Node.prototype.setTakeWeights = function (takeWeights) {this.takeWeights = takeWeights;};
  
 // for su.bot.checkers.javascript.bot.e.E003
 su.bot.checkers.javascript.Node.prototype.anticipatedNumericalSuperiority = 0;
 su.bot.checkers.javascript.Node.prototype.probabilityNumericalSuperiority = 0.5; 
 su.bot.checkers.javascript.Node.prototype.probabilityWinningProper = 0.5; 
 su.bot.checkers.javascript.Node.prototype.probabilityWinningRandom = 0.5; 
 su.bot.checkers.javascript.Node.prototype.probabilityWinningSmart = 0.5;  
  
 su.bot.checkers.javascript.Node.prototype.daughterProcessed = function() {
  for(var i = 0; i < this.nodes.length; i++) {if(!this.nodes[i].processed) {return false;};};
  if(this.nodes.length == 1) {return this.nodes[0].daughterProcessed();};
  return true;
 }; 
 
};
