Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement hw 1 #773

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

implement hw 1 #773

wants to merge 10 commits into from

Conversation

KuikoIhar
Copy link

Фамилия Имя

Куйко Игорь

Email

[email protected]

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

1

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

https://youtu.be/E1GFcHwCDhI

Комментарии

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

puts "Введите базовый номер: "
n = gets.chomp.to_i
puts center lines pas_tri(h, n)

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.


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

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.

end


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

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.

l.map{|s| pad(s, n)}
end


Choose a reason for hiding this comment

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

Extra blank line detected.


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

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 }.


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

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 -.

end
end

def pad (s, n)

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.

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]

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 }.

@@ -0,0 +1,33 @@
#!/usr/bin/env ruby

def pas_tri (h, n)

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.

@@ -0,0 +1,33 @@
#!/usr/bin/env ruby

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.

def lines(rows)
n = rows[-1].max.to_s.size
rows.map do
|row| row.map { |x| pad(x.to_s, n) }.join(' ')

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.


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

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
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
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