public bool PlaceNode(Node node) { var added = _grid.AddNode(node); Size = _grid.Size; IslandSet.Add(node); return(added); }
/// <summary> /// Adds the specified Arc to the game board. /// </summary> public bool Push(Arc arc, Field field) { if (!field.ValidPlacement(arc)) { return(false); } // Push the arc onto the field arc.Push(field); Arcs.Add(arc); // Notify the island set of connected nodes IslandSet.Connect(field); return(true); }
/// <summary> /// Removes the specified Arc from the game board. /// </summary> public bool Pull(Arc arc) { if (arc.IsPulled) { return(false); } // Pull the arc from the field var field = arc.Field; arc.Pull(); Arcs.Remove(arc); // Notify the island set of disconnected nodes IslandSet.Disconnect(field); return(true); }
/// <summary> /// Checks if the two nodes are connected via arcs /// </summary> public bool IsConnected(Node start, Node end) { return(IslandSet.IsConnected(start, end)); }