1 /*
  2  * Copyright (c) 2012-2014 Nonki Takahashi. All rights reserved.
  3  *
  4  * History:
  5  *  0.4 2014-01-29 Changed RESIGN and PASS from var to const.  Changed interface.
  6  *  0.3 2013-06-15 Supported JsDoc Toolkit.
  7  *  0.2 2012-05-18 Changed Move.pass(ro) to PASS(ro).
  8  *  0.1 2012-05-15 Created.  Ported from Java version.
  9  */
 10 
 11 /**
 12  * @fileOverview Class represents a position to plase stone on go board
 13  * @author Nonki Takahashi
 14  * @version 0.4
 15  */
 16 
 17 /**
 18  * Special Move parameter for resign
 19  * @constant
 20  * @since 0.4
 21  */
 22 const RESIGN = 0;
 23 
 24 /**
 25  * Special Move parameter for pass
 26  * @constant 
 27  * @since 0.4
 28  */
 29 const PASS = -1;
 30 
 31 /**
 32  * Returns special element number for pass
 33  * @function
 34  * @param {Number} ro give number of lines of the board
 35  * @since 0.4
 36  */
 37 function pass(ro) {
 38     return ro + 1;
 39 };
 40 
 41 /**
 42  * Constructor for move object.  Column and row positions are given.
 43  * @example
 44  * var mv1 = new Move(1, 2);    // col = 1, row = 2
 45  * var mv2 = new Move(PASS);    // means pass
 46  * var mv3 = new Move(RESIGN);  // means resign
 47  * @class Represents next move (position to place stone)
 48  * @this {Move}
 49  * @prototype {Number} col column position
 50  * @prototype {Number} row row position
 51  * @prototype {Boolean} isPass true if the move is pass
 52  * @prototype {Boolean} isResign true if the move is resign
 53  * @since 0.4
 54  */
 55 Move = function() {
 56     if (arguments[0] == PASS) {
 57         this.isPass = true;
 58     } else if (arguments[0] == RESIGN) {
 59         this.isResign = true;
 60     } else if (2 <= arguments.length) {
 61     	this.col = arguments[0];
 62         this.row = arguments[1];
 63 	} 
 64 };
 65