static int screenLength = 220;
static int screenHeight = 50;
static int miniScreenLength = 50;
static int miniScreenHeight = 20;
static string workingCurrentOperation = "";
static string previousOperation = "";
static string currentOperation = "x";
public static void Main()
while (AddExtraOperation())
Console.WriteLine("\nTo restart and graph a new operation press ENTER.");
previousOperation = currentOperation;
public static void ResetConsole()
Console.WriteLine(" TI (-)84 [Don't ask for BEDMAS, it's not happening.]");
Console.WriteLine("(----------------------------------------------------)");
if (previousOperation != string.Empty)
Console.WriteLine(" Previous operation -> y = (" + previousOperation + ")");
Console.WriteLine(" Current operation -> y = (" + currentOperation + ")");
if (workingCurrentOperation != string.Empty)
public static void FirstOperation()
if (previousOperation != string.Empty)
Console.WriteLine("Would you like to add a new operation, or add onto the existing one?");
Console.WriteLine("• Add");
Console.WriteLine("• New");
string addChoice = string.Empty;
while(addChoice == string.Empty)
string playerChoice = Console.ReadLine();
if (playerChoice == "Add")
currentOperation = previousOperation;
else if (playerChoice == "New")
addChoice = playerChoice;
Console.WriteLine("Hello, please press ENTER to start!\n");
Console.WriteLine("What would you like to do for the first operation? [" + currentOperation + " (*, /, +, -) (operator)]");
Console.WriteLine("• *");
Console.WriteLine("• /");
Console.WriteLine("• +");
Console.WriteLine("• -");
string operationChoice = string.Empty;
while(operationChoice == string.Empty)
string playerChoice = Console.ReadLine();
operationChoice = playerChoice;
else if (playerChoice == "/")
operationChoice = playerChoice;
else if (playerChoice == "-")
operationChoice = playerChoice;
else if (playerChoice == "+")
operationChoice = playerChoice;
Console.WriteLine("Invalid option!");
currentOperation += " " + operationChoice;
Console.WriteLine("What would you like to operate by? [" + currentOperation + " (Any digit, x)]");
Console.WriteLine("• Any digit");
Console.WriteLine("• x");
float digitChoice = 0.009214f;
while(digitChoice == 0.009214f)
string playerChoice = Console.ReadLine();
digitChoice = float.Parse(playerChoice);
currentOperation += " " + digitChoice.ToString();
Console.WriteLine("Invalid Choice!");
currentOperation += " x";
workingCurrentOperation = currentOperation;
public static Boolean AddExtraOperation()
Console.WriteLine("Would you like to add another operation?");
Console.WriteLine("• Yes");
Console.WriteLine("• No");
bool continueLoop = true;
string playerChoice = Console.ReadLine();
if (playerChoice == "Yes")
else if (playerChoice == "No")
Console.WriteLine("Invalid option!");
public static void NextOperation()
Console.WriteLine("What would you like to do for the next operation?");
Console.WriteLine("• *");
Console.WriteLine("• /");
Console.WriteLine("• +");
Console.WriteLine("• -");
string operationChoice = string.Empty;
while(operationChoice == string.Empty)
string playerChoice = Console.ReadLine();
operationChoice = playerChoice;
else if (playerChoice == "/")
operationChoice = playerChoice;
else if (playerChoice == "-")
operationChoice = playerChoice;
else if (playerChoice == "+")
operationChoice = playerChoice;
Console.WriteLine("Invalid option!");
currentOperation += " " + operationChoice;
Console.WriteLine("What would you like to operate by?");
Console.WriteLine("• Any digit");
Console.WriteLine("• x");
float digitChoice = 0.009214f;
while(digitChoice == 0.009214f)
string playerChoice = Console.ReadLine();
digitChoice = float.Parse(playerChoice);
currentOperation += " " + digitChoice.ToString();
Console.WriteLine("Invalid Choice!");
currentOperation += " x";
workingCurrentOperation = currentOperation;
public static void Operate()
bool[,] spaces = new bool[screenLength, screenHeight];
for (int y = 0; y < screenHeight; y++)
for (int x = 0; x < screenLength; x++)
int xValue = CheckX(x, false);
if (previousOperation != string.Empty)
for (int y = 0; y < screenHeight; y++)
for (int x = 0; x < screenLength; x++)
int xValue = CheckX(x, true);
for (int y = screenHeight - 1; y > 0; y--)
if (y != screenHeight - 1)
for (int x = 0; x < screenLength; x++)
if (spaces[x, y] == false)
for (int x = 0; x < screenLength; x++)
if (printedSpaces < screenLength)
printedSpaces += x.ToString().Length;
public static void MiniOperate()
bool[,] spaces = new bool[miniScreenLength, miniScreenHeight];
for (int y = 0; y < miniScreenHeight; y++)
for (int x = 0; x < miniScreenLength; x++)
int xValue = CheckX(x, false);
for (int y = miniScreenHeight - 1; y > 0; y--)
for (int x = 0; x < miniScreenLength; x++)
if (spaces[x, y] == false)
public static int CheckX(int currentX, bool usePreviousOperation)
if (usePreviousOperation)
operations = previousOperation.Split();
operations = workingCurrentOperation.Split();
float prevValue = OperateValues(operations[0], operations[1], operations[2], currentX);
for (int i = 3; i < operations.Length; i += 2)
float newValue = OperateValues(prevValue.ToString(), operations[i], operations[i + 1], (float)currentX);
return (int)Math.Round(prevValue);
public static float OperateValues(string a, string operation, string b, float currentX)
return(Multiply(a, b, currentX));
else if (operation == "/")
return(Divide(a, b, currentX));
else if (operation == "+")
return(Add(a, b, currentX));
return(Subtract(a, b, currentX));
public static float Multiply(string a, string b, float currentX)
public static float Divide(string a, string b, float currentX)
public static float Add(string a, string b, float currentX)
public static float Subtract(string a, string b, float currentX)