我花了很多荒谬的时间试图弄清楚为什么这是挂起的。我假设它与我||
为if
语句格式化的方式有关:
rods = {
:rod1 => [3,2,1],
:rod2 => [],
:rod3 => []
}
init_rod = gets.chomp.to_sym
if ((init_rod != :rod1 || init_rod != :rod2) || init_rod != :rod3)
print "Type in \"rod1\", \"rod2\", or \"rod3\": "
elsif rods[init_rod].empty?
print "Rod has no discs. Select another rod other than #{init_rod}: "
else
disc = rods[init_rod].pop
end