✅ Rocket Launch Console game

Hi, I am working on a mac laptop and only just starting out on C#, Took some courses and one of our homework assignments is making this Apollo Rocket Launch app. And at first vsc says it's proper code, but after waiting after 30 seconds it becomes a bombardment of red squiglies. I can provide screenshots if need be but I am just curious of what is the cause of it. I am not getting any proper results from googling, which I also guess is a bit of skill issue. pls halp. How do I shot web?
22 Replies
🥚FooYoungDevelopment
I managed to write the following code
static void Main(string[] args)
{
// Initial values
double h = 50, v = 8, mF = 35;

// Preparation
bool malfunction = false;

// Repeating individual landing steps
while (h >= 0)
{
// Displaying current values
string height = "Height: " + h.ToString("N1");
string velocity = "Velocity: " + v.ToString("N1");
string fuel = "Fuel: " + mF.ToString("N1");
Console.WriteLine(height + " " + velocity + " " + fuel);

// Input
Console.Write("Enter percentage of breaking (0-100): ");
string input = Console.ReadLine();
double percents = 0;
try
{
percents = Convert.ToDouble(input);
if (percents < 0 || percents > 100)
{
malfunction = true;
}
}
catch (Exception)
{
malfunction = true;
}

if (malfunction)
{
percents = 0;
Console.WriteLine("CONTROL MALFUNCTION!");
}

// Fuel check
if (mF <= 0)
{
percents = 0;
Console.WriteLine("NO FUEL!");
}
// Calculating new values
double F = 360 * percents;
double a = 1.62 - F / 8000;
h -= v + a / 2;
v += a;
mF -= F / 3000;
if (mF <= 0)
{
mF = 0; }
// Output of an empty line
Console.WriteLine();
}

// End of a single landing step
// Output
Console.WriteLine("Landing velocity: " + v.ToString("N1"));

string evaluation = v < 4 ?
"Soft landing, congratulations!" :
(v <= 8 ? "Hard landing." : "Houston, crew is lost...");

Console.WriteLine(evaluation);
// Waiting for Enter
Console.ReadLine();
}
static void Main(string[] args)
{
// Initial values
double h = 50, v = 8, mF = 35;

// Preparation
bool malfunction = false;

// Repeating individual landing steps
while (h >= 0)
{
// Displaying current values
string height = "Height: " + h.ToString("N1");
string velocity = "Velocity: " + v.ToString("N1");
string fuel = "Fuel: " + mF.ToString("N1");
Console.WriteLine(height + " " + velocity + " " + fuel);

// Input
Console.Write("Enter percentage of breaking (0-100): ");
string input = Console.ReadLine();
double percents = 0;
try
{
percents = Convert.ToDouble(input);
if (percents < 0 || percents > 100)
{
malfunction = true;
}
}
catch (Exception)
{
malfunction = true;
}

if (malfunction)
{
percents = 0;
Console.WriteLine("CONTROL MALFUNCTION!");
}

// Fuel check
if (mF <= 0)
{
percents = 0;
Console.WriteLine("NO FUEL!");
}
// Calculating new values
double F = 360 * percents;
double a = 1.62 - F / 8000;
h -= v + a / 2;
v += a;
mF -= F / 3000;
if (mF <= 0)
{
mF = 0; }
// Output of an empty line
Console.WriteLine();
}

// End of a single landing step
// Output
Console.WriteLine("Landing velocity: " + v.ToString("N1"));

string evaluation = v < 4 ?
"Soft landing, congratulations!" :
(v <= 8 ? "Hard landing." : "Houston, crew is lost...");

Console.WriteLine(evaluation);
// Waiting for Enter
Console.ReadLine();
}
🥚FooYoungDevelopment
this is the squigly mess
No description
🥚FooYoungDevelopment
litterally 1:1 the same code.
Pobiega
Pobiega9mo ago
What VSC extensions are you using for C#?
🥚FooYoungDevelopment
these doohickeys.
No description
Pobiega
Pobiega9mo ago
Hm, no devkit?
🥚FooYoungDevelopment
I guess not, no
Pobiega
Pobiega9mo ago
Pobiega
Pobiega9mo ago
this is the microsoft recommended extension the other one is iirc deprecated https://code.visualstudio.com/docs/csharp/get-started
🥚FooYoungDevelopment
In my previous 20 assignments it wasn't required. installing it right now. Thanks for the quick response.
Pobiega
Pobiega9mo ago
its certainly not required but its the recommended way to do C# development in VSC, and afaik currently the only maintained one too the previous extension used something called omnisharp that was notorious for showing incorrect error markers
🥚FooYoungDevelopment
this means I need a newer VSC right?
No description
Pobiega
Pobiega9mo ago
thats... what thats an ancient version like, over a year or more old
Pobiega
Pobiega9mo ago
current is 1.83
🥚FooYoungDevelopment
On it!
🥚FooYoungDevelopment
RedsSquiglyMess = Solved. 2 follow up questions, I never bothered with installing a new VSC, but, am I supposed to do this manually every month or is it possible to do this internally from VSC?
No description
Pobiega
Pobiega9mo ago
No description
🥚FooYoungDevelopment
Best Rabbit Ever!
Pobiega
Pobiega9mo ago
very much doable from inside. Not sure how mac handles it, but I'd be suprised if it doesnt work
🥚FooYoungDevelopment
Thanks for your support, You can mark this case as closed, and I hope to see more of you in the future!
Pobiega
Pobiega9mo ago
do it yourself 🙂 /close