Skip to content

implement hw 1#773

Open
KuikoIhar wants to merge 10 commits intorubyroidlabs:masterfrom
KuikoIhar:homework-1
Open

implement hw 1#773
KuikoIhar wants to merge 10 commits intorubyroidlabs:masterfrom
KuikoIhar:homework-1

Conversation

@KuikoIhar
Copy link
Copy Markdown

Фамилия Имя

Куйко Игорь

Email

coooll81@tut.by

Номер домашнего задания

1

Ссылка на видео с демо работы

https://youtu.be/E1GFcHwCDhI

Комментарии

с 3 уровнем ещё разбираюсь

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
puts "Введите базовый номер: "
n = gets.chomp.to_i
puts center lines pas_tri(h, n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 trailing blank lines detected.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated

puts "Введите глубину дерева: "
h = gets.chomp.to_i
puts "Введите базовый номер: "
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
end


puts "Введите глубину дерева: "
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
l.map{|s| pad(s, n)}
end


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated

def center (l)
n = l[-1].size
l.map{|s| pad(s, n)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.
Space between { and | missing.
Space missing inside }.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated

def pad (s, n)
l = n - s.size
' '*(l/2) + s + ' '*(l-l/2)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing for operator *.
Surrounding space missing for operator /.
Surrounding space missing for operator -.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
end
end

def pad (s, n)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not put a space between a method name and the opening parenthesis.

Comment thread 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]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.
Space between { and | missing.
Surrounding space missing for operator +.
Space missing inside }.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
@@ -0,0 +1,33 @@
#!/usr/bin/env ruby

def pas_tri (h, n)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not put a space between a method name and the opening parenthesis.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated
@@ -0,0 +1,33 @@
#!/usr/bin/env ruby
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script file pas_tri.rb doesn't have execute permission.

Comment thread 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(' ')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block argument expression is not on the same line as the block start.

Comment thread 2018/KuikoIhar/1/pas_tri.rb Outdated

def lines(rows)
n = rows[-1].max.to_s.size
rows.map do
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

Copy link
Copy Markdown
Contributor

@Xanderwot Xanderwot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

избегай однобуквенных переменных. читать код очень сложно

Copy link
Copy Markdown
Contributor

@Xanderwot Xanderwot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я вам постоянно говорю про читаемость переменных. Исправь пожалуйста, прям очень сложно читать такой код.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants