public Day03() : base(03, 2015, "") { HouseVisitor santa = new HouseVisitor(); HouseVisitor halfSanta = new HouseVisitor(); HouseVisitor roboSanta = new HouseVisitor(); bool useRobot = false; foreach (char c in Input) { santa.Move(c); if (useRobot) { roboSanta.Move(c); } else { halfSanta.Move(c); } useRobot = !useRobot; } countOne = santa.GetHouseCount(); countTwo = halfSanta.GetCombinedHouseCount(roboSanta); }
public static void AddPatrons(TavernTable table) { RemovePatrons(table); Point3D location = new Point3D(0, 0, 0); Direction direction = Direction.East; Mobile patron = null; if (table.PatronNorth > 0 && !table.Movable) { location = new Point3D(table.X, table.Y - 1, table.Z); if ((table.Map).CanSpawnMobile(table.X, table.Y - 1, table.Z)) { direction = Direction.South; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerNorth = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronNorth = 0; } } if (table.PatronSouth > 0 && !table.Movable) { location = new Point3D(table.X, table.Y + 1, table.Z); if ((table.Map).CanSpawnMobile(table.X, table.Y + 1, table.Z)) { direction = Direction.North; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerSouth = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronSouth = 0; } } if (table.PatronEast > 0 && !table.Movable) { location = new Point3D(table.X + 1, table.Y, table.Z); if ((table.Map).CanSpawnMobile(table.X + 1, table.Y, table.Z)) { direction = Direction.West; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerEast = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronEast = 0; } } if (table.PatronWest > 0 && !table.Movable) { location = new Point3D(table.X - 1, table.Y, table.Z); if ((table.Map).CanSpawnMobile(table.X - 1, table.Y, table.Z)) { direction = Direction.East; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerWest = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronWest = 0; } } }