Пример #1
0
		public virtual bool CanMove(Robot robot)
		{
			if (_position == robot)
				return true;

			return Routes.Any(route => route.CanNavigate(_position, robot));
		}
Пример #2
0
		public virtual bool MoveTo(Robot robot)
		{
			if (!CanMove(robot))
				return false;

			_position = robot;
			return true;
		}
Пример #3
0
		public bool CanNavigate(Robot robot1, Robot robot2)
		{
			// routes are bi-directionally navigatable
			return ((Robot1 == robot1 && Robot2 == robot2) || (Robot1 == robot2 && Robot2 == robot1)) && !IsBlocked;
		}
Пример #4
0
		public Route(Robot robot1, Robot robot2)
		{
			Robot1 = robot1;
			Robot2 = robot2;
		}
Пример #5
0
			public override bool CanMove(Robot robot) => false;
Пример #6
0
			public override bool MoveTo(Robot robot) => false;
Пример #7
0
		public bool IsPositionedAt(Robot robot)
		{
			return _position == robot;
		}
Пример #8
0
		public Cart(Robot startPosition, params Route[] routes)
		{
			Routes = routes;
			_position = startPosition;
		}
Пример #9
0
			public override bool MoveTo(Robot robot)
			{
				_position = Choose(Routes.SelectMany(route => new[] { route.Robot1, route.Robot2 }));
				return true;
			}