function isLegalMove(pos, fig) {
    if(!fig) fig = state.next;
    if(!board.validPos(pos)) return false;
    var boardFig = board.getPos(pos);
    
    if ((boardFig === TRIPLE_FIG.TREASURE) || (boardFig === TRIPLE_FIG.BIGTREASURE)) 
      return true;

    if(boardFig === TRIPLE_FIG.EMPTY) 
      return fig !== TRIPLE_FIG.ROBOT;
    
    return fig === TRIPLE_FIG.ROBOT;
  }
// return true if fig can set at x,y
return true if fig can set at x,y
return true if fig can set at x y
function isLegalMove(pos, fig) {
    if(!fig) fig = state.next;
    if(!board.validPos(pos)) return false;
    var boardFig = board.getPos(pos);
    if ((boardFig === TRIPLE_FIG.TREASURE) || (boardFig === TRIPLE_FIG.BIGTREASURE)) 
      return true;
    if(boardFig === TRIPLE_FIG.EMPTY) 
      return fig !== TRIPLE_FIG.ROBOT;
    return fig === TRIPLE_FIG.ROBOT;
  }
function isLegalMove ( pos , fig ) { if ( ! fig ) fig = state . next ; if ( ! board . validPos ( pos ) ) return false ; var boardFig = board . getPos ( pos ) ; if ( ( boardFig === TRIPLE_FIG . TREASURE ) || ( boardFig === TRIPLE_FIG . BIGTREASURE ) ) return true ; if ( boardFig === TRIPLE_FIG . EMPTY ) return fig !== TRIPLE_FIG . ROBOT ; return fig === TRIPLE_FIG . ROBOT ; }
return true if fig can set at x,y
return true if fig can set at x y