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; }
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; }
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); } }