public override DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { MoveEvent ev = new MoveEvent(); if(this.Location.Item is T_AbsolutePosition) { ev.DestinationLocation = ((T_AbsolutePosition)this.Location.Item).ToLocationValue(); }else if(this.Location.Item is T_RelativePosition) { //get the relative object location, distance constraint, and/or absolute position Console.WriteLine("TODO Implement this!"); return null; } else if (this.Location.Item is LocationValue) { ev.DestinationLocation = (LocationValue)this.Location.Item; } else { Console.WriteLine("TODO Fix this!"); return null; } ev.ObjectID = this.ID; ev.Time = this.TimeAfter + currentTime; ev.Throttle = Throttle; return ev; }
public MainWindow() { _items = new Dictionary<string, T_Item>(); _timelineEvents = new ScheduledItemsList(); _ddd = new DDDAdapter(); _ddd.SetTickCallback(new DDDAdapter.TimeTickDelegate(TimeTick)); InitializeComponent(); }
public override DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { ChangeStateEvent ev = new ChangeStateEvent(); ev.ObjectID = this.ID; ev.StateName = this.State; ev.Time = this.TimeAfter + currentTime; //not sure why it parses an int to a string in the first place... return ev; }
public override DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { RevealEvent ev = new RevealEvent(); if (this.Location.Item is T_AbsolutePosition) { ev.Location = ((T_AbsolutePosition)this.Location.Item).ToLocationValue(); } else if (this.Location.Item is T_RelativePosition) { //get the relative object location, distance constraint, and/or absolute position Console.WriteLine("TODO Implement this!"); return null; } else if (this.Location.Item is LocationValue) { ev.Location = (LocationValue)this.Location.Item; } else { Console.WriteLine("TODO Fix this!"); return null; } ev.ObjectID = this.ID; ev.State = this.State; ev.Time = this.TimeAfter + currentTime; //optional params if (this.Owner != string.Empty && this.Owner != null) { ev.OwnerID = this.Owner; } if (this.Type != String.Empty && this.Type != null) { ev.ObjectType = this.Type; } if (this.StartupParameters.Items.Count() > 0) { for (int x = 0; x < this.StartupParameters.Items.Count() - 1; x += 2) { try { ev.StartupParameters.Add(StartupParameters.Items[x], ddd.GetCorrectDataValue(StartupParameters.Items[x], StartupParameters.Items[x + 1])); //this should work } catch (Exception ex) { Console.WriteLine("Exception while parsing a startup parameter. " + ex.Message); } } } return ev; }
private Boolean _readyToSendItems = true;//default to true so we always send the first scheduled item public MainWindow() { _items = new Dictionary<string, T_Item>(); _ptItems = new Dictionary<string, T_Item>(); _timelineEvents = new ScheduledItemsList(); _dmCPEs = new Dictionary<string, CPEPair>(); _ddd = new DDDAdapter(); _ddd.SetTickCallback(new DDDAdapter.TimeTickDelegate(TimeTick)); InitializeComponent(); LoadCommandLineArgs(); tbHostname.Text = _dddHostname; tbPort.Text = _dddPort.ToString(); tbShareName.Text = _dddShare; _itemSelector = new AdaptiveSelector.AdaptiveSelector(new ChallengeMethod(), ""); }
public AmbiguityGenerator(DDDAdapter ddd) : base(ddd) { }
public CourseGenerator(DDDAdapter ddd) : base(ddd) { }
public CrossingGenerator(DDDAdapter ddd) : base(ddd) { }
private static bool onlyMerchant(DDDAdapter.SeamateObject vessel) { return vessel.Owner == "Merchant DM"; }
private bool IsMerchant(DDDAdapter.SeamateObject vessel) { return vessel.Owner == "Merchant DM"; }
/// <summary> /// Returns a boolean value expressing whether or not a new vessel can be added to an existing group while fulfilling /// grouping constraints. /// One grouping: Every item in the group must be within the one-grouping parameter of each other. /// Two grouping: At least one pair in the group must be separated by the two-grouping parameter. /// </summary> /// <param name="oneOrTwo">Must be "One" or "Two" for a one- or two-grouping</param> /// <param name="newVessel">Vessel to be added to the group</param> /// <param name="otherVessels">Existing group of vessels</param> /// <returns></returns> private bool MatchesGroupingCriteria(T_Groupings grouping, DDDAdapter.SeamateObject newVessel, List<DDDAdapter.SeamateObject> otherVessels) { if (otherVessels.Contains(newVessel)) return false; if (grouping == T_Groupings.One) { foreach (DDDAdapter.SeamateObject vessel in otherVessels) { double distance = new Vec2D(vessel.Location).ScalerDistanceTo(new Vec2D(newVessel.Location)); if (distance > oneGroupingDistance) return false; } return true; } else { foreach (DDDAdapter.SeamateObject vessel in otherVessels) { double distance = new Vec2D(vessel.Location).ScalerDistanceTo(new Vec2D(newVessel.Location)); if (distance > twoGroupingDistance) return true; } return false; } }
/// <summary> /// Returns a boolean value expressing whether or not a vessel is suitable to be chosen to express a stimuli. /// </summary> /// <param name="vessel"></param> /// <returns></returns> private bool IsReusable(DDDAdapter.SeamateObject vessel) { //merchants may be attacked by multiple pirates, so it's ok to choose them even if they //already have an intent. bool isMerchantOrNotOnAttackCourse = ((vessel.Owner == "Merchant DM") || (vessel.Intent == "")); return (vessel.Owner == owner && Polygon2D.IsPointInside(domain, new Vec2D(vessel.Location)) && isMerchantOrNotOnAttackCourse); }
public PirateGenerator(DDDAdapter ddd) : base(ddd) { }
public GroupingGenerator(DDDAdapter ddd) : base(ddd) { }
public virtual DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { return null; }
public override DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { InteractionEvent ev = new InteractionEvent(); ev.CapabilityName = this.Capability; ev.ObjectID = this.Instigator; ev.TargetID = this.Target; ev.Time = this.TimeAfter + currentTime; return ev; }
public MerchantGenerator(DDDAdapter ddd) : base(ddd) { }
public override DDDEvent ToDDDEvent(int currentTime, DDDAdapter ddd) { //this currently does not send out an actual DDD event, it correlates to once which is already scripted. return null; }
/// <summary> /// Determines whether a merchant is within grouping constraints of previously chosen pirates. /// </summary> /// <param name="vessel">Merchant</param> /// <returns>Boolean</returns> private bool MatchesGroupingConstraints(DDDAdapter.SeamateObject vessel) { if (vessel.Intent != "") return false; if (grouping == T_Groupings.One) { foreach (T_Move key in dict.Keys) { Vec2D otherVesselLocation = new Vec2D(GetLocation(key, dict[key])); double distance = new Vec2D(vessel.Location).ScalerDistanceTo(otherVesselLocation); if (distance > oneGroupingDistance) return false; } return true; } else { return true; } }
public ThreatTypeGenerator(DDDAdapter ddd) : base(ddd) { }
public InterceptGenerator(DDDAdapter ddd) : base(ddd) { }