Димитър обнови решението на 14.10.2015 10:18 (преди около 10 години)
+x = [1..-1]
+y = [*[]]
Към профила на Димитър Димитров
FFFFFFFFFFFFFFFFFFFF
Failures:
1) #move moves snake up/right/left/down
Failure/Error: expect(move(snake, [0, 1])).to eq([[2, 3], [2, 4], [2, 5], [2, 6]])
NoMethodError:
undefined method `move' for #<RSpec::Core::ExampleGroup::Nested_1:0x007febc3a7c5e0>
# /tmp/d20151026-15631-jalnpf/spec.rb:5:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) #move moves one-position-sized snake
Failure/Error: expect(move([[2, 2]], [-1, 0])).to eq([[1, 2]])
NoMethodError:
undefined method `move' for #<RSpec::Core::ExampleGroup::Nested_1:0x007febc3a4d600>
# /tmp/d20151026-15631-jalnpf/spec.rb:12:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) #move does not mutate the given arguments
Failure/Error: expect { move(snake, direction) }.not_to change { snake }
NoMethodError:
undefined method `move' for #<RSpec::Core::ExampleGroup::Nested_1:0x007febc3a3acf8>
# /tmp/d20151026-15631-jalnpf/spec.rb:17:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:17:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) #grow grows snake up/right/left/down
Failure/Error: expect(grow(snake, [0, 1])).to eq([[2, 2], [2, 3], [2, 4], [2, 5], [2, 6]])
NoMethodError:
undefined method `grow' for #<RSpec::Core::ExampleGroup::Nested_2:0x007febc3a1ebc0>
# /tmp/d20151026-15631-jalnpf/spec.rb:26:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) #grow grows one-position-sized snake
Failure/Error: expect(grow([[2, 2]], [-1, 0])).to eq([[2, 2], [1, 2]])
NoMethodError:
undefined method `grow' for #<RSpec::Core::ExampleGroup::Nested_2:0x007febc3a1a318>
# /tmp/d20151026-15631-jalnpf/spec.rb:33:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) #grow does not mutate the given arguments
Failure/Error: expect { grow(snake, direction) }.not_to change { snake }
NoMethodError:
undefined method `grow' for #<RSpec::Core::ExampleGroup::Nested_2:0x007febc3a12e38>
# /tmp/d20151026-15631-jalnpf/spec.rb:38:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:38:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
7) #new_food generates food on empty position
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc3a09630>
# /tmp/d20151026-15631-jalnpf/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:53:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
8) #new_food does not generate food outside of borders (width)
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc3a06598>
# /tmp/d20151026-15631-jalnpf/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:57:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
9) #new_food does not generate food outside of borders (height)
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc3a04400>
# /tmp/d20151026-15631-jalnpf/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:61:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
10) #new_food does not generate food on position where the snake is
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc39ed4f8>
# /tmp/d20151026-15631-jalnpf/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:65:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
11) #new_food does not generate food on position where food is already present
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc39e8ca0>
# /tmp/d20151026-15631-jalnpf/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:69:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
12) #new_food does not mutate the given arguments
Failure/Error: expect { new_food(food, snake, dimensions) }.not_to change { snake }
NoMethodError:
undefined method `new_food' for #<RSpec::Core::ExampleGroup::Nested_3:0x007febc39e4308>
# /tmp/d20151026-15631-jalnpf/spec.rb:73:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:73:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
13) #obstacle_ahead? returns true if snake body ahead
Failure/Error: obstacle_ahead?([[5, 5], [4, 5], [4, 4], [5, 4]], [0, 1], dimensions)
NoMethodError:
undefined method `obstacle_ahead?' for #<RSpec::Core::ExampleGroup::Nested_4:0x007febc39ccf78>
# /tmp/d20151026-15631-jalnpf/spec.rb:84:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
14) #obstacle_ahead? returns true if wall ahead
Failure/Error: expect(obstacle_ahead?([[8, 8], [8, 9]], [0, 1], dimensions)).to eq true
NoMethodError:
undefined method `obstacle_ahead?' for #<RSpec::Core::ExampleGroup::Nested_4:0x007febc39ca4d0>
# /tmp/d20151026-15631-jalnpf/spec.rb:89:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
15) #obstacle_ahead? returns false if no obstacle ahead
Failure/Error: expect(obstacle_ahead?([[3, 4], [3, 5]], [0, 1], dimensions)).to eq false
NoMethodError:
undefined method `obstacle_ahead?' for #<RSpec::Core::ExampleGroup::Nested_4:0x007febc39c8040>
# /tmp/d20151026-15631-jalnpf/spec.rb:93:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
16) #obstacle_ahead? does not mutate the given arguments
Failure/Error: expect { obstacle_ahead?(snake, direction, dimensions) }.not_to change { snake }
NoMethodError:
undefined method `obstacle_ahead?' for #<RSpec::Core::ExampleGroup::Nested_4:0x007febc39c50e8>
# /tmp/d20151026-15631-jalnpf/spec.rb:99:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:99:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
17) #danger? returns true if obstacle in one turn
Failure/Error: expect(danger?([[7, 6], [8, 6], [9, 6]], [1, 0], dimensions)).to eq true
NoMethodError:
undefined method `danger?' for #<RSpec::Core::ExampleGroup::Nested_5:0x007febc39c2230>
# /tmp/d20151026-15631-jalnpf/spec.rb:109:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
18) #danger? returns true if obstacle in two turns
Failure/Error: expect(danger?([[6, 6], [7, 6], [8, 6]], [1, 0], dimensions)).to eq true
NoMethodError:
undefined method `danger?' for #<RSpec::Core::ExampleGroup::Nested_5:0x007febc39bb458>
# /tmp/d20151026-15631-jalnpf/spec.rb:113:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
19) #danger? returns false if obstacle in three turns
Failure/Error: expect(danger?([[5, 6], [6, 6], [7, 6]], [1, 0], dimensions)).to eq false
NoMethodError:
undefined method `danger?' for #<RSpec::Core::ExampleGroup::Nested_5:0x007febc39b87f8>
# /tmp/d20151026-15631-jalnpf/spec.rb:117:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
20) #danger? does not mutate the given arguments
Failure/Error: expect { danger?(snake, direction, dimensions) }.not_to change { snake }
NoMethodError:
undefined method `danger?' for #<RSpec::Core::ExampleGroup::Nested_5:0x007febc39ae6e0>
# /tmp/d20151026-15631-jalnpf/spec.rb:123:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-jalnpf/spec.rb:123:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.00984 seconds
20 examples, 20 failures
Failed examples:
rspec /tmp/d20151026-15631-jalnpf/spec.rb:4 # #move moves snake up/right/left/down
rspec /tmp/d20151026-15631-jalnpf/spec.rb:11 # #move moves one-position-sized snake
rspec /tmp/d20151026-15631-jalnpf/spec.rb:15 # #move does not mutate the given arguments
rspec /tmp/d20151026-15631-jalnpf/spec.rb:25 # #grow grows snake up/right/left/down
rspec /tmp/d20151026-15631-jalnpf/spec.rb:32 # #grow grows one-position-sized snake
rspec /tmp/d20151026-15631-jalnpf/spec.rb:36 # #grow does not mutate the given arguments
rspec /tmp/d20151026-15631-jalnpf/spec.rb:49 # #new_food generates food on empty position
rspec /tmp/d20151026-15631-jalnpf/spec.rb:56 # #new_food does not generate food outside of borders (width)
rspec /tmp/d20151026-15631-jalnpf/spec.rb:60 # #new_food does not generate food outside of borders (height)
rspec /tmp/d20151026-15631-jalnpf/spec.rb:64 # #new_food does not generate food on position where the snake is
rspec /tmp/d20151026-15631-jalnpf/spec.rb:68 # #new_food does not generate food on position where food is already present
rspec /tmp/d20151026-15631-jalnpf/spec.rb:72 # #new_food does not mutate the given arguments
rspec /tmp/d20151026-15631-jalnpf/spec.rb:82 # #obstacle_ahead? returns true if snake body ahead
rspec /tmp/d20151026-15631-jalnpf/spec.rb:88 # #obstacle_ahead? returns true if wall ahead
rspec /tmp/d20151026-15631-jalnpf/spec.rb:92 # #obstacle_ahead? returns false if no obstacle ahead
rspec /tmp/d20151026-15631-jalnpf/spec.rb:96 # #obstacle_ahead? does not mutate the given arguments
rspec /tmp/d20151026-15631-jalnpf/spec.rb:108 # #danger? returns true if obstacle in one turn
rspec /tmp/d20151026-15631-jalnpf/spec.rb:112 # #danger? returns true if obstacle in two turns
rspec /tmp/d20151026-15631-jalnpf/spec.rb:116 # #danger? returns false if obstacle in three turns
rspec /tmp/d20151026-15631-jalnpf/spec.rb:120 # #danger? does not mutate the given arguments