i just began learning ruby. now im trying to code a little script which plays the montyhall problem i got a problem with the last line of the code
numgames = 10000 # Number of games to play
switch = true # Switch your guess?
wins = 0
numgames.times do doors = [0, 0, 0] # Three doors!
doors[rand(3)] = 1 # One of them has a car!
guess = doors.delete_at(rand(3)) # We pick one of them!
doors.delete_at(doors[0] == 0 ? 0 : 1) # Take out one of the remaining doors that is not a car!
wins += switch ? doors[0] : guess end
puts "You decided #{switch ? "" : "not "}to switch, and your win % is #{wins.times ()/numgames}"