-
Notifications
You must be signed in to change notification settings - Fork 167
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 #767
base: master
Are you sure you want to change the base?
implement hw 1 #767
Conversation
2018/AlexeiRakov/1/piramid.rb
Outdated
puts "depth triangle = #{n} " | ||
print "\n\n" | ||
require 'colorize' | ||
triangle(n, z, c = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - c.
Final newline missing.
2018/AlexeiRakov/1/piramid.rb
Outdated
puts "vertex triangle = #{z} " | ||
puts "depth triangle = #{n} " | ||
print "\n\n" | ||
require 'colorize' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
n = gets.to_i | ||
puts "vertex triangle = #{z} " | ||
puts "depth triangle = #{n} " | ||
print "\n\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
print "enter the depth of the triangle: " | ||
n = gets.to_i | ||
puts "vertex triangle = #{z} " | ||
puts "depth triangle = #{n} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
z = gets.to_i | ||
print "enter the depth of the triangle: " | ||
n = gets.to_i | ||
puts "vertex triangle = #{z} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
left.push right | ||
c += 1 | ||
k += 1 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end at 14, 2 is not aligned with (0..r-1).step(1) do |index| at 9, 0.
2018/AlexeiRakov/1/piramid.rb
Outdated
k = 1 | ||
(0..r-1).step(1) do |index| | ||
right = right*(r-k+1)/k | ||
left.push right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
c = 1 | ||
k = 1 | ||
(0..r-1).step(1) do |index| | ||
right = right*(r-k+1)/k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 0) spaces for indentation.
Surrounding space missing for operator *.
Surrounding space missing for operator -.
Surrounding space missing for operator +.
Surrounding space missing for operator /.
2018/AlexeiRakov/1/piramid.rb
Outdated
right = z | ||
c = 1 | ||
k = 1 | ||
(0..r-1).step(1) do |index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
Surrounding space missing for operator -.
Unused block argument - index. You can omit the argument if you don't care about it.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,28 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do |r| | |||
n = [0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 0) spaces for indentation.
2018/AlexeiRakov/1/piramid.rb
Outdated
puts "#{n.center(130).green} #{m.rjust(13)}" | ||
end | ||
end | ||
print 'enter the vertex of the triangle:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
end | ||
num.to_s | ||
left.to_s | ||
puts "#{n.center(130).green} #{m.rjust(13)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
(0..r - 1).step(1) do | ||
|index| | ||
right = right * (r - k + 1) / k | ||
left.push right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
k = 1 | ||
(0..r - 1).step(1) do | ||
|index| | ||
right = right * (r - k + 1) / k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 0) spaces for indentation.
2018/AlexeiRakov/1/piramid.rb
Outdated
c = 1 | ||
k = 1 | ||
(0..r - 1).step(1) do | ||
|index| |
There was a problem hiding this comment.
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.
Unused block argument - index. You can omit the argument if you don't care about it.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,28 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do |r| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 0) spaces for indentation.
2018/AlexeiRakov/1/piramid.rb
Outdated
puts "vertex triangle = #{z}" | ||
puts "depth triangle = #{n}" | ||
require 'colorize' | ||
triangle(n, z, c = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - c.
Final newline missing.
2018/AlexeiRakov/1/piramid.rb
Outdated
right = z | ||
c = 1 | ||
k = 1 | ||
(0..r - 1).step(1)do|index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before keyword do is missing.
Unused block argument - index. You can omit the argument if you don't care about it.
2018/AlexeiRakov/1/piramid.rb
Outdated
num.to_s | ||
left.to_s | ||
puts "#{n.center(130).green} #{m.rjust(13)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,27 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do |r| | |||
n = [0] |
There was a problem hiding this comment.
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.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,27 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do |r| |
There was a problem hiding this comment.
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.
2018/AlexeiRakov/1/piramid.rb
Outdated
num.to_s | ||
left.to_s | ||
puts "#{n.center(130).green} #{m.rjust(13)}" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end at 18, 0 is not aligned with (0..n).map do |r| at 2, 2.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,27 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do |r| | |||
n = [0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not -2) spaces for indentation.
2018/AlexeiRakov/1/piramid.rb
Outdated
end | ||
num.to_s | ||
left.to_s | ||
puts "#{n.center(130).green} #{m.rjust(13)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
k += 1 | ||
end | ||
num.to_s | ||
left.to_s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
c += 1 | ||
k += 1 | ||
end | ||
num.to_s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
left = [z] | ||
right = z | ||
c = 1 | ||
k = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
num = [c] | ||
left = [z] | ||
right = z | ||
c = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
n = [0] | ||
num = [c] | ||
left = [z] | ||
right = z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
(0..n).map do |r| | ||
n = [0] | ||
num = [c] | ||
left = [z] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
def triangle(n, z, c) | ||
(0..n).map do |r| | ||
n = [0] | ||
num = [c] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,27 @@ | |||
def triangle(n, z, c) | |||
(0..n).map do|r| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after keyword do is missing.
2018/AlexeiRakov/1/piramid.rb
Outdated
c = 1 | ||
k = 1 | ||
(0..r - 1).step(1) do | ||
right = right * (r - k + 1) / k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not -2) spaces for indentation.
2018/AlexeiRakov/1/piramid.rb
Outdated
left.push right | ||
c += 1 | ||
k += 1 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end at 14, 2 is not aligned with (0..r - 1).step(1) do at 9, 0.
2018/AlexeiRakov/1/piramid.rb
Outdated
c = 1 | ||
k = 1 | ||
(0..r - 1).step(1) do | ||
right = right * (r - k + 1) / k |
There was a problem hiding this comment.
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.
2018/AlexeiRakov/1/piramid.rb
Outdated
puts "depth triangle = #{n}" | ||
puts 'parents will be selected from the left' | ||
require 'colorize' | ||
triangle(n, z, c = 0, q) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - c.
2018/AlexeiRakov/1/piramid.rb
Outdated
@@ -0,0 +1,37 @@ | |||
def triangle(n, z, c, q) | |||
(0..n).map do |r| | |||
# mas = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indentation detected (column 3 instead of 4).
2018/AlexeiRakov/1/piramid.rb
Outdated
k += 1 | ||
end | ||
puts "#{left.center(135).green} #{num.rjust(8)}" | ||
puts "#{mas.ljust(5).red}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to_s over string interpolation.
@@ -0,0 +1,32 @@ | |||
def triangle(n, z, c, q) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused method argument - z. If it's necessary, use _ or _z as an argument name to indicate that it won't be used.
Unused method argument - c. If it's necessary, use _ or _c as an argument name to indicate that it won't be used.
2018/AlexeiRakov/1/piramid.rb
Outdated
k += 1 | ||
end | ||
puts "#{left.chomt.to_s.center(135).green} #{num.chomt.to_s.rjust(8)}" | ||
puts "#{mas.chomt.to_s.ljust(5).red}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
Prefer to_s over string interpolation.
2018/AlexeiRakov/1/piramid.rb
Outdated
c += 1 | ||
k += 1 | ||
end | ||
puts "#{left.chomt.to_s.center(135).green} #{num.chomt.to_s.rjust(8)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
right = z | ||
c = 1 | ||
k = 1 | ||
(0..r - 1).step(1) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
@@ -0,0 +1,37 @@ | |||
def triangle(n, z, c, q) | |||
(0..n).map do |r| | |||
mas = [] |
There was a problem hiding this comment.
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.
2018/AlexeiRakov/1/piramid.rb
Outdated
end | ||
left.push right | ||
c += 1 | ||
k += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
mas.push right | ||
end | ||
left.push right | ||
c += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
mas.push o | ||
mas.push right | ||
end | ||
left.push right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Залей рабочий код, а с ботом уже как-то договоримся
2018/AlexeiRakov/1/piramid.rb
Outdated
print 'enter a child:' | ||
q = gets.to_i | ||
puts "vertex triangle = #{z}" | ||
puts "depth triangle = #{n}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
2018/AlexeiRakov/1/piramid.rb
Outdated
print 'enter the depth of the triangle:' | ||
n = gets.to_i | ||
print 'enter a child:' | ||
q = gets.to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
Фамилия Имя
Раков Алексей
Email
[email protected]
Номер домашнего задания
1
Ссылка на видео с демо работы
https://www.youtube.com/watch?v=EZvfCLhp8kg&feature=youtu.be
Комментарии
Код работает но бот ругается. Бот на столько наглый, что мне обычному смертному не хочет показывать на что он ругается.