21
\$\begingroup\$

We've just gotten the August 2016 Community Challenge going, so it's time to pick one for September.


It's time to choose a for September 2016.

  • Post your challenge as an answer to this question. Feel free to resubmit non-winning ideas from previous months.
  • Vote for those answers which interest you.
  • At the end-of-day on Wednesday, August 31st, the top-voted post will become the next challenge.

Once the challenge topic is decided, post your solution as a question on the main site and tag it with . The challenge runs throughout September (but nothing stops you from posting an entry later on).

\$\endgroup\$
  • 2
    \$\begingroup\$ After this, community challenges are scheduled to resume in February 2017. \$\endgroup\$ – 200_success Sep 26 '16 at 18:18
  • \$\begingroup\$ @200_success ah, I was wondering what happened. Is there a thread on this decision (not that I have a problem with it)? \$\endgroup\$ – Raystafarian Oct 7 '16 at 11:36
  • 1
    \$\begingroup\$ @Raystafarian meta.codereview.stackexchange.com/questions/6011/… \$\endgroup\$ – Der Kommissar Oct 7 '16 at 16:13
17
\$\begingroup\$

I resubmit Legato's submission for August 2016:

CRitter Collaboration

Choose a previous community challenge and work with someone(s) to complete it.

Though interest in challenges may be high time can be scarce so this is a way to get more participation! It doesn't even have to be a community challenge as long is it's something you and others agree to work towards for the challenge period.

Definite Benefits:

  1. Exercise in effective communication.
  2. Getting to know fellow CRitters!
  3. Experience in organization / group tasks.
  4. Less time-consuming.

Possible Benefits:

  1. Practice in another language.
  2. Exercise in language agnostic design.
  3. Using a VCS such as Git.

Room to find people to work with / discuss implementation, and plan.

\$\endgroup\$
  • \$\begingroup\$ I like the idea, ..but then, it doesn't seem fair that only one of the contributors gets all the rep out of question votes. Perhaps the lowest-rep contributor should post the CR question? \$\endgroup\$ – Mathieu Guindon Aug 22 '16 at 20:32
  • 1
    \$\begingroup\$ I was thinking the challenges could be CW, or, if the project is large enough, they could perhaps post two or more. The contributors would have to work this out between them. Maybe they could even do two together and each post one. \$\endgroup\$ – Hosch250 Aug 22 '16 at 21:31
  • 2
    \$\begingroup\$ IMO making CW questions does not encourage reviewers to post answers - at least not the new ones, those with lower reputation scores. \$\endgroup\$ – Mathieu Guindon Aug 22 '16 at 21:33
  • 1
    \$\begingroup\$ True. I still think it would best be resolved between the contributors, but perhaps we could have a guideline that the lowest-rep contributor post unless they come to a satisfactory conclusion between themselves? \$\endgroup\$ – Hosch250 Aug 22 '16 at 21:36
  • 1
    \$\begingroup\$ Is there a inside joke or a running gag I don't get when you say CRitter instead of critter? \$\endgroup\$ – Christian Dean Aug 26 '16 at 14:31
  • 2
    \$\begingroup\$ @Mr.goosberry "CR" is the name of the site, so it is a joke that we are "CRitters" because we are members of CR. \$\endgroup\$ – Hosch250 Aug 26 '16 at 15:10
  • \$\begingroup\$ @Hosch250 Oh.... Thanks for answering \$\endgroup\$ – Christian Dean Aug 26 '16 at 15:29
  • \$\begingroup\$ @Mat'sMug I'd say it's more important that questions get posted than who posts them. \$\endgroup\$ – Simon Forsberg Sep 4 '16 at 18:04
19
\$\begingroup\$

Chain (or belt) drive system

I propose a variation on this challenge by Ell over on PCG - minus the golfing requirement, of course. (Disclosure: I've already done this challenge in JavaScript)

To quote the original:

Your program will be given a list of sprockets, specified as (x, y, radius) triplets. The resulting chain drive system is comprised of these sprockets, connected together by a closed taut chain passing over each of them, in order. [...]

For example, given the input

(0, 0, 16),  (100, 0, 16),  (100, 100, 12),  (50, 50, 24),  (0, 100, 12)

the output should look something like

chain drive

The original challenge is to generate a fully animated chain drive system, but that's quite a mouthful, so I propose that it can be solved to different degrees:

  • Analysis without visual output (e.g. calculating the total chain length, whether the chain crosses itself, the rotational offset from one sprocket to the next that's necessary for the chain to mesh, time taken for a link in the chain to make one full circuit, etc.)

  • Simplified, static visualization showing the spatial layout and chain path

  • Full-on animation, as per the original challenge

  • Interactive visualization (animated or not), e.g. with customizable settings or even click and drag sprockets

And the chain doesn't need to be a chain nor do the sprockets need to be sprockets; it could just be a belt drive system, i.e. plain circles and lines. This would add a lot of flexibility as things won't need to mesh (and radii and placements won't be constrained), but you'd still be calculating tangent points etc.. Animation wouldn't be as fun, but one could add indicators to the wheels and belt to show the movement.

Or one could go the other way, and have the chain be properly segmented into links like a bike chain, instead of drawing a smooth arc around the sprockets.

I admit that the challenge appears a little daunting, but it's actually not that bad. If the goal is simply to do that analysis part (i.e. no animation or graphical output), it can be done in pretty much any language. All that's needed is a bit of vector math (to work out tangent points), and basic geometry (to work out arc lengths).

Still, the task does look daunting, which presents a bit of a barrier to entry so I don't know if it's the best fit for a community challenge. But personally I found it to be an interesting (and fun!) task, with plenty of "meat" on its bones.

\$\endgroup\$
  • 4
    \$\begingroup\$ That challenge was literal art, oh my god. \$\endgroup\$ – cat Aug 12 '16 at 15:44
  • \$\begingroup\$ Would whoever downvoted care to post their criticism? Just curious \$\endgroup\$ – Flambino Aug 16 '16 at 12:15
  • 3
    \$\begingroup\$ The gears image is offensive to me - why's it gotta go clockwise? You got something against counter-clockwise motion? But seriously, I didn't downvote, but I imagine it's probably due to exactly what you mention at the end of the post, or at least similar. Personally I like pretty simple challenges that can be increased in complexity by choice rather than that barrier to entry. In the same breathe, I think this is distinct enough from other challenges that it sticks out and will probably end up on the backlog to be used in the future. +1 \$\endgroup\$ – Raystafarian Aug 16 '16 at 16:08
  • 2
    \$\begingroup\$ @Raystafarian Yeah, you're probably right. I should maybe add a little about what's required to solve the task just at a basic, non-graphical way (some simple vector math and trig). It's really not as daunting as it might seem. Anyway, time for commercials: "Flambino is the pro-clockwise choice this election. Raystafarian, with his twisted rhetoric, defines himself only in opposition to what's right (-turning) and natural! (Paid for by Clockmakers for Truth 2016)" \$\endgroup\$ – Flambino Aug 16 '16 at 17:10
  • 2
    \$\begingroup\$ "Do you live in the northern hemisphere? Are you Ancient Egyptian? Then why are you stuck in the past? Sundials have been moving clockwise for more than 5,000 years - why not a change? You don't want people thinking you support global warming, do you? Change is the future! Counter humankind's past mistakes this year by going with the future - Raystafarian. (Paid for by Antique Jewelers Across the Globe) \$\endgroup\$ – Raystafarian Aug 16 '16 at 18:35
  • 1
    \$\begingroup\$ @Raystafarian "Is Raystafarian a communist? Some say yes. (Paid for by Asinine Insinuations Meant to Derail the Public Discourse)"... This is going to get out of hand isn't it? \$\endgroup\$ – Flambino Aug 16 '16 at 18:40
  • \$\begingroup\$ @Flambino dangit, this look complex. Where you you even start?! especially this - Interactive visualization (animated or not), e.g. with customizable settings or even click and drag sprockets. WHAT ?! \$\endgroup\$ – Christian Dean Aug 26 '16 at 3:33
  • \$\begingroup\$ @Mr.goosberry It's not as bad as you might think. When I first saw the challenge, I thought it was ridiculously complicated too. I'm not saying it's simple, but like with anything, if you go one step at a time, you'll figure it out. As for making it interactive: If you can draw the system from static input, you can also draw it from dynamic input. Most of the extra code would be likely user-input handling - not the actual sprocket system. \$\endgroup\$ – Flambino Aug 26 '16 at 11:04
  • \$\begingroup\$ @Flambino hmm... Maybe I can use Python's Pygame to whip something up. I can probably make the gear animation, but that user interactivity thing is gonna make me think. Despite this, your idea looks very challenging, which is good. +1 \$\endgroup\$ – Christian Dean Aug 26 '16 at 12:55
  • \$\begingroup\$ @Mr.goosberry Not my idea! All credit goes to Ell over at PCG :) And yeah, pygame might be a good fit. As for interactive, there you can either re-render everything for every change (in which case it's the same as rendering the given test input), or you can optimize to only render affected parts of the system. The first option is of course simpler, and good place to start \$\endgroup\$ – Flambino Aug 26 '16 at 14:09
  • \$\begingroup\$ @Oh. You sneaky thing, trying farm extra rep, are we? ͡(° ͜ʖ ͡°) . Anyway I'll shoot over and look at the original post by ELL at PCG. \$\endgroup\$ – Christian Dean Aug 26 '16 at 14:17
  • \$\begingroup\$ @Mr.goosberry Honest answer: Nobody complains about extra rep, but I didn't suggest this challenge with that as an ulterior motive. It was more that I am pretty happy of the solution I came up with over on PCG, but I'd like to see it discussed. Can't really request a review of ~1800 bytes of golfed gibberish, but an ungolfed version could be fun to post for review. And I'd like to see other approaches than my own too. \$\endgroup\$ – Flambino Aug 26 '16 at 14:26
  • \$\begingroup\$ @Flambino I know dude. I was just kidding. But I do have a question: do the gears have to be that complex in terms of graphics? Could they just be circles? \$\endgroup\$ – Christian Dean Aug 26 '16 at 14:29
  • \$\begingroup\$ @Mr.goosberry Sure - the fun is in "solving" the system. That's what I meant when I wrote it can be a belt drive. No segmented chain, just a line, and not sprockets, just wheels \$\endgroup\$ – Flambino Aug 26 '16 at 14:32
  • \$\begingroup\$ Great! I'll get started on something to enter, just in case this is picked. goodbye and cheers!. \$\endgroup\$ – Christian Dean Aug 26 '16 at 14:34
7
\$\begingroup\$

I re-submit Heslacher's proposal from August 2015:


In image processing, a contour is a closed curve forming the boundary of a region of the image (or a union of closed curves, if the region has holes). For example, given this image:

low-resolution image of a capital letter O

The contour of the black region is the pair of orange curves shown here:

the contour of the capital letter O consists of two curves, one for the outer boundary and one for the inner boundary

Implement an algorithm that finds the contour of a region in an image.

You may assume, if you wish, that the image is represented as a two-dimensional array of Booleans (indexed by \$x\$ and \$y\$, say), with array entries containing true for the region of interest.

Possible choices of algorithm include:

\$\endgroup\$
4
\$\begingroup\$

Combinations Calculator

What is a combination?

A combination is a selection of all or part of a set of objects, without regard to the order in which objects are selected.

For example, suppose we have a set of three letters: A, B, and C. We might ask how many ways we can select 2 letters from that set. Each possible selection would be an example of a combination. The complete list of possible selections would be: AB, AC, and BC.

source

The challenge

You are to take input of

  • n non-numeric elements in whatever format you'd like
  • r size of combination groups

And output how many distinct combinations of r elements are possible from the total n population, without regard for the order of the elements. So as to say that both AB and BA cannot both be counted because they are the same combination with different permutations.

Sample data points

As an example of input to output, you can use these data points

(n,r) = c

7   1    7 
7   2    21 
7   3    35 
7   4    35 
7   5    21 
7   6    7 
7   7    1 
15  1    15 
15  2    105 
15  3    455 
15  4    1,365 
15  5    3,003 
15  6    5,005 
15  7    6,435 
15  8    6,435 
15  9    5,005 
15  10   3,003 
15  11   1,365 
15  12   455 
15  13   105 
15  14   15 
15  15   1 

Bonus round

If you feel like it, instead of output of the number of combinations, output the actual combinations in a legible form e.g.

enter image description here

Note: (n=34, r=17) > 231

\$\endgroup\$
2
\$\begingroup\$

This question is about entering in the colors of a Rubik's cube with four squares (2x2) per side. It uses a text interface.

I was thinking that we could have a challenge to create a graphical interface for a 3x3 Rubik's cube.

There are six sides, each with a 3x3 grid. Parts of the cube can be rotated, mixing up the colors. The center of each grid always stays the same color. The corners are shared between three sides. For example, one corner is red, white, and blue. Some pairings for colors are impossible because the colors are on opposite sides.

Opposite color pairs when solved: green/blue; red/orange; yellow/white.

As I said, the base problem could be a graphical interface to choose the colors for each square. A simple interface might just show each of the six sides. A more advanced program could show them as a cube and allow the user to rotate the cube to choose the colors on a different side. Bonus points if the program could check that the chosen colors are actually possible in a solvable cube. A really advanced program could solve the cube.

Advantages of this challenge:

  • Choice of language is open.
  • It has a variety of levels. Someone could implement a simple color chooser or a more complex one. With or without solver.
  • Users often prefer graphical interfaces and this is a chance for those of us who are more comfortable with code or text interfaces to work with a basic one. And think about how to make it more advanced.
  • The highest level problem is complex enough to be interesting.
  • If someone solves every suggestion here -- do the 4x4 cube (or more). Or one of the alternative shapes.
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .