6 Changed title to be consistent with post (square to rectangle).
| link

Circle packing in a squarerectangle

    Post Reopened by Martin Ender, Beta Decay, NinjaBearMonkey, Hosch250, Kevin Brown
5 Formatting changes
source | link

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

1: No two circles overlap and

2: All of the circles fit inside of the rectangle.

  1. No two circles overlap
  2. All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

1

This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, userInput, hardCoded variables, or anything else you want.

2

If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

3

Each circle must have the same radius.

4

Just to make this reasonable and do-able, all numbers must be precise to the 2nd decimal place.

  1. This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, user input, hard coded variables, or anything else you want.

  2. If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

  3. Each circle must have the same radius.

  4. Just to make this reasonable and do-able, all numbers must be precise to the 2nd decimal place.

This is Code Golfcode golf, so shortest program (as of 10/28/2014) wins. I will probably submit my own version also, but so far I haven't worked on it at all.

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

1: No two circles overlap and

2: All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

1

This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, userInput, hardCoded variables, or anything else you want.

2

If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

3

Each circle must have the same radius.

4

Just to make this reasonable and do-able, all numbers must be precise to the 2nd decimal place.

This is Code Golf, so shortest program (as of 10/28/2014) wins. I will probably submit my own version also, but so far I haven't worked on it at all.

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

  1. No two circles overlap
  2. All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

  1. This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, user input, hard coded variables, or anything else you want.

  2. If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

  3. Each circle must have the same radius.

  4. Just to make this reasonable and do-able, all numbers must be precise to the 2nd decimal place.

This is code golf, so shortest program (as of 10/28/2014) wins.

4 added 2 characters in body
source | link

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

1: No two circles overlap and

2: All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

1

This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, userInput, hardCoded variables, or anything else you want.

2

If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

3

Each circle must have the same radius.

4

Just to make this reasonable and do-able, all numbers must be precise to the hundredth2nd decimal place.

This is Code Golf, so shortest program (as of 10/28/2014) wins. I will probably submit my own version also, but so far I haven't worked on it at all.

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

1: No two circles overlap and

2: All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

1

This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, userInput, hardCoded variables, or anything else you want.

2

If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

3

Each circle must have the same radius.

4

Just to make this reasonable and do-able, all numbers must be precise to the hundredth place.

This is Code Golf, so shortest program (as of 10/28/2014) wins. I will probably submit my own version also, but so far I haven't worked on it at all.

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program must find the largest possible radius and optimal position of these N circles so that

1: No two circles overlap and

2: All of the circles fit inside of the rectangle.

Your program should then print this to the console:

Highest possible radius: <some_number>
Circle 1 Focus: (x, y)
Circle 2 Focus: (x, y)
...
Circle N-1 Focus: (x, y)
Circle N Focus: (x, y) 

(Obviously, you must replace some_number with the radius your program calculates, N with the number of circles you end up using, and x and y with the actual coordinates of the circle)

Lastly, it should create and save a picture with these circles drawn.

Rules:

1

This program must run with any size of rectangle, and any number of circles and still get a valid answer. You can use command line arguments, userInput, hardCoded variables, or anything else you want.

2

If any circle overlaps or does not fit entirely inside of the box, your submission is invalid.

3

Each circle must have the same radius.

4

Just to make this reasonable and do-able, all numbers must be precise to the 2nd decimal place.

This is Code Golf, so shortest program (as of 10/28/2014) wins. I will probably submit my own version also, but so far I haven't worked on it at all.

3 Made the challenge more specific, changed sample output, changed the name
source | link
    Post Closed as "unclear what you're asking" by Martin Ender, Calvin's Hobbies, Peter Taylor, ProgramFOX, Wrzlprmft
    Tweeted twitter.com/#!/StackCodeGolf/status/525142438243868673
2 edited tags
| link
1
source | link