// don't move gnome if another gnome has collided with it
        public bool IsFrozen(IGnome gnome)
        {
            var position         = gnomePositions[gnome];
            var gnomesAtPosition = gnomePositions.Where(x => x.Value.Column == position.Column && x.Value.Row == position.Row).ToList();

            return(gnomesAtPosition.Count > 1);
        }
        private bool TryMove(IGnome gnome, int row, int column)
        {
            var newPosition = board.GetPosition(column, row);

            if (newPosition.Tile.CanMoveThrough)
            {
                gnomePositions[gnome] = newPosition;
                return(true);
            }

            return(false);
        }
        public bool TryMove(IGnome gnome, Direction direction)
        {
            var position = gnomePositions[gnome];

            switch (direction)
            {
            case Direction.North: return(TryMove(gnome, position.Row - 1, position.Column));

            case Direction.East: return(TryMove(gnome, position.Row, position.Column + 1));

            case Direction.South: return(TryMove(gnome, position.Row + 1, position.Column));

            case Direction.West: return(TryMove(gnome, position.Row, position.Column - 1));

            default: throw new Exception($"Unexpected direction {direction}");
            }
        }
 public void KillGnome(IGnome gnome)
 {
     gnomePositions.Remove(gnome);
 }