示例#1
0
        public override void SetMode(GameMode mode, Granularity granularity)
        {
            this.mode = mode;
            Xval      = GenRand(xmax);
            Yval      = GenRand(ymax);

            if (granularity != Granularity.ONE)
            {
                Xval = Xval.Round((int)granularity);
                Yval = Yval.Round((int)granularity);
            }

            Zval = Xval + Yval;
        }
示例#2
0
        public override void SetMode(GameMode mode, Granularity granularity)
        {
            this.mode = mode;
            Xval      = GenRand(xmax);
            Yval      = GenRand(ymax);

            // Swap to avoid negative numbers
            if (Xval - Yval < 0)
            {
                int tmp = Xval;
                Yval = Xval;
                Xval = Yval;
            }

            if (granularity != Granularity.ONE)
            {
                Xval = Xval.Round((int)granularity);
                Yval = Yval.Round((int)granularity);
            }

            Zval = Xval - Yval;
        }
示例#3
0
        public override void SetMode(GameMode mode, Granularity granularity)
        {
            this.mode = mode;

            // Slumpa fram X först
            int Xtmp = GenRand(xmax) + 1;

            // Slumpa fram Z
            int Ztmp = Xtmp * GenRand(ymax);

            // Räkna fram Y
            int Ytmp = Ztmp / Xtmp;

            // Kasta runt
            xval = Ztmp;
            yval = Ytmp;
            zval = Xtmp;

            if (granularity != Granularity.ONE)
            {
                Xval = Xval.Round((int)granularity);
                Yval = Yval.Round((int)granularity);
            }
        }