mercredi 21 octobre 2020

Among us crewmate and imposter generator not working

What I am trying to do is have a random generator generate 9 cremates and 1 impostor but what happens when it generates them is one of the cremates isn't generated and its just a blank space in between the other string values when I display the values on cmd so idk why it doesn't but I feel it may be to do with the player so there is 10 crews and 1 impostor.

impgen = rand (1..10)
deadgen = rand (1..9)
if impgen == 2
  impot = 'Red'
elsif impgen == 3 
  impot = 'Orange'
elsif impgen == 4 
  impot = 'Yellow'
elsif impgen == 5
  impot = 'Green'
end
if impgen == 6
  impot = 'Dark Green'
elsif impgen == 7
  impot = 'Blue'
elsif impgen == 8
  impot = 'Purple'
elsif impgen == 9
  impot = 'Black'
elsif impgen == 10
  impot = 'Cyan'
end
if impgen != 2
  crew1 = 'Red'
if impgen != 3
  crew2 = 'Orange'
end
if impgen != 4
  crew3 = 'Yellow'
if impgen != 5
  crew4 = 'Green'
end
if impgen != 6
  crew5 = 'Dark Green'
if impgen != 7 
  crew6 = 'Blue'
end
if impgen != 8
  crew7 = 'Purple'
if impgen != 9
  crew8 = 'Black'
end
if impgen != 10
  crew9 = 'Cyan'
end
end
end
end
end
puts "Enter Name"
un = gets.chomp
puts "Ok " + un + " let's play Among Us"
sleep (1)
if impgen == 1
  puts "You are an imposter!"
else impgen
  puts "You are a crewmate there is 1 imposter among us!"
  sleep (1.5)
  puts "The other players are Red, Orange, Yellow, Green, Dark Green, Blue, Purple, Black, and Cyan you are Lime"
  sleep (4)
  puts impot
  puts crew1
  puts crew2
  puts crew3
  puts crew4
  puts crew5
  puts crew6
  puts crew7
  puts crew8
  puts crew9
end ```



Aucun commentaire:

Enregistrer un commentaire