/// <summary> /// Good place for IoC /// </summary> /// <returns></returns> public Direction InitializeAllCardinalPoints() { var north = new North { Name = "N" }; var south = new South { Name = "S" }; var west = new West { Name = "W" }; var east = new East { Name = "E" }; north.Left = west; north.Right = east; south.Left = east; south.Right = west; return north; }
static void Main(string[] args) { North n = CreatePlayer <North>("张三", 15); ActionStart(n); South s = CreatePlayer <South>("李四", 20); ActionStart(s); East e = CreatePlayer <East>("王五", 25); ActionStart(e); West w = CreatePlayer <West>("赵六", 30); ActionStart(w); Console.ReadLine(); }
public void Is_Rover_Present_On_Mars() { var maps = new Map(); maps.length = 100; maps.width = 100; var coordinates = new Coordinate(); coordinates.X = 0; coordinates.Y = 0; var startingDirection = new North(); //startingDirection.direction = "N"; var rover = new Rover(maps, coordinates, startingDirection); Assert.InRange(Rover.coordinate.X, 0, Rover.map.width); Assert.InRange(Rover.coordinate.Y, 0, Rover.map.length); }
public void Parse(string command) { var commands = command.Split(' '); switch (commands[0].ToLower()) { case "attack": case "a": var target = commands.Length > 1 ? commands[1] : string.Empty; Attack?.Invoke(target); break; case "east": case "e": East?.Invoke(); break; case "help": Help?.Invoke(); break; case "north": case "n": North?.Invoke(); break; case "run": Run?.Invoke(); break; case "south": case "s": South?.Invoke(); break; case "west": case "w": West?.Invoke(); break; default: Unknown?.Invoke(); break; } }
public void ExecuteKillCommand() { SetupTests(); IGameCommand north = new North(); north.ExecuteCommand(new [] { " North " }, _player); north.ExecuteCommand(new[] { " North " }, _player); north.ExecuteCommand(new[] { " North " }, _player); IGameCommand sut = new Kill(); string[] args = { "kill", "rat" }; bool result = sut.ExecuteCommand(args, _player); Assert.IsTrue(result); Assert.IsNotNull(_player.NonPlayerCharacterFighting); Assert.IsTrue(_player.CurrentHitPoints <= 0 || _player.NonPlayerCharacterFighting.CurrentHitPoints <= 0); }
public override void WriteLayerProperties(System.Xml.XmlTextWriter xmlWriter) { xmlWriter.WriteAttributeString("North", North.ToString()); xmlWriter.WriteAttributeString("South", South.ToString()); xmlWriter.WriteAttributeString("East", East.ToString()); xmlWriter.WriteAttributeString("West", West.ToString()); xmlWriter.WriteAttributeString("Rotation", Rotation.ToString()); xmlWriter.WriteAttributeString("Altitude", Altitude.ToString()); xmlWriter.WriteAttributeString("Height", Height.ToString()); xmlWriter.WriteAttributeString("Width", Width.ToString()); xmlWriter.WriteAttributeString("SeriesStartTime", SeriesStartTime.ToString("o")); xmlWriter.WriteAttributeString("SeriesEndTime", SeriesEndTime.ToString("o")); xmlWriter.WriteAttributeString("TimeStep", TimeStep.ToString()); xmlWriter.WriteAttributeString("ServiceUrl", ServiceUrl); xmlWriter.WriteAttributeString("Layers", Layers); xmlWriter.WriteAttributeString("Styles", Styles); xmlWriter.WriteAttributeString("Version", WmsVersion); xmlWriter.WriteAttributeString("TimeRanges", GetDateRangeString()); }
public XmlNode ToXml(XmlNode parent) { XmlNode result = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "LatLonAltBox", string.Empty); // child nodes XmlNode nodNorth = result.OwnerDocument.CreateNode(XmlNodeType.Element, "north", string.Empty); nodNorth.InnerText = North.ToString(); result.AppendChild(nodNorth); XmlNode nodSouth = result.OwnerDocument.CreateNode(XmlNodeType.Element, "south", string.Empty); nodSouth.InnerText = South.ToString(); result.AppendChild(nodSouth); XmlNode nodEast = result.OwnerDocument.CreateNode(XmlNodeType.Element, "east", string.Empty); nodEast.InnerText = East.ToString(); result.AppendChild(nodEast); XmlNode nodWest = result.OwnerDocument.CreateNode(XmlNodeType.Element, "west", string.Empty); nodWest.InnerText = West.ToString(); result.AppendChild(nodWest); XmlNode nodMinAltitude = result.OwnerDocument.CreateNode(XmlNodeType.Element, "minAltitude", string.Empty); nodMinAltitude.InnerText = MinAltitude.ToString(); result.AppendChild(nodMinAltitude); XmlNode nodMaxAltitude = result.OwnerDocument.CreateNode(XmlNodeType.Element, "maxAltitude", string.Empty); nodMaxAltitude.InnerText = MaxAltitude.ToString(); result.AppendChild(nodMaxAltitude); XmlNode nodMode = result.OwnerDocument.CreateNode(XmlNodeType.Element, "altitudeMode", string.Empty); nodMode.InnerText = AltitudeMode; result.AppendChild(nodMode); return(result); }
public bool PathToExit() { if (Domokun) { return(false); } if (IsExit) { return(true); } if (North != null && North.PathToExit()) { listOfSteps.Add("north"); return(true); } if (East != null && East.PathToExit()) { listOfSteps.Add("east"); return(true); } if (West != null && West.PathToExit()) { listOfSteps.Add("west"); return(true); } if (South != null && South.PathToExit()) { listOfSteps.Add("south"); return(true); } return(false); }
public void ExecuteInput_With_Direction_Commands_And_Position_Being_Set(int x, int y, string inputDirection, string inputcommand, int expectedXcoordinate, int expectedYCoordinate, string expectedDirection) { //Arrange ICardinalDirection direction = null; switch (inputDirection) { case "East": direction = new East(_grid); break; case "North": direction = new North(_grid); break; case "West": direction = new West(_grid); break; case "South": direction = new South(_grid); break; } var rover = new Rover(_grid, _commandList); //Act _grid.ValidateInputCoordinates(x, y); rover.SetDirection(direction); rover.ExecuteCommands(inputcommand); //Assert Assert.That(rover.CoordinateX, Is.EqualTo(expectedXcoordinate)); Assert.That(rover.CoordinateY, Is.EqualTo(expectedYCoordinate)); Assert.That(rover.Direction.ToString(), Is.EqualTo(expectedDirection)); }
/// <summary> /// get all Report in the system and divide them to four categories /// </summary> public async void getAllReports() { var allreport = await currentModel.allReports(); foreach (var r in allreport) { if (r.Latitude > 32.144343 && r.Latitude <= 33.333795 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { North.Add(r); } else if (r.Latitude > 31.571548 && r.Latitude <= 32.144343 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { Center.Add(r); } else if (r.Latitude > 29.497512 && r.Latitude <= 31.571548 && r.Longitude > 34.217333 && r.Longitude < 35.672361) { South.Add(r); } else { Other.Add(r); } } }
public void uTurn(Vehicle vh) { vh.SetDirection(North.GetNorth()); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other"> /// An object to compare with this object. /// </param> public bool Equals(LatLngBounds other) { return(other != null && East.Equals(other.East) && North.Equals(other.North) && South.Equals(other.South) && West.Equals(other.West)); }
public Rover(IGrid grid, ICommandList commandList) { _grid = grid; _commandList = commandList; Direction = new North(_grid); }
public MarsRover(Grid grid) { Direction = new North(this); this.grid = grid; }
public void North_TurnLeft_returns_West() { IDirection currentDirection = new North(); Assert.That(currentDirection.TurnLeft(), Is.TypeOf(typeof(West))); }
public void turnRight(Vehicle vh) { vh.SetDirection(North.GetNorth()); }
public void Test_North_Valid_Initialization() { var direction = new North(); Assert.AreEqual("0 1 N", direction.GetDirectionAsString()); }
public Rover(IGrid grid) { _grid = grid; Direction = new North(_grid); }
public YakuConfig() { var id = 0; aka_dora = new AkaDora(++id); tenhou = new Tenhou(++id); // Yaku situations tsumo = new Tsumo(++id); riichi = new Riichi(++id); open_riichi = new OpenRiichi(++id); ippatsu = new Ippatsu(++id); chankan = new Chankan(++id); rinshan = new Rinshan(++id); haitei = new Haitei(++id); houtei = new Houtei(++id); daburu_riichi = new DaburuRiichi(++id); daburu_open_riichi = new DaburuOpenRiichi(++id); nagashi_mangan = new NagashiMangan(++id); renhou = new Renhou(++id); // Yaku 1 Han pinfu = new Pinfu(++id); tanyao = new Tanyao(++id); iipeiko = new Iipeikou(++id); haku = new Haku(++id); hatsu = new Hatsu(++id); chun = new Chun(++id); east = new East(++id); south = new South(++id); west = new West(++id); north = new North(++id); yakuhai_place = new YakuhaiPlace(++id); yakuhai_round = new YakuhaiRound(++id); // Yaku 2 Hans sanshoku = new Sanshoku(++id); ittsu = new Ittsu(++id); chantai = new Chanta(++id); honroto = new Honroutou(++id); toitoi = new Toitoi(++id); sanankou = new Sanankou(++id); sankantsu = new Sankantsu(++id); sanshoku_douko = new SanshokuDoukou(++id); chiitoitsu = new Chiitoitsu(++id); shosangen = new Shousangen(++id); // Yaku 3 Hans honitsu = new Honitsu(++id); junchan = new Junchan(++id); ryanpeiko = new Ryanpeikou(++id); // Yaku 6 Hans chinitsu = new Chinitsu(++id); // Yakuman list kokushi = new Kokushi(++id); chuuren_poutou = new ChuurenPoutou(++id); suuankou = new Suuankou(++id); daisangen = new Daisangen(++id); shosuushi = new Shousuushii(++id); ryuisou = new Ryuuiisou(++id); suukantsu = new Suukantsu(++id); tsuisou = new Tsuisou(++id); chinroto = new Chinroutou(++id); daisharin = new Daisharin(++id); daichisei = new Daichisei(++id); // Double yakuman daisuushi = new Daisuushii(++id); daburu_kokushi = new DaburuKokushi(++id); suuankou_tanki = new SuuankouTanki(++id); daburu_chuuren_poutou = new DaburuChuurenPoutou(++id); // Yakuman situations tenhou = new Tenhou(id++); chiihou = new Chiihou(++id); renhou_yakuman = new RenhouYakuman(++id); sashikomi = new Sashikomi(++id); paarenchan = new Paarenchan(++id); // Other dora = new Dora(++id); aka_dora = new AkaDora(++id); }
public void North_TurnRight_returns_East() { IDirection currentDirection = new North(); Assert.That(currentDirection.TurnRight(), Is.TypeOf(typeof(East))); }
/// <summary> /// ueberschreibe Base.ToString. Für mehr Log-Informationen zu erhalten /// </summary> /// <returns></returns> public override string ToString() { string strLogDirections = "North=" + North.ToString() + ", East=" + East.ToString() + ", South=" + South.ToString() + ", West=" + West.ToString(); return(strLogDirections); }
public void CanCreateNorthCardinalCompassPoint() { var north = new North(); }