Console.WriteLine("Enter the amount of letters in the word: ");
int n = int.Parse(Console.ReadLine());
string[] secretWord = new string[n];
Console.WriteLine("Enter the word (one character at a time) (with lower case): ");
for (int i = 0; i < n; i++){
Console.WriteLine("Enter the " + (i + 1) + " character: ");
secretWord[i] = Console.ReadLine();
bool[] guessedletters = new bool[n];
string[] hangmanDrawing = {
" ____\n | |\n |\n |\n |\n |\n_|_",
" ____\n | |\n | O\n |\n |\n |\n_|_",
" ____\n | |\n | O\n | |\n |\n |\n_|_",
" ____\n | |\n | O\n | /|\n |\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n |\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n | /\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n | / \\\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n | / \\\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n | / \\\n |\n_|_",
" ____\n | |\n | O\n | /|\\\n | / \\\n |\n_|_"
while (attemptsleft > 0){
Console.WriteLine("Attempts left: " + attemptsleft);
Console.WriteLine("current letter: ");
for (int i = 0; i < n; i++){
Console.Write(secretWord[i] + " ");
Console.WriteLine(hangmanDrawing[10 - attemptsleft]);
Console.WriteLine("Guess the word : ");
string guess = Console.ReadLine();
bool isCorrectGuess = false;
for (int i = 0; i < n; i++){
if (secretWord[i] == guess && !guessedletters[i]){
guessedletters[i] = true;
Console.WriteLine("Correct guess!");
bool allLettersGuessed = true;
for (int i = 0; i < n; i++){
allLettersGuessed = false;
Console.WriteLine("Congratulations! You guessed the word: ");
for (int i = 0; i < n; i++ ) {
Console.Write(secretWord[i]);
Console.WriteLine("Incorrect guess!");
Console.WriteLine("You are hanged! The word was: ");
for (int i = 0; i < n; i++ ) {
Console.Write(secretWord[i]);