/// <summary> /// Returns the backward move of the given move. /// A "backward move" of a move has all the seed movements in the converse order, and each seed movement has swapped "FromPit" and "ToPit". /// </summary> public Move GetBackwardMove() { Move backMove = new Move(); // Walk backwards through the list of seed movements: for (int index = _seedMovementList.Count - 1; index >= 0; --index) { // Take the seed movement at position "index": SeedMovement origSeedMovement = _seedMovementList[index]; // Create a new seed movement that has swapped FromPit and ToPit: SeedMovement backSeedMovement = new SeedMovement(origSeedMovement.ToPit, origSeedMovement.FromPit, origSeedMovement.NumberOfSeeds); // Add the new seed movement to the backward move: backMove.AddSeedMovement(backSeedMovement); } return backMove; }
/// <summary>Adds a seed movement at the end of the list of movements.</summary> /// <param name="seedMovement">The seed movement to add</param> public void AddSeedMovement(SeedMovement seedMovement) { _seedMovementList.Add(seedMovement); }
/// <summary>Adds a seed movement at the beginning of the list of movements.</summary> /// <param name="seedMovement">The seed movement to add</param> public void AddSeedMovementToTheFront(SeedMovement seedMovement) { _seedMovementList.Insert(0, seedMovement); }
/// <summary>Removes the given seed movement from the move.</summary> /// <param name="movementToRemove">The seed movement to remove from the move (yeah! :-).</param> public void RemoveSeedmovement(SeedMovement movementToRemove) { _seedMovementList.Remove(movementToRemove); }