AIXI.MazeEnvironment.MazeEnvironment C# (CSharp) Method

MazeEnvironment() public method

public MazeEnvironment ( string>.Dictionary options, string layout = "" ) : System
options string>.Dictionary
layout string
return System
        public MazeEnvironment(Dictionary<string, string> options, string layout="")
            : base(options)
        {
            //Note: numbering of rows of maze is such:
            // 0 - {first/upper one}
            // 1 - {second one}
            //...
            if (layout == "") {
                layout =
            @"#######
            #.....#
            #.#.#.#
            #.#@#.#
            #######";
            }

            this.ValidActions = new[] { this.ALeft, this.AUp, this.ARight, this.ADown };
            this.ValidObservations= new int[this.max_observation()+1];
            for (int i = 0; i < this.max_observation() + 1; i++)
            {
                this.ValidObservations[i] = i;
            }
            //valid_rewards are defined bellow

            var rows = layout.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            this.Height = rows.Length;

            if (Height == 0) {
                throw new ArgumentException("Layout is empty");
            }

            this.Width = rows[0].Length;
            this.Maze = new char[Height, Width];

            ValidRewards = (int[])Enum.GetValues(typeof(RewardEnum));

            for (int y = 0; y < Height; y++)
            {
                string row = rows[y];
                if (row.Length != Width)
                {
                    throw new ArgumentException("maze is not rectangular");
                }
                for (int x = 0; x < Width; x++)
                {
                    this.Maze[y, x] = row[x];
                }
            }
            base.fill_out_bits();

            this.place_agent();

            this.calculate_observation();
            this.Reward = 0;
        }