Simple 1-dimensional labyrinth I am training a colleague who is familiar with Python but has a limited knowledge of C# and complexity. I thought the following problem could be a good start.

You are in a desert, there is a (infinite) wall in front of you and you know there is exactly one door, but you don't know if it is on the left or on the right.

I implemented the labyrinth this way:

using System;

namespace _1d_labyrinth
{
    public class Labyrinth
    {
        private int _exitPosition;
        private int _currentPosition;
        private int _nSteps;

        public int Steps
        {
            get { return _nSteps; }
        }

        public bool Solved
        {
            get { return _currentPosition == _exitPosition; }
        }

        public Labyrinth(int exitPosition)
        {
            _nSteps = 0;
            _currentPosition = 0;
            _exitPosition = exitPosition;
        }

        public bool MoveRight()
        {
            _nSteps++;
            _currentPosition++;
            return _currentPosition == _exitPosition;
        }

        public bool MoveLeft()
        {
            _nSteps++;
            _currentPosition--;
            return _currentPosition == _exitPosition;
        }
    }
}


The strategy evaluator (which just counts the total number of steps taken to solve a fixed set of labyrinths)

using System;

namespace _1d_labyrinth
{
    public static class StrategyEvaluator
    {
        public static int Run(ISolver solver, int steps)
        {
            Random rnd = new Random(1);
            int totalSteps = 0;
            for (int i = 0; i &lt; steps; i++)
            {
                Labyrinth lb = new Labyrinth(rnd.Next() * ((rnd.Next() % 2) - 1));
                solver.Run(lb);
                if (lb.Solved)
                    totalSteps += lb.Steps;
                else
                    throw new Exception("Not solved !");
            }
            return totalSteps;
        }

    }
}


Where a solver is just a way to solve the labyrinth.

namespace _1d_labyrinth
{
    interface ISolver
    {
        void Run(Labyrinth lb);
    }
}


And this is my solution (where multiplier will be 2 or 3)

namespace _1d_labyrinth
{
    public class Solver1 : ISolver
    {
        private int _multiplier;

        public Solver1(int multiplier)
        {
            _multiplier = multiplier;
        }

        public void Run(Labyrinth lb)
        {
            bool finished = false,
                moveRight = true;

            int stepsToTake = 1,
                stepsTaken = 0;

            while (!finished)
            {
                while (stepsTaken &lt; stepsToTake)
                {
                    if (moveRight)
                        finished = lb.MoveRight();
                    else
                        finished = lb.MoveLeft();
                    stepsTaken++;
                }
                moveRight = !moveRight;
                stepsToTake *= _multiplier;
            }
        }
    }
}


It allows to introduce interfaces and complexity. Is there anything I could add or make better in the example ?
I'm focusing on the various naming issues.



Why _nSteps? Why not simply _steps? Same for rnd instead of random, lb instead of labyrinth. The General Naming Conventions say: 


  In general, you should not use abbreviations or acronyms. These make
  your names less readable.




What kind of name is _1d_labyrinth for a namespace? The General Naming Conventions say:


  Do not use underscores, hyphens, or any other nonalphanumeric
  characters.


Also, a namespace's name should be PascalCase, so in this case OneDimensionalLabyrinth.



Why Solver1? Is there also a Solver2 and a Solver3 etc? What are their differences? Base your class name on the particulars of your class.