TDD Kata (6): Bulleyes

Previous Post
Next Post

At Google Code Jam, Round 1A, I found this problem:

The bull eyes problem: Mary should paint a series of concentric circle, given a radius and an initial amount of paint. The problem is: given r and t (the radius and the amount of paint) how many circles of width 1cm Mary can pain?

I wrote my solution using TDD, but after a first thoughts, I coded a solution using a formula, see:

The commit history at:

At the beginning, I had an algorithm that depended on a function that calculates the amount of paint needed to paint a circle of radius r. But then, I replaced it by other algorithm, that directly returns the count of circles that Mary can pain, given an initial radius and paint quantity. All my tests continued to be in green.

As in other Google Code Jam problems, I didn’t write the console program using TDD. I put my focus on the right algorithm. In this case, it was enough to have a general formula that solves the problem.

Keep tuned!

Angel “Java” Lopez

6 thoughts on “TDD Kata (6): Bulleyes

  1. Pingback: TDD Kata (5): Tree Search | Angel "Java" Lopez on Blog

  2. Pingback: TDD Kata (6): Bulleyes | MVPs de LATAM

  3. Pingback: TDD Kata (7): Manage your Energy | Angel "Java" Lopez on Blog

  4. twitter followers no password free

    First of all I want to say excellent blog! I had a quick question in which I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear
    your mind prior to writing. I have had difficulty clearing my thoughts in getting my thoughts out there.
    I truly do enjoy writing however it just seems like the first
    10 to 15 minutes are wasted simply just trying to figure
    out how to begin. Any recommendations or tips?
    Thank you!

  5. learn Spanish fast yahoo free kids game

    Write more, thats all I have to say. Literally, itt sedems as though you relied on the
    video to make your point. You definitely know wha youre talking about, why throw away your intelligence on just posting
    videos to your weblog when you could bbe giving us something informative to read?

  6. ios

    Ahaa, its nice conversation regarding this article at this place at this blog, I
    have read all that, so at this time me also commenting here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s