Super-Mario/Map.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace SuperMario
{
    using System;

    /// <summary>
    /// Creates the game field.
    /// </summary>
    /// <exception cref="ArgumentOutOfRangeException">
    /// Thrown when map's width or height is less then the minimal width and height.
    /// <see cref="MIN_WIDTH"/> and <see cref="MIN_HEIGHT"/>
    /// </exception>
    public class Map
    {
        private const int MIN_WIDTH = 22;
        private const int MIN_HEIGHT = 50;

        private int width;
        private int height;

        public Map(int width = MIN_WIDTH, int height = MIN_HEIGHT)
        {
            this.Width = width;
            this.Height = height;
        }

        public int Width
        {
            get
            {
                return this.width;
            }

            private set
            {
                if (value < MIN_WIDTH)
                {
                    throw new ArgumentOutOfRangeException("width", "Map width is to small");
                }

                this.width = value;
            }
        }

        public int Height
        {
            get
            {
                return this.height;
            }

            private set
            {
                if (value < MIN_HEIGHT)
                {
                    throw new ArgumentOutOfRangeException("height", "Map height is to small");
                }

                this.height = value;
            }
        }
后面还有 3 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。