Homework 1#762
Open
vshkrabkov wants to merge 3 commits intorubyroidlabs:masterfrom
vshkrabkov:homework_1
Open
Conversation
Xanderwot
suggested changes
Mar 11, 2018
| basic_val = gets.chomp.to_i | ||
| pasc_tri = [[basic_val]] | ||
|
|
||
| (1..(deep - 1)).each do |i| |
Contributor
There was a problem hiding this comment.
либо (deep - 1).times do
либо (1...deep).each do
Contributor
There was a problem hiding this comment.
Используй более читаемые переменные вместо i, j, m и прочего. Ниже тоже.
|
|
||
| (1..(deep - 1)).each do |i| | ||
| ar = [] | ||
| (0..i).each do |j| |
| require 'io/console' | ||
| size = IO.console.winsize | ||
|
|
||
| (0..(deep - 1)).each do |i| |
| (0..(deep - 1)).each do |i| | ||
| str = '' | ||
| print "#{i}:" | ||
| (0..i).each do |j| |
| (0..i).each do |j| | ||
| str += (pasc_tri[i][j].to_s + (' ' * (size[1] / (deep * 2)))) | ||
| end | ||
| puts ' ' * (size[1] / 2 - ((str.length - size[1] / (deep * 2)) / 2) - 2) + str |
Contributor
There was a problem hiding this comment.
все странные числа лучше вынести в константы. не понятно почему все умножается или делится на 2.
ilyacoding
reviewed
Mar 30, 2018
| deep = gets.chomp.to_i | ||
| puts 'Enter basic value' | ||
| basic_val = gets.chomp.to_i | ||
| pasc_tri = [[basic_val]] |
ilyacoding
reviewed
Mar 30, 2018
| pasc_tri.push(ar) | ||
| end | ||
|
|
||
| require 'io/console' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Фамилия Имя
Шкрабков Владислав
Email
vlad.shkrabkov@gmail.com
Номер домашнего задания
1
Ссылка на видео с демо работы
https://youtu.be/AJvJDC_d7ag
Комментарии
Делал сразу 3 lvl. Алгоритм создания и вывода похож на всех трех уровнях, только добавляются какие-то доп условия на каждом уровне.