Conversation
2018/KuikoIhar/1/pas_tri.rb
Outdated
| puts "Введите базовый номер: " | ||
| n = gets.chomp.to_i | ||
| puts center lines pas_tri(h, n) | ||
|
|
2018/KuikoIhar/1/pas_tri.rb
Outdated
|
|
||
| puts "Введите глубину дерева: " | ||
| h = gets.chomp.to_i | ||
| puts "Введите базовый номер: " |
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| end | ||
|
|
||
|
|
||
| puts "Введите глубину дерева: " |
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| l.map{|s| pad(s, n)} | ||
| end | ||
|
|
||
|
|
2018/KuikoIhar/1/pas_tri.rb
Outdated
|
|
||
| def center (l) | ||
| n = l[-1].size | ||
| l.map{|s| pad(s, n)} |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Space missing inside }.
2018/KuikoIhar/1/pas_tri.rb
Outdated
|
|
||
| def pad (s, n) | ||
| l = n - s.size | ||
| ' '*(l/2) + s + ' '*(l-l/2) |
There was a problem hiding this comment.
Surrounding space missing for operator *.
Surrounding space missing for operator /.
Surrounding space missing for operator -.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| end | ||
| end | ||
|
|
||
| def pad (s, n) |
There was a problem hiding this comment.
Do not put a space between a method name and the opening parenthesis.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| def pas_tri (h, n) | ||
| l = [n] | ||
| [l] + (1..h).map do | ||
| l = [n] + l[1..-1].map.with_index{|x, i| x+l[i]} + [n] |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Surrounding space missing for operator +.
Space missing inside }.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| @@ -0,0 +1,33 @@ | |||
| #!/usr/bin/env ruby | |||
|
|
|||
| def pas_tri (h, n) | |||
There was a problem hiding this comment.
Do not put a space between a method name and the opening parenthesis.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| @@ -0,0 +1,33 @@ | |||
| #!/usr/bin/env ruby | |||
There was a problem hiding this comment.
Script file pas_tri.rb doesn't have execute permission.
2018/KuikoIhar/1/pas_tri.rb
Outdated
| def lines(rows) | ||
| n = rows[-1].max.to_s.size | ||
| rows.map do | ||
| |row| row.map { |x| pad(x.to_s, n) }.join(' ') |
There was a problem hiding this comment.
Block argument expression is not on the same line as the block start.
2018/KuikoIhar/1/pas_tri.rb
Outdated
|
|
||
| def lines(rows) | ||
| n = rows[-1].max.to_s.size | ||
| rows.map do |
Xanderwot
left a comment
There was a problem hiding this comment.
избегай однобуквенных переменных. читать код очень сложно
Xanderwot
left a comment
There was a problem hiding this comment.
Я вам постоянно говорю про читаемость переменных. Исправь пожалуйста, прям очень сложно читать такой код.
Фамилия Имя
Куйко Игорь
Email
coooll81@tut.by
Номер домашнего задания
1
Ссылка на видео с демо работы
https://youtu.be/E1GFcHwCDhI
Комментарии
с 3 уровнем ещё разбираюсь