//交换两个元素 public static void ElementSwap(GameObject a, GameObject b) { //交换元素对应的数值 fraction.Fraction value_temp = a.GetComponent <CellView>().Fraction; a.GetComponent <CellView>().Fraction = b.GetComponent <CellView>().Fraction; b.GetComponent <CellView>().Fraction = value_temp; }
/// <summary> /// 分数の絶対値を返す /// </summary> /// <param name="x"></param> /// <returns></returns> public static Fraction ABS(Fraction x) { return(new Fraction(Math.Abs(x.Numerator), Math.Abs(x.Denominator))); }