Created
December 1, 2016 00:03
-
-
Save pdbradley/f6c67ce56bc2179d9f40eff835e70c60 to your computer and use it in GitHub Desktop.
blur2.rb
This file contains 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
class Image | |
def initialize(image) | |
@image = image | |
end | |
def output_image | |
@image.each do |row| | |
row.each do |cell| | |
print cell # always puts a newline | |
end | |
puts "" | |
end | |
end | |
def blur | |
end | |
def image_width | |
@image.first.size | |
end | |
def image_height | |
@image.size | |
end | |
def too_far_right?(col) | |
col >= image_width | |
end | |
end | |
# image = Image.new([ | |
# [0, 0, 0, 0], | |
# [0, 1, 0, 0], | |
# [0, 0, 0, 1], | |
# [0, 0, 0, 0] | |
# ]) | |
image = Image.new([ | |
[0, 0, 0, 0, 0], | |
[0, 1, 0, 0, 0], | |
[0, 0, 0, 1, 0], | |
[0, 0, 0, 0, 0] | |
]) | |
image.output_image | |
puts "image width is" | |
puts image.image_width | |
puts "image height is" | |
puts image.image_height | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment