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

implement hw 1 #772

wants to merge 16 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 21, 2018

Фамилия Имя

Руслан Салянко

Email

[email protected]

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

1

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

https://youtu.be/HEam66d9k5s

Комментарии

Не доделал, что бы красиво выводилась


for i in 0...n
puts "#{i}: #{format_pascal(i,number)}"
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.



for i in 0...n
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.

Space missing after comma.

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.

print "Введите базовый номер: "
number = gets.chomp.to_i


Choose a reason for hiding this comment

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

Extra blank line detected.


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

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.

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

Choose a reason for hiding this comment

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

Trailing whitespace detected.

for k in 0...n
line.push(line[k].to_i * (n-k) / (k+1))
end
return line

Choose a reason for hiding this comment

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

Inconsistent indentation detected.
Redundant return detected.

line = [number]
for k in 0...n
line.push(line[k].to_i * (n-k) / (k+1))
end

Choose a reason for hiding this comment

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

Trailing whitespace detected.

def pascal(n, number)
line = [number]
for k in 0...n
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.

Use 2 (not 4) spaces for indentation.
Surrounding space missing for operator -.
Surrounding space missing for operator +.

@@ -0,0 +1,25 @@
def pascal(n, number)
line = [number]
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.

Prefer each over for.


for i in 0...n
puts "#{i}: #{format_pascal(i, number)}"
end

Choose a reason for hiding this comment

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

Trailing whitespace detected.
Final newline missing.

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.


def format_pascal(n, number)
col = `/usr/bin/tput cols`.chomp.to_i
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.

Space missing after comma.

end

def format_pascal(n, number)
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.

Trailing whitespace detected.

for k in 0...n
line.push (line[k] .to_i * (n - k) / (k + 1))
end
return line

Choose a reason for hiding this comment

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

Redundant return detected.
Trailing whitespace detected.

def pascal(n, number)
line = [number]
for k in 0...n
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.

Use 2 (not 4) spaces for indentation.
(...) interpreted as grouped expression.

Руслан Салянко added 2 commits February 21, 2018 10:53
number = gets.chomp.to_i
for i in 0...n
puts "#{i}: #{format_pascal(i, number)}"
end

Choose a reason for hiding this comment

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

Trailing whitespace detected.

print 'Введите базовый номер: '
number = gets.chomp.to_i
for i in 0...n
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.

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.


def format_pascal(n, number)
col = `/usr/bin/tput cols`.chomp.to_i
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

def format_pascal(n, number)
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.

for k in 0...n
line.push (line[k].to_i * (n - k) / (k + 1))
end
line

Choose a reason for hiding this comment

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

Tab detected.

line = [number]
for k in 0...n
line.push (line[k].to_i * (n - k) / (k + 1))
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.

def pascal(n, number)
line = [number]
for k in 0...n
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.

@@ -0,0 +1,20 @@
def pascal(n, number)
line = [number]
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.

@@ -0,0 +1,20 @@
def pascal(n, number)
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.

Руслан Салянко added 2 commits February 21, 2018 11:10
number = gets.chomp.to_i

for i in 0...n
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.

Руслан Салянко added 2 commits February 21, 2018 11:23
end

def format_pascal(n, number)
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.

Trailing whitespace detected.

line = [number]

for k in 0...n
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.

(...) interpreted as grouped expression.

def pascal(n, number)
line = [number]

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.

Prefer each over for.

@@ -0,0 +1,23 @@
def pascal(n, number)
line = [number]

Choose a reason for hiding this comment

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

Trailing whitespace detected.

Руслан Салянко added 4 commits February 21, 2018 11:28
number = gets.chomp.to_i
for i in 0...n
puts "#{i}: #{format_pascal(i, number)}"
end

Choose a reason for hiding this comment

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

Trailing whitespace detected.

line
end
def format_pascal(n, number)
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.

Trailing whitespace detected.

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

Руслан Салянко added 4 commits February 22, 2018 10:31
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.

мелкие фиксы, в остальном норм.

@@ -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 можно как-то обозвать более читаемо.

def pascal(n, number)
line = [number]
n.times do |k|
line << (line[k].to_i * (n - k) / (k + 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

и k это тоже касается

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.

2 participants