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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions 2018/SaliankoRuslan/1/pascal_tree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def pascal(n, number)
Copy link
Contributor

Choose a reason for hiding this comment

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

я уверен, что n можно как-то обозвать более читаемо.

line = [number]

Choose a reason for hiding this comment

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

Use 2 (not 1) spaces for indentation.
Tab detected.

for k in 0...n

Choose a reason for hiding this comment

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

Tab detected.
Prefer each over for.

line.push (line[k].to_i * (n - k) / (k + 1))

Choose a reason for hiding this comment

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

Tab detected.
Use 2 (not 1) spaces for indentation.
(...) interpreted as grouped expression.

end

Choose a reason for hiding this comment

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

Tab detected.
Trailing whitespace detected.

line

Choose a reason for hiding this comment

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

Tab detected.

end

def format_pascal(n, number)

Choose a reason for hiding this comment

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

Use empty lines between method definitions.

col = `/usr/bin/tput cols`.chomp.to_i

Choose a reason for hiding this comment

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

Use 2 (not 1) spaces for indentation.
Tab detected.
Trailing whitespace detected.

pascal(n, number).to_s.center(col)

Choose a reason for hiding this comment

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

Tab detected.

end

print 'Введите глубину дерева: '
n = gets.chomp.to_i
print 'Введите базовый номер: '
number = gets.chomp.to_i
for i in 0...n

Choose a reason for hiding this comment

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

Prefer each over for.

Choose a reason for hiding this comment

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

Prefer each over for.

Choose a reason for hiding this comment

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

Prefer each over for.

puts "#{i}: #{format_pascal(i, number)}"

Choose a reason for hiding this comment

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

Use 2 (not 1) spaces for indentation.
Tab detected.

Choose a reason for hiding this comment

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

Use 2 (not 1) spaces for indentation.
Tab detected.

end

Choose a reason for hiding this comment

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

Trailing whitespace detected.
2 trailing blank lines detected.

Choose a reason for hiding this comment

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

Trailing whitespace detected.

Choose a reason for hiding this comment

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

Trailing whitespace detected.