index.js
function (variation) {
			variation = variation || 0;

			var localNodes = sequence.nodes;
			var localIndex = (localNodes) ? localNodes.indexOf(node) : null;

			// If there are no additional nodes in this sequence,
			// advance to the next one
			if (localIndex === null || localIndex >= (localNodes.length - 1)) {
				if (sequence.sequences) {
					if (sequence.sequences[variation]) {
						sequence = sequence.sequences[variation];
					} else {
						sequence = sequence.sequences[0];
					}

					node = sequence.nodes[0];

					// Note the fork chosen for this variation in the path
					this.path[this.path.m] = variation;
					this.path.m += 1;
				} else {
					// End of sequence / game
					return this;
				}
			} else {
				node = localNodes[localIndex + 1];
				this.path.m += 1;
			}

			return this;
		}
function (variation) {
			variation = variation || 0;

			var localNodes = sequence.nodes;
			var localIndex = (localNodes) ? localNodes.indexOf(node) : null;

			// If there are no additional nodes in this sequence,
			// advance to the next one
			if (localIndex === null || localIndex >= (localNodes.length - 1)) {
				if (sequence.sequences) {
					if (sequence.sequences[variation]) {
						sequence = sequence.sequences[variation];
					} else {
						sequence = sequence.sequences[0];
					}

					node = sequence.nodes[0];

					// Note the fork chosen for this variation in the path
					this.path[this.path.m] = variation;
					this.path.m += 1;
				} else {
					// End of sequence / game
					return this;
				}
			} else {
				node = localNodes[localIndex + 1];
				this.path.m += 1;
			}

			return this;
		}
function ( variation ) { variation = variation || 0 ; var localNodes = sequence . nodes ; var localIndex = ( localNodes ) ? localNodes . indexOf ( node ) : null ; // If there are no additional nodes in this sequence, // advance to the next one if ( localIndex === null || localIndex >= ( localNodes . length - 1 ) ) { if ( sequence . sequences ) { if ( sequence . sequences [ variation ] ) { sequence = sequence . sequences [ variation ] ; } else { sequence = sequence . sequences [ 0 ] ; } node = sequence . nodes [ 0 ] ; // Note the fork chosen for this variation in the path this . path [ this . path . m ] = variation ; this . path . m += 1 ; } else { // End of sequence / game return this ; } } else { node = localNodes [ localIndex + 1 ] ; this . path . m += 1 ; } return this ; }
Go to the next move
Go to the next move