#Welcome to hangman

#User1 inpts word

#word clears cls

#user2 begins guessing letters = done

#user2 gets 6 tries = done

#computer tells what letters are guessed

#user 2 wins or loses

#Add a hyphen( - ) to every word = done

#Make word appear after the game is done

#prepopulated lists, after guess 1, take out dashes at the bottom

##Where the game begins

#Number of incorrectGuesses = +1

incorrectGuesses=0

begin

puts ""

puts "Welcome to Hangman, Win or lose your life!"

puts ""

puts "Choose between Local Multiplayer or AI(Against PC)"

puts ""

user1=gets.chomp.downcase

puts "Choose Category: Movies, Books, or Shows"

user1Category=gets.chomp

puts ""

puts "User 1, Please enter your desired word"

user1=gets.chomp.downcase

system = "cls"

secretWord = user1

categoryArray=["movies", "books", "shows"]

blank="-"*secretWord.length

correctGuess=blank.chars.to_a

puts correctGuess

sleep(0)

system "clear"

puts "The category is: #{user1Category}"

begin

puts "User 2, Please enter your guess"

puts "_ "*secretWord.length

user2= gets.chomp.downcase

system "clear"

i= 0

# Puts Incorrect guesses and correct guesses on the same line! NEED TO ADD!

if "#{secretWord}".include? "#{user2}"

puts "Correct!"

puts ""

secretWord.each_char do |letter|

if letter== user2

correctGuess[i]= letter

print correctGuess.join("")

puts ""

end

i = i + 1

end

puts "_ "*secretWord.length

puts "Incorrect!"

puts ""

incorrectGuesses=incorrectGuesses+1

end

puts "incorrectGuesses #{incorrectGuesses}"

#Ignore this for now!

if incorrectGuesses>=6

puts ""

puts "---+---+- "

puts "| |"

puts "| 0"

puts "| |\\"

puts "| /\\"

puts "-+----------"

puts "the Secret Word is '#{secretWord}'"

puts ""

end

if secretWord==correctGuess.join("")

puts ""

puts " (@)"

puts " ^\\|"

puts " |/^"

puts "____|_____"

puts ""

puts "You Win!!"

puts ""

end

end while secretWord!=correctGuess.join("")