I am a budding full stack developer with a background in computer science and engineering. During my time at the University of California, Merced and the UC Berkeley Coding Bootcamp I have covered a wide range of topics in the field including artificial intelligence, web-development and numerical analysis.
This program implements an image class that is represented by an array of 0's or 1's. This class also has a blur capability which will flip all 0's a given distance around any 1's present.
class Image
def initialize (img_array)
@image = Array.new(img_array)
end
def output_image
@image.each { |i| puts i.join('')}
end
def m_block(block, cRow, cCol, rowLength, colLength)
row = block
col = 0
while (row >= 0) do
if (cRow - row >= 0)
if (cCol - col >= 0)
@image[cRow-row][cCol-col] = 1
end
if (cCol + col <= colLength)
@image[cRow-row][cCol+col] = 1
end
end
if (cRow + row <= rowLength)
if (cCol - col >= 0)
@image[cRow+row][cCol-col] = 1
end
if (cCol + col <= colLength)
@image[cRow+row][cCol+col] = 1
end
end
row = row - 1
col = col + 1
end
if (block > 1)
m_block(block-1, cRow, cCol, rowLength, colLength)
end
end
def blur_image(blk)
temp_image = []
@image.each {|sub| temp_image << sub.dup}
#temp_image.each { |i| puts i.join('')}
temp_image.each_index do |row|
#puts "row: #{row}"
#temp_image.each { |i| puts i.join('')}
subarray = temp_image[row]
subarray.each_index do |col|
if (temp_image[row][col] == 1)
m_block(blk, row, col, temp_image.length-1, subarray.length-1)
end
end
end
end
end
image = Image.new([
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0]
])
image.output_image
image.blur_image(3)
puts "----"
image.output_image
This program determines whether or not a given credit card number is valid or not.
module Luhn
def self.is_valid?(number)
count = 1
sum = 0
while (number > 0)
temp = number % 10
if (count % 2 == 0)
temp = temp * 2
if (temp > 9)
temp = temp - 9
end
end
sum += temp
count += 1
number = number / 10
end
if (sum % 10 == 0)
return true
else
return false
end
end
end
I have developed proficiency and expertise in the following programming languages and comfort with the following tools.
Currently entertaining new opportunities. Please get in touch via email: