I hereby claim:
- I am dividedharmony on github.
- I am dharmon202 (https://keybase.io/dharmon202) on keybase.
- I have a public key ASAaa0jrLVCaEzdWXmBKp1qbh9jKEjCFQFrtFgz51DHOiAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| class EgyptianFraction | |
| class ImproperFraction < StandardError; end | |
| attr_reader :converted_fractions, :original_rational, :current_rational | |
| def initialize(numerator, denominator) | |
| raise ImproperFraction if numerator > denominator | |
| @converted_fractions = [] | |
| @original_rational = Rational(numerator, denominator) | |
| @current_rational = original_rational |
| ## | |
| # Instructions from https://www.codewars.com/kata/my-smallest-code-interpreter-aka-brainf-star-star-k/train/ruby | |
| # | |
| # Inspired from real-world Brainf**k, we want to create an interpreter of that | |
| # language which will support the following instructions | |
| # (the machine memory or 'data' should behave like a potentially infinite array of bytes, initialized to 0): | |
| # | |
| # > increment the data pointer (to point to the next cell to the right). | |
| # < decrement the data pointer (to point to the next cell to the left). | |
| # + increment (increase by one, truncate overflow: 255 + 1 = 0) the byte at the data pointer. |
| #!/usr/bin/env ruby | |
| require 'json' | |
| ####### | |
| # | |
| # Classes to help execution | |
| # | |
| ####### |
| # frozen_string_literal: true | |
| class NullObject | |
| class << self | |
| SOFT_DEFAULTS = { | |
| array: [], | |
| hash: {}, | |
| null: nil | |
| null_object: NullObject | |
| }.freeze |