Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jordaaash/bc5cb7271a464cb9d73babcb7ec1d00a to your computer and use it in GitHub Desktop.
Save jordaaash/bc5cb7271a464cb9d73babcb7ec1d00a to your computer and use it in GitHub Desktop.
class Image
def initialize (data)
@data = data
end
#write a method that loops through the existing 2D array and finds the
#location of the existing ones. The location of the the existing ones
#needs to be stored into memory so they can be iterated over and the
#exiting cells around them can be altered.
def find_the_ones
found_ones = []
data.each_with_index do
#find the row postion
data.each_with_index do
#find the column position
if position == 1
#find a way to store both the row and the column of a number
#If a 1 is found, store it in the found_ones array
#write a method that will blur or transform the ones
def blur
#if clause to change the value (above) a found one
#if clause to change the value to the (left) of a found oune
#if clause to change the value to the (right) of a found one
#if clause to change the value to the (bottom) of a found one
#have to determine if item postion is on an edge
#row/column index of -1 for last row or column
end
def output_image
@data.each do |array|
puts array.join
end
end
end
image = Image.new([
[0, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 1],
[0, 0, 0, 0]
])
image.output_image
#output new blurrled image below old blurred image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment