Spaceman Error

Link to challenge project:

Look at my code:

using System; namespace Spaceman { class Game { public string Codeword {get; private set;} public string CurrentWord { get; private set; } public int MaxGuesses { get; private set; } public int WrongGuesses {get; private set; } public int OptionsForCodeWord {get; private set; } public Ufo ufo { get; private set; } public void Greet() { Console.WriteLine("Hello! Welcome to the Spaceman game."); Console.WriteLine("You have to save yourself from aliens taking you by guessing the letters in the word."); } public Game(string[] codewords) { this.Codeword = codewords[Random.Next(0, codewords.Length)]; this.MaxGuesses = 5; this.WrongGuesses = 0; this.currentWord = null; foreach (string letter in this.Codeword) { this.currentWord += "_"; } } public bool DidWin() => CodeWord == currentWord; public bool DidLose() => WrongGuesses >= MaxGuesses; public void Display() { Console.WriteLine(this.ufo.Stringify()); Console.WriteLine(this.currentWord); Console.WriteLine(this.MaxGuesses - this.WrongGuesses); } public void Ask() { Console.Write("Guess a letter: "); char letter = String.ToCharArrayConsole.ReadLine(); if (letter.Length != 1) { Console.WriteLine("Please enter one letter at a time."); return; } else if (Codeword.Contains(letter)) { Console.WriteLine($"The letter {letter} was in the codeword."); foreach (string letter in this.Codeword) { if (letter == this.currentWord[String.IndexOf(letter)]) { this.currentWord[String.IndexOf(letter)] = letter; } } } else { Console.WriteLine($"The letter {letter} is not in the codeword."); this.WrongGuesses++; this.ufo.AddPart(); } } } }


using System; namespace Spaceman { class Program { static void Main(string[] args) { string[] options = { "apple", "pineapple", "watermelon", "house", "party", "Owlé", "Dinot", "Big Bozz", "Apricot", "Mango", "Durian" }; Game game = new Game(options); game.Greet(); while (game.DidWin() || game.DidLose()) { game.Display(); game.Ask(); if (game.DidWin()) { Console.WriteLine("You won the Spaceman game!!!"); } else if (game.DidLose()) { Console.WriteLine("You lost the Spaceman game."); } } } } }

This line is causing an error:


Does that error mean that I have to create a variable/reference that holds the codewords.Length variables?

Oh yes, actually I think it means that 'Random.Next is called statically but it is not static. I have to create a instance of random then use it’s name.

There are other errors:
Find them by running my Spaceman files somewhere at CC(Codecademy) or somewhere else.

Can you solve the errors for me? Tell me how to fix them.

Why don’t you tell us the errors? We are not paid to find errors in your code.

That would seem logical.