public override bool IsUnit() => Num.Equals(Den);
public bool Equals(Republique other) { return(Num.Equals(other.Num)); }
public override bool IsNull() => Num.Equals((Integer)0);
public override bool IsNull() => Num.Equals((RealPolynomial)Null <FractionalFunction>());
public static Stats ChooseStats() { int MaxPoints = 7; int RemainingPoints = MaxPoints; int Step = 0; string State = "", CurTop; string Num, Ans; int Strength = 0, Ability = 0, Resistance = 0, Armor = 0, Firepower = 0; Console.Clear(); CurTop = "It is now time for you to determine the numbers of your characteristics.\nYou have a total of 7 points to spend on 5 different characteristics.\n\n"; CurTop += Descriptor.Strength; while (true) { Console.Clear(); CharacterCreator.PrintState(State, CurTop, RemainingPoints); if (Step == 0) { Console.Write("Strength: "); Num = Console.ReadLine(); if (Num.Equals("") || !CharacterCreator.IsNum(Num) || Int32.Parse(Num) > RemainingPoints) { Console.Clear(); CurTop = "Invalid value"; } else { int Value = Int32.Parse(Num); Step++; State += "Strength: " + Num + "\n"; Strength = Value; RemainingPoints -= Value; CurTop = Descriptor.Ability; } } else if (Step == 1) { Console.Write("Ability: "); Num = Console.ReadLine(); if (Num.Equals("") || !CharacterCreator.IsNum(Num) || Int32.Parse(Num) > RemainingPoints) { Console.Clear(); CurTop = "Invalid value"; } else { int Value = Int32.Parse(Num); Step++; State += "Ability: " + Num + "\n"; Ability = Value; RemainingPoints -= Value; CurTop = Descriptor.Resistance; } } else if (Step == 2) { Console.Write("Resistance: "); Num = Console.ReadLine(); if (Num.Equals("") || !CharacterCreator.IsNum(Num) || Int32.Parse(Num) > RemainingPoints) { Console.Clear(); CurTop = "Invalid value"; } else { int Value = Int32.Parse(Num); Step++; State += "Resistance: " + Num + "\n"; Resistance = Value; RemainingPoints -= Value; CurTop = Descriptor.Armor; } } else if (Step == 3) { Console.Write("Armor: "); Num = Console.ReadLine(); if (Num.Equals("") || !CharacterCreator.IsNum(Num) || Int32.Parse(Num) > RemainingPoints) { Console.Clear(); CurTop = "Invalid value"; } else { int Value = Int32.Parse(Num); Step++; State += "Armor: " + Num + "\n"; Armor = Value; RemainingPoints -= Value; CurTop = Descriptor.Firepower; } } else if (Step == 4) { Console.Write("Firepower: "); Num = Console.ReadLine(); if (Num.Equals("") || !CharacterCreator.IsNum(Num) || Int32.Parse(Num) > RemainingPoints) { Console.Clear(); CurTop = "Invalid value"; } else { int Value = Int32.Parse(Num); Step++; State += "Firepower: " + Num + "\n"; Firepower = Value; RemainingPoints -= Value; } } else if (Step == 5) { if (RemainingPoints > 0) { Console.WriteLine("\nYou still have {0} unspent point{1}", RemainingPoints, (RemainingPoints > 1 ? "s" : "")); while (true) { Console.WriteLine("Do you wish to reset your points?"); Console.WriteLine("1. Yes"); Console.WriteLine("2. No"); Ans = Console.ReadLine(); Ans = YesNoInput.Parse(Ans); if (Ans.Equals("yes")) { RemainingPoints = MaxPoints; Step = 0; State = ""; break; } else if (Ans.Equals("no")) { return(new Stats(Strength, Firepower, Resistance, Armor, Ability)); } else { Console.WriteLine("Invalid command\n"); } } } else { return(new Stats(Strength, Firepower, Resistance, Armor, Ability)); } } } }
private void Check(float expected, Num result) { Assert.IsTrue(result.Equals(expected)); //Assert.AreEqual(expected, (double)result); //Assert.IsTrue(result == expected); }
public void SetLoadSlot() { string Data = ""; string Num; int Value; Console.Clear(); while (true) { Console.WriteLine("Which slot would you like to load? (Type ENTER on empty slot to return)"); for (int i = 1; i <= this.SlotsNum; i++) { string SlotFile = String.Join("", "./GameData/Save/slot", i, ".sav"); Console.Write("> {0}", i); if (!File.Exists(SlotFile)) { Console.Write(" - Empty\n"); } else { if (LoadSlotData(i, ref Data)) { Console.Write(" - {0}\n", Data); } else { Console.Write(" - Empty\n"); } } } Num = Console.ReadLine(); if (Num.Equals("")) { return; } try { Value = Int32.Parse(Num); } catch (FormatException) { Console.Clear(); Console.WriteLine("Invalid slot number\n"); continue; } if (Value < 1 || Value > this.SlotsNum) { Console.Clear(); Console.WriteLine("Invalid slot number\n"); continue; } if (SlotState[Value].Equals("full")) { this.CurrentSlot = Value; return; } else { Console.Clear(); Console.WriteLine("Empty slot\n"); continue; } } }
public int SetSaveSlot() { string Num; int Value = 0; string Data = ""; Console.Clear(); while (true) { Console.WriteLine("Which slot do you want to save in? (Type ENTER on empty slot to return)"); for (int i = 1; i <= this.SlotsNum; i++) { string SlotFile = String.Join("", "./GameData/Save/slot", i, ".sav"); Console.Write("> {0}", i); if (!File.Exists(SlotFile)) { Console.Write(" - Empty\n"); } else { if (LoadSlotData(i, ref Data)) { Console.Write(" - {0}\n", Data); } else { Console.Write(" - Empty\n"); } } } Num = Console.ReadLine(); if (Num.Equals("")) { return(-1); } try { Value = Int32.Parse(Num); } catch (FormatException) { Console.Clear(); Console.WriteLine("Invalid slot number\n"); continue; } if (Value < 1 || Value > 20) { Console.Clear(); Console.WriteLine("Invalid slot number\n"); continue; } if (this.SlotState[Value].Equals("empty")) { this.SlotState[Value] = "full"; this.CurrentSlot = Value; return(Value); } else { Console.Clear(); string Ans; while (true) { Console.WriteLine("This slot is already full"); Console.WriteLine("Do you wish to overwrite it?"); Console.WriteLine("1. Yes"); Console.WriteLine("2. No"); Ans = Console.ReadLine(); Ans = YesNoInput.Parse(Ans); if (Ans.Equals("yes")) { this.SlotState[Value] = "full"; this.CurrentSlot = Value; return(Value); } else if (Ans.Equals("no")) { Console.Clear(); break; } else { Console.Clear(); Console.WriteLine("Invalid command\n"); } } } } }
public override bool IsNull() => Num.Equals(0);
public override bool IsNull() => Num.Equals(new T());