Spaceman with my own extensions

Hey guys! RIght now I’m wokring on the Spaceman project and I want to add an extension that saves the letters you have guessed. Right now I can only save one letter at a time and it resets every time you guess another letter.

Also I know my code isn’t the best and I tried creating a loop that loops through the ListOfClues array. But I cannot work it out so that the index matches the ListOfCodewords arrays index. So I did a lot of else if statement to make it work. There must be someway to make that code better and not so repeatable, right?

Here is the code I got so far

Game class

using System; using System.Linq; namespace Spaceman { class Game { // Fields private string guessedLetter; private string clue; private string codeword; private string currentWord; private int maximumGuesses; private int numberOfWrongGuesses; private string[] listOfCodewords = { "speechless", "dogperson", "alien", "computer", "programming", "positive", "fullmoon", "mars", "saturn", "interstellar", "queen", "vinterstudion" }; private string[] listOfClues = { "The clue is: When you cannot talk", "The clue is: What you call a person who like dogs", "The clue is: When you are not from planet earth.", "The clue is: This is something you use when browsing the webb", "The clue is: This is how you talk to computers", "The clue is: Someone who is happy", "The clue is: A wolf who became halfman and halfwolf", "The clue is: This is something that doesn't exist on earth and the first word for it's nickname is RED", "The clue is: This thing is round and has circles around it.", "The clue is: When humankind can travel across space.", "This could a lady or some guy singing.", "This is something that goes on TV in Sweden every winter" }; private Ufo u = new Ufo(); // Properties private string GuessedLetter { get { return guessedLetter; } set { guessedLetter = value; } } private string Clue { get { return clue; } set { clue = value; } } private string Codeword { get { return codeword; } set { codeword = value; } } private string CurrentWord { get { return currentWord; } set { currentWord = value; } } private int MaximumGuesses { get { return maximumGuesses; } set { maximumGuesses = value; } } private int NumberOfWrongGuesses { get { return numberOfWrongGuesses; } set { numberOfWrongGuesses = value; } } private string[] ListOfCodewords { get { return listOfCodewords; } set { listOfCodewords = value; } } private string[] ListOfClues { get { return listOfClues; } set { ListOfClues = value; } } // Constructors public Game() { MaximumGuesses = 5; NumberOfWrongGuesses = 0; Random rand = new Random(); Codeword = ListOfCodewords[rand.Next(ListOfCodewords.Length)]; for ( int i = 0; i < Codeword.Length; i++ ) { CurrentWord += "_"; } if ( Codeword == ListOfCodewords[0] ) { Clue = ListOfClues[0]; } else if ( Codeword == ListOfCodewords[1] ) { Clue = ListOfClues[1]; } else if ( Codeword == ListOfCodewords[2] ) { Clue = ListOfClues[2]; } else if ( Codeword == ListOfCodewords[3] ) { Clue = ListOfClues[3]; } else if ( Codeword == ListOfCodewords[4] ) { Clue = ListOfClues[4]; } else if ( Codeword == ListOfCodewords[5] ) { Clue = ListOfClues[5]; } else if ( Codeword == ListOfCodewords[6] ) { Clue = ListOfClues[6]; } else if ( Codeword == ListOfCodewords[7] ) { Clue = ListOfClues[7]; } else if ( Codeword == ListOfCodewords[8] ) { Clue = ListOfClues[8]; } else if ( Codeword == ListOfCodewords[9] ) { Clue = ListOfClues[9]; } else if ( Codeword == ListOfCodewords[10] ) { Clue = ListOfClues[10]; } else if ( Codeword == ListOfCodewords[11] ) { Clue = ListOfClues[11]; } } // Methods public void Greet() { Console.WriteLine("---- Welcome to Spaceman! ----"); } public bool DidWin() { if ( Codeword.Equals(CurrentWord) ) { Console.WriteLine($"Correct! The word was {Codeword}"); Console.WriteLine("You have successfully saved this person and he is very grateful!.\nDo you want to save another? (Answer YES or NO)"); return true; } else { return false; } } public bool DidLose() { if ( NumberOfWrongGuesses >= MaximumGuesses ) { Console.WriteLine("The person have been abducted.. You.. . have. . failed. ..\nDo you want to try again? (Answer YES or NO)"); return true; } else { return false; } } public void Display() { Console.WriteLine($"{u.Stringify()}\nThe word is {CurrentWord}\nYou have {NumberOfWrongGuesses} out of {MaximumGuesses} left"); Console.WriteLine($"Guessed letters: {GuessedLetter}"); if ( NumberOfWrongGuesses >= 3 ) { Console.WriteLine(clue); } } public void Ask() { inputLetter: Console.Write("Guess your letter: "); GuessedLetter = Console.ReadLine(); string inputLower = GuessedLetter.ToLower(); if ( inputLower.Length > 1 ) { Console.WriteLine("You can only guess one letter at a time... Try again."); goto inputLetter; } if ( Codeword.Contains(inputLower) ) { char inputChar = Convert.ToChar(inputLower); for ( int i = 0; i < Codeword.Length; i++ ) { if ( inputChar == Codeword[i] ) { CurrentWord = CurrentWord.Remove(i, 1).Insert(i, inputChar.ToString()); } } } else if ( !Codeword.Contains(inputLower) ) { NumberOfWrongGuesses++; u.AddPart(); } } } }

Program class

using System; namespace Spaceman { class Program { static void Main(string[] args) { saveAnother: Game game = new Game(); game.Greet(); while ( true ) { game.Display(); game.Ask(); if ( game.DidWin() ) { break; } if ( game.DidLose() ) { break; } } yesOrNo: string oneMoreTime = Console.ReadLine(); string oneMoreTimeLower = oneMoreTime.ToLower(); if ( oneMoreTimeLower == "yes" ) { goto saveAnother; } else if ( oneMoreTimeLower == "no" ) { Console.WriteLine("What the ■■■■ are you doing? HELP me for ■■■■ sake!!... . .\nGood bye.."); } else { Console.WriteLine("Type YES or NO you imbecile!"); goto yesOrNo; } } } }