Skip to content

Instantly share code, notes, and snippets.

@NicoNekoru
Last active July 15, 2020 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicoNekoru/78710416720af88bdb6aab7389aaa205 to your computer and use it in GitHub Desktop.
Save NicoNekoru/78710416720af88bdb6aab7389aaa205 to your computer and use it in GitHub Desktop.
using System.Linq;
namespace BlinMaker
{
class BlinMachine
{
static void Main()
{
//init
System.Numerics.BigInteger eggsMin = 1;
System.Numerics.BigInteger eggsAmount;
System.Numerics.BigInteger milkMin = 200;
System.Numerics.BigInteger milkAmount;
System.Numerics.BigInteger flourMin = 100;
System.Numerics.BigInteger flourAmount;
//Begin
System.Console.Write("Blinmaker starting up");
for (System.Numerics.BigInteger i = 0; i < 3; i++) {
System.Console.Write(".");
System.Threading.Thread.Sleep(1000);
}
System.Console.Clear();
System.Console.WriteLine("Blinmaker ready");
System.Console.ReadKey();
System.Console.Clear();
System.Console.Write("What is your name? ");
string Input = System.Console.ReadLine();
System.Console.WriteLine("Hello " + Input);
System.Console.Write("How many eggs do you have? ");
eggsAmount = System.Numerics.BigInteger.Parse(System.Console.ReadLine());
System.Console.Write("How many milliliters of milk do you have? ");
milkAmount = System.Numerics.BigInteger.Parse(System.Console.ReadLine());
System.Console.Write("How many grams of flour do you have? ");
flourAmount = System.Numerics.BigInteger.Parse(System.Console.ReadLine());
System.Console.Clear();
//Main/Process
if (eggsAmount < eggsMin || milkAmount < milkMin || flourAmount < flourMin)
{
System.Console.WriteLine("Sorry, no blins today :(");
}
else
{
flourAmount /= flourMin;
eggsAmount /= eggsMin;
milkAmount /= milkMin;
System.Numerics.BigInteger[] final = { milkAmount, eggsAmount, flourAmount };
System.Numerics.BigInteger totalAmount = final.Min();
if (totalAmount == 1)
{
System.Console.WriteLine("You have enough stuff for " + totalAmount + " blin");
}
else
{
System.Console.WriteLine("You have enough stuff for " + totalAmount + " blins");
};
System.Numerics.BigInteger flourReq = totalAmount * flourMin;
System.Numerics.BigInteger eggReq = totalAmount * eggsMin;
System.Numerics.BigInteger milkReq = totalAmount * milkMin;
//Final Result
/*
* Ex.
* You have enough stuff for 5 blins
* You will need 500 grams of flour,
* 5 eggs, and 1000 mls of milk
*/
System.Console.WriteLine("You will need " + flourReq + " grams of flour,\n" +
eggReq + " eggs, and " + milkReq + " mls of milk");
};
//End/Exit
System.Console.ReadKey();
System.Console.Clear();
System.Console.Write("Blinmaker shutting down");
for (System.Numerics.BigInteger i = 0; i < 3; i++)
{
System.Console.Write(".");
System.Threading.Thread.Sleep(1000);
}
System.Environment.Exit(1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment