Решение на Шеста задача от Пламена Петрова
Обратно към всички решения
Към профила на Пламена Петрова
Резултати
- 0 точки от тестове
- 0 бонус точки
- 0 точки общо
- 0 успешни тест(а)
- 14 неуспешни тест(а)
Код
Лог от изпълнението
FFFFFFFFF333
333
333
Fttt
ttt
ttt
F<!DOCTYPE html>
<html>
<head>
<title>Turtle graphics</title>
<style>
table {
border-spacing: 0;
}
tr {
padding: 0;
}
td {
width: 5px;
height: 5px;
background-color: black;
padding: 0;
}
</style>
</head>
<body>
<table>
["<tr>\n[\"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\"]</tr>\n"] </table>
</body>
</html>F<!DOCTYPE html>
<html>
<head>
<title>Turtle graphics</title>
<style>
table {
border-spacing: 0;
}
tr {
padding: 0;
}
td {
width: 3px;
height: 3px;
background-color: black;
padding: 0;
}
</style>
</head>
<body>
<table>
["<tr>\n[\"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:0.0></td>\\\"\\n\"]</tr>\n"] </table>
</body>
</html>F<!DOCTYPE html>
<html>
<head>
<title>Turtle graphics</title>
<style>
table {
border-spacing: 0;
}
tr {
padding: 0;
}
td {
width: 5px;
height: 5px;
background-color: black;
padding: 0;
}
</style>
</head>
<body>
<table>
["<tr>\n[\"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\"]</tr>\n", "<tr>\n[\"<td style=\\\"opacity:0.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\", \"<td style=\\\"opacity:1.0></td>\\\"\\n\"]</tr>\n"] </table>
</body>
</html>F
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, 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]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/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 #move marks where the turtle has moved
Failure/Error: expect(canvas).to eq [[1, 1], [0, 0]]
expected: [[1, 1], [0, 0]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/spec.rb:11: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 #move moves the turtle to the start of row or column when we are at its end
Failure/Error: expect(canvas[0]).to eq [2, 2]
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20151203-5272-13vgu3x/spec.rb:19: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 Turtle #draw #move keeps the orientation when we get out of column
Failure/Error: expect(canvas[0][0]).to be > 0
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20151203-5272-13vgu3x/spec.rb:39: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)>'
5) TurtleGraphics Turtle #draw #move counts the times we have passed through every cell
Failure/Error: expect(canvas).to eq [[2, 1], [0, 0]]
expected: [[2, 1], [0, 0]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/spec.rb:50: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)>'
6) TurtleGraphics Turtle #draw #turn_right turns the orienation of the turtle right of where we stand
Failure/Error: expect(canvas).to eq [[1, 0], [1, 0]]
expected: [[1, 0], [1, 0]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/spec.rb:61: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)>'
7) TurtleGraphics Turtle #draw #turn_left turns the orienation of the turtle left of where we stand
Failure/Error: expect(canvas).to eq [[1, 0], [1, 0]]
expected: [[1, 0], [1, 0]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/spec.rb:79: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)>'
8) 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: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/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)>'
9) TurtleGraphics Turtle #draw #look turns the turtle based on where it should look
Failure/Error: expect(canvas).to eq [[1, 0], [1, 0]]
expected: [[1, 0], [1, 0]]
got: nil
(compared using ==)
# /tmp/d20151203-5272-13vgu3x/spec.rb:105: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)>'
10) TurtleGraphics Canvas::ASCII renders the proper symbols depending on the intensity
Failure/Error: expect(ascii.sub(/\n\z/, '')).to eq [
NoMethodError:
undefined method `sub' for [[1, 1, 1], [0, 1, 1], [0, 1, 1]]:Array
# /tmp/d20151203-5272-13vgu3x/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)>'
11) TurtleGraphics Canvas::ASCII can render with a different number of symbols
Failure/Error: expect(ascii.sub(/\n\z/, '')).to eq [
NoMethodError:
undefined method `sub' for [[1, 1, 1], [0, 1, 1], [0, 1, 1]]:Array
# /tmp/d20151203-5272-13vgu3x/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)>'
12) TurtleGraphics Canvas::HTML renders the proper template
Failure/Error: expect(canvas.gsub(/\s+/, '')).to eq <<-HTML.gsub(/\s+/, '')
NoMethodError:
undefined method `gsub' for nil:NilClass
# /tmp/d20151203-5272-13vgu3x/spec.rb:171: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)>'
13) TurtleGraphics Canvas::HTML sets the pixel size of the table
Failure/Error: expect(canvas.gsub(/\s+/, '')).to include <<-HTML.gsub(/\s+/, '')
NoMethodError:
undefined method `gsub' for nil:NilClass
# /tmp/d20151203-5272-13vgu3x/spec.rb:220: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)>'
14) TurtleGraphics Canvas::HTML changes the opacity of a cell based on the times we have passed
Failure/Error: expect(canvas.gsub(/\s+/, '')).to include <<-HTML.gsub(/\s+/, '')
NoMethodError:
undefined method `gsub' for nil:NilClass
# /tmp/d20151203-5272-13vgu3x/spec.rb:242: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.01019 seconds
14 examples, 14 failures
Failed examples:
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:264 # TurtleGraphics renders a complex shape
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:9 # TurtleGraphics Turtle #draw #move marks where the turtle has moved
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:14 # TurtleGraphics Turtle #draw #move moves the turtle to the start of row or column when we are at its end
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:33 # TurtleGraphics Turtle #draw #move keeps the orientation when we get out of column
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:45 # TurtleGraphics Turtle #draw #move counts the times we have passed through every cell
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:55 # TurtleGraphics Turtle #draw #turn_right turns the orienation of the turtle right of where we stand
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:73 # TurtleGraphics Turtle #draw #turn_left turns the orienation of the turtle left of where we stand
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:91 # TurtleGraphics Turtle #draw #spawn_at moves the turtle to an exact location in the start
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:98 # TurtleGraphics Turtle #draw #look turns the turtle based on where it should look
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:112 # TurtleGraphics Canvas::ASCII renders the proper symbols depending on the intensity
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:135 # TurtleGraphics Canvas::ASCII can render with a different number of symbols
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:165 # TurtleGraphics Canvas::HTML renders the proper template
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:218 # TurtleGraphics Canvas::HTML sets the pixel size of the table
rspec /tmp/d20151203-5272-13vgu3x/spec.rb:227 # TurtleGraphics Canvas::HTML changes the opacity of a cell based on the times we have passed
История (2 версии и 0 коментара)
Пламена обнови решението на 02.12.2015 17:22 (преди около 9 години)
Пламена обнови решението на 02.12.2015 17:25 (преди около 9 години)