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
PAID_ITEM_COUNT = 5 | |
DISCOUNTED_ITEM_COUNT = 1 | |
# Returns the integer amount of items that must be discounted next | |
# given the amount of items seen | |
# | |
def discounted_items_to_find(total_items_seen, discounted_items_seen) | |
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen | |
end |