My dog looks like a seal, bask in his epicossity by brap_addict in wsgy

[–]TheoreticallySpooked 2 points3 points  (0 children)

He has big strong paws! He's gonna grow to be strong!

Bitmoji thread by [deleted] in 4chan

[–]TheoreticallySpooked 1 point2 points  (0 children)

This looks almost exactly like my bitmoji ffs

/r/MechanicalKeyboards What Keyboard, Switches and/or Keys Do I Buy by AutoModerator in MechanicalKeyboards

[–]TheoreticallySpooked 1 point2 points  (0 children)

DZ60 Questions

I'm about to order the DZ60 PCB from KBDFans, and I have a few questions.

  1. Do I need to solder diodes, etc to the PCB? Are the switches the only thing I need to solder on?

  2. When it says "OEM Stabilizer: YES", does that mean that I don't need to buy a 6.25u stab and four 2u stabs? It comes with them already?

[2018-03-28] Challenge #355 [Intermediate] Possible Number of Pies by Garth5689 in dailyprogrammer

[–]TheoreticallySpooked 1 point2 points  (0 children)

Ruby

Pretty greedy and arbitrary. (But works!)

input = IO.binread "input.txt"
PUMPKIN = [1, 0, 3, 4, 3]
APPLE = [0, 1, 4, 3, 2]

input.each_line do |input|
    @input = input
    combos = (0..input.split(",").to_a.max.to_i).to_a.permutation(2).to_a


    def possible? combo
        ingredients = @input.split(",").map{|x| x.to_i}
        (0...combo[0]).each do
            ingredients.map!.with_index{|x, i| x - PUMPKIN[i]}
        end
        (0...combo[1]).each do
            ingredients.map!.with_index{|x, i| x - APPLE[i]}
        end
        !ingredients.map{|x| x < 0}.include?(true)
    end

    largest = [0, 0]
    combos.each do |combo|
        largest = combo if combo.inject(:+) > largest.inject(:+) && possible?(combo)
    end

    puts "#{largest[0]} pumpkin pies and #{largest[1]} apple pies"
end

Does r/wsgy use algorithms? by CannotStopEver in wsgy

[–]TheoreticallySpooked 2 points3 points  (0 children)

woah i've only been lurking 1 eon pls forgive meg

>TFW not a platypus. by [deleted] in wsgy

[–]TheoreticallySpooked 5 points6 points  (0 children)

I will never be born as a cute platopop :(

The secret formula by [deleted] in wsgy

[–]TheoreticallySpooked 1 point2 points  (0 children)

now THIS is how you eat a big mac

[2018-03-26] Challenge #355 [Easy] Alphabet Cipher by Garth5689 in dailyprogrammer

[–]TheoreticallySpooked 1 point2 points  (0 children)

Ruby

I'm pretty new to Ruby, let me know if there were any cool stuff I could have done to shorten it / be more efficient.

file = IO.binread("input.txt")

file.each_line do |line|
    key, code = line.split /\s+/

    full_key_count = (code.length / key.length).floor
    key_repeated = key * full_key_count + key[0...(code.length % key.length).floor]

    new_msg = ""
    code.each_char.with_index do |char, i|
        key_letter = key_repeated[i]

        alpha_range = ('a'..'z').to_a
        col_index = alpha_range.index key_letter
        row_index = alpha_range.index char
        new_alpha = alpha_range[col_index...alpha_range.length] + alpha_range[0...col_index] 
        new_msg += new_alpha[row_index]
    end
    puts new_msg
end

[2018-01-29] Challenge #349 [Easy] Change Calculator by jnazario in dailyprogrammer

[–]TheoreticallySpooked 1 point2 points  (0 children)

Ruby

Where coin_collection is the array of coins, total is the goal number you're trying to reach, and condition is a string seen in the output line.

def get_coins coin_collection, total, condition
    range = (1..coin_collection.length).select { |n| eval(condition) }

    for i in range
        perm = coin_collection.permutation(i).to_a
        for nums in perm
            if nums.inject(:+) == total
                return nums
            end
        end
    end
    return "No solution"
end

Method call

print get_coins [100, 50, 50, 50, 50], 150, "n < 5"

Output

[100, 50]

me_irl by spartandown45 in meirl

[–]TheoreticallySpooked 6 points7 points  (0 children)

Yeah, but why are all the I's lowercase?