public void Setup()
        {
            TheWorld = new World();

            // Create a 3 x 3 room
            // which is really a 4 x 4 because the walls occupy
            // a single square unit a piece.
            var floorPlan = Room.CreateEmptyRoom(5, 5);
            floorPlan[2][2] = new EntryPoint();
            floorPlan[1][2] = new ExitPoint();

            TheRoom = TheWorld.CreateRoom(floorPlan);
            TheWarrior = TheWorld.CreateWarrior();
            TheWorld.EnterRoom(TheWarrior, TheRoom);

            Context();
            Because();
        }
        public void Setup()
        {
            TheWorld = new World();
            // Create a 3 x 3 room
            // which is really a 4 x 4 because the walls occupy
            // a single square unit a piece.
            var floorPlan = Room.CreateEmptyRoom(5, 5);
            floorPlan[2][2] = new EntryPoint();

            TheRoom = TheWorld.CreateRoom(floorPlan);

            TheWarrior = new DumbBot();
            Enemy = new EnemyBot();

            TheWorld.CreateEntity(TheWarrior);
            TheWorld.CreateEntity(Enemy);

            TheWorld.EnterRoom(TheWarrior, TheRoom);
            TheWorld.EnterRoom(Enemy, TheRoom, new WorldCoordinates(2,1));

            Enemy.CurrentDirection = AbsoluteDirections.West;

            Context();
            Because();
        }
 public void EnterRoom(ISentientEntity entity, Room room, WorldCoordinates coordinates)
 {
     entity.CurrentDirection = AbsoluteDirections.North;
     room.Place(entity, coordinates);
 }
 public void EnterRoom(ISentientEntity entity, Room TheRoom)
 {
     entity.CurrentDirection = AbsoluteDirections.North;
     TheRoom.PlaceAtEntryPoint(entity);
 }
 public Room CreateRoom(List<List<RoomUnit>> floorPlan)
 {
     _TheRoom = new Room(floorPlan);
     return _TheRoom;
 }
 public WorldResponse(IEntity entity, Room theRoom)
 {
     Entity = entity;
     TheRoom = theRoom;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="location"></param>
 /// <param name="direction"></param>
 /// <param name="unitDistance"></param>
 /// <returns></returns>
 private IEntity _GetEntityAt(Room theRoom, WorldCoordinates location, AbsoluteDirections direction, int unitDistance)
 {
     var coordinateToCheck = (WorldCoordinates)location.Compute(direction, unitDistance);
     return theRoom.GetEntityAtCoordinate(coordinateToCheck);
 }
        private WorldCoordinates _GetCurrentLocation(IEntity TheWarrior, Room TheRoom)
        {
            WorldCoordinates warriorsLocation;

            var width = TheRoom.Width;
            var height = TheRoom.Height;

            for (var widthIndex = 0; widthIndex < width; widthIndex++)
            {
                for (var heightIndex = 0; heightIndex < height; heightIndex++)
                {
                    if (TheRoom.GetEntityAtCoordinate(widthIndex, heightIndex) == TheWarrior)
                    {
                        warriorsLocation = new WorldCoordinates(widthIndex, heightIndex);
                        return warriorsLocation;
                    }
                }
            }

            throw new EntityNotFoundException();
        }
 public void MoveForward(ISentientEntity TheWarrior, Room TheRoom)
 {
     var oldCoordinates = TheRoom.GetCoordinatesOf(TheWarrior);
     var newCoordinates = oldCoordinates.Compute(TheWarrior.CurrentDirection, 1);
     if(!(TheRoom.GetEntityAtCoordinate(newCoordinates) is Wall))
         TheRoom.MoveEntity(oldCoordinates, newCoordinates);
 }
 public WorldCoordinates GetCoordinatesOf(IEntity theWarrior, Room theRoom)
 {
     return theRoom.GetCoordinatesOf(theWarrior);
 }
 public IEntity Feel(RelativeDirections relativeDirection, Warrior TheWarrior, Room TheRoom)
 {
     var location = _GetCurrentLocation(TheWarrior, TheRoom);
     var direction = _ComputeAbsoluteDirection(TheWarrior, relativeDirection);
     var entity = _GetEntityAt(TheRoom, location, direction, 1);
     return entity;
 }
 public void ExitRoom(Warrior TheWarrior, Room TheRoom)
 {
     var currentCoordinates = TheRoom.GetCoordinatesOf(TheWarrior);
     var currentUnit = TheRoom.GetUnitAt(currentCoordinates);
     if (currentUnit is ExitPoint)
     {
         TheRoom.Remove(TheWarrior);
     }
 }