Решение на Шеста задача от Кристъфър Коруев
Обратно към всички решения
Към профила на Кристъфър Коруев
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 6 успешни тест(а)
- 8 неуспешни тест(а)
Код
Лог от изпълнението
F......FF[[3, 2, 0], [1, 1, 0], [0, 0, 0]]
0.4
0.3
0.0
0.1
0.1
0.0
0.0
0.0
0.0
F[[3, 2, 0], [1, 1, 0], [0, 0, 0]]
0.4
0.3
0.0
0.1
0.1
0.0
0.0
0.0
0.0
FFFF
Failures:
1) TurtleGraphics renders a complex shape
Failure/Error: expect(canvas).to eq [
expected: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 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 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
(compared using ==)
# /tmp/d20151203-5272-1tgbu2/spec.rb:284: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) TurtleGraphics Turtle #draw #spawn_at moves the turtle to an exact location in the start
Failure/Error: expect(canvas).to eq [[0, 0], [1, 0]]
expected: [[0, 0], [1, 0]]
got: [[1, 0], [0, 0]]
(compared using ==)
# /tmp/d20151203-5272-1tgbu2/spec.rb:93:in `block (5 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) TurtleGraphics Turtle #draw #look turns the turtle based on where it should look
Failure/Error: look :down
NoMethodError:
undefined method `position' for :turtlePosition:Symbol
# /tmp/d20151203-5272-1tgbu2/solution.rb:41:in `look'
# /tmp/d20151203-5272-1tgbu2/spec.rb:101:in `block (6 levels) in <top (required)>'
# /tmp/d20151203-5272-1tgbu2/solution.rb:16:in `instance_eval'
# /tmp/d20151203-5272-1tgbu2/solution.rb:16:in `draw'
# /tmp/d20151203-5272-1tgbu2/spec.rb:4:in `create_canvas'
# /tmp/d20151203-5272-1tgbu2/spec.rb:99:in `block (5 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) TurtleGraphics Canvas::ASCII renders the proper symbols depending on the intensity
Failure/Error: expect(ascii.sub(/\n\z/, '')).to eq [
expected: "320\n110\n000"
got: "100\n110\n000"
(compared using ==)
Diff:
@@ -1,4 +1,4 @@
-320
+100
110
000
# /tmp/d20151203-5272-1tgbu2/spec.rb:128:in `block (3 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) TurtleGraphics Canvas::ASCII can render with a different number of symbols
Failure/Error: expect(ascii.sub(/\n\z/, '')).to eq [
expected: "ttz\nooz\nzzz"
got: "ozz\nooz\nzzz"
(compared using ==)
Diff:
@@ -1,4 +1,4 @@
-ttz
+ozz
ooz
zzz
# /tmp/d20151203-5272-1tgbu2/spec.rb:151:in `block (3 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) TurtleGraphics Canvas::HTML renders the proper template
Failure/Error: html_canvas = TurtleGraphics::Canvas::HTML.new(pixel_size)
NameError:
uninitialized constant TurtleGraphics::Canvas::HTML
# /tmp/d20151203-5272-1tgbu2/spec.rb:161:in `create_html_canvas'
# /tmp/d20151203-5272-1tgbu2/spec.rb:166:in `block (3 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) TurtleGraphics Canvas::HTML sets the pixel size of the table
Failure/Error: html_canvas = TurtleGraphics::Canvas::HTML.new(pixel_size)
NameError:
uninitialized constant TurtleGraphics::Canvas::HTML
# /tmp/d20151203-5272-1tgbu2/spec.rb:161:in `create_html_canvas'
# /tmp/d20151203-5272-1tgbu2/spec.rb:219:in `block (3 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) TurtleGraphics Canvas::HTML changes the opacity of a cell based on the times we have passed
Failure/Error: html_canvas = TurtleGraphics::Canvas::HTML.new(pixel_size)
NameError:
uninitialized constant TurtleGraphics::Canvas::HTML
# /tmp/d20151203-5272-1tgbu2/spec.rb:161:in `create_html_canvas'
# /tmp/d20151203-5272-1tgbu2/spec.rb:228:in `block (3 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.01549 seconds
14 examples, 8 failures
Failed examples:
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:264 # TurtleGraphics renders a complex shape
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:91 # TurtleGraphics Turtle #draw #spawn_at moves the turtle to an exact location in the start
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:98 # TurtleGraphics Turtle #draw #look turns the turtle based on where it should look
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:112 # TurtleGraphics Canvas::ASCII renders the proper symbols depending on the intensity
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:135 # TurtleGraphics Canvas::ASCII can render with a different number of symbols
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:165 # TurtleGraphics Canvas::HTML renders the proper template
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:218 # TurtleGraphics Canvas::HTML sets the pixel size of the table
rspec /tmp/d20151203-5272-1tgbu2/spec.rb:227 # TurtleGraphics Canvas::HTML changes the opacity of a cell based on the times we have passed
История (1 версия и 0 коментара)
Кристъфър обнови решението на 02.12.2015 16:52 (преди около 9 години)