Google Code Jam “Cookie Clicker”

This example was given as a spin-off to the Google Code Jam “Cookie Clicker” challenge.

class Investor
  def initialize(*args)
    @c, @f, @x = args
    @income = 2.0
    @seconds = 0
  def solve
    return proper_seconds if (@x-@c)/@income < @x/(@income + @f)
    @seconds += @c/@income
    @income += @f
  def proper_seconds
    (@seconds + @x/@income).round(7)
values = [
  [30.0, 1.0, 2.0],
  [30.0, 2.0, 100.0],
  [30.5, 3.14159,1999.1999],
  [500.0, 4.0, 2000.0]      
values.each { |settings| puts*settings).solve }

“FizzBuzz” code test

Here is my simple answer to a typical test given during interviews

class FizzBuzz
  attr_reader :output
  def initialize(iterations = 100)
    @output = (1..iterations).map { |i| fizz_buzz_test(i) }
  def fizz_buzz_test(iteration)
    when iteration % 15 == 0
    when iteration % 5 == 0
    when iteration % 3 == 0
  def print
    @output.join(', ')

What makes Developers happy?

  1. Managers that do not micromanage
  2. Meetings that are relevant to us and not a waste of time
  3. Challenging projects
  4. Performance graded by efficiency versus line count
  5. Properly set deadlines
  6. The least amount of political hoops we have to jump through
  7. Team members with applicable knowledge

This list plus a coffee pot and I’m sold.

Mainstream word rant

I’m actually sick of the word “racist”.  You can add the words “diversity” and “tolerance” to that list.  The definitions have been hijacked by the mainstream and dubbed “hate words”.   This is partially correct.  They have become “hate words”, but now they’re used to induce “hate” rather than describe it.

Pro tip for the day on typing

I see many individuals typing on the keyboard like they’re poking something to see if it is dead.  If you happen to be one of these individuals then have no fear!  Today is your day of salvation.

Here is a simple trick to turn you into a speed demon.  Are you ready?

Step 1: Think of something you’re extremely passionate about.  When I say “passionate” I mean something that you would take up a bat to defend.

Step 2: Go find a live chatroom with people who have opposing views and are equally as passionate.

Step 3: Poke the bear, trash talk, go on long profanity laced tirades about why they are wrong.

In no time, you’ll have an all out war.  Your mind will be so focused on what is going on in the chat that you will forget that you’re typing.  It will get to a point that your keyboard is making a nice buzzing noise.  Why?  The shear speed of your typing is eating the letters right off of the keys!

Caution:  You may make a ton of enemies following these instructions.

Unpopular Opinions

We live in an age where “unpopular opinions” can come back to haunt you years later.  Words, in the professional world, seem to be more detrimental to one’s position than infidelities or drug habits.

I do believe that is why more and more people are keeping their mouths shut about their particular beliefs.  Well, I’m not one of those people.

Here is a thought provoking response I gave to someone on the debate of abortion.

I’ve always wanted to throw a big blanket over people who are for unrestricted abortion and ask them if they were alive or not . They of course will reply with “yes” to which I would break out scissors and a vacuum and debate that with them!

Why? A blanket is about the same thickness as the skin and muscle that a baby is hiding behind in the womb.

I don’t know why the location of life determines if it is ok to kill it or not.

I hope this paints the debate in a different light.