stack-level

Ruby stack level too deep exception NOT from recursive infinite loop

限于喜欢 提交于 2019-12-23 08:00:12
问题 EDIT : (SOLVED) actually it probably was raised BECAUSE OF an infinite loop I was coding and after adding a method I got this : user_name@the_computer:/media/ECC3-C3B0/Prog/mts/src/mts$ rake test --trace ** Invoke test (first_time) ** Execute test /home/user_name/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: stack level too deep (SystemStackError) rake aborted! Command failed with status (1): [/home/user_name/.rvm/rubies/ruby-1.9.3-p19...] /home/user_name

Stack level too deep in Ruby trying to draw a random card

故事扮演 提交于 2019-12-04 05:05:34
问题 I'm getting an error "stack level too deep" running the code below. If the random card picked is not there it picks another random card. I suppose I should chance the code somehow, but I'm not sure how. Any suggestions? def hit choice_of_card = rand($deck.length); #choose a random card out of the deck drawn_card = $deck[choice_of_card]; #draw that random card from the deck if drawn_card != 0 #if there is a card there $deck[choice_of_card] = 0; #remove that card from the deck by making the

Stack level too deep in Ruby trying to draw a random card

妖精的绣舞 提交于 2019-12-02 05:38:44
I'm getting an error "stack level too deep" running the code below. If the random card picked is not there it picks another random card. I suppose I should chance the code somehow, but I'm not sure how. Any suggestions? def hit choice_of_card = rand($deck.length); #choose a random card out of the deck drawn_card = $deck[choice_of_card]; #draw that random card from the deck if drawn_card != 0 #if there is a card there $deck[choice_of_card] = 0; #remove that card from the deck by making the space blank if drawn_card == 11 #if you draw an ace self.ace_count += 1; end self.hand_value += drawn_card