41
\$\begingroup\$

AKA: The Regifting of the White Elephants

Note - I'm not sure this is on-topic or not on meta, but it seems to be as good a place as any. Comment if you disagree.

I have a few challenges that I have posted to the sandbox and then more-or-less forgotten. Some of these challenges are OK; some not so much. I think all of them could do with at least some level of polishing before they are posted to main.

So this is my christmas gift to the community this year. I don't think I have the inclination to pick up any of these challenges right now, if ever, so if you are interested, you may claim ownership and run with it.

I will post the challenges I am donating as answers to this question. If you have similar challenges you wish to donate, then please feel free to post as answers too.

If you are interested in picking up any of these, go ahead and indicate this in the comments.

Up/down-vote answers to indicate your interest solving a challenge. This will give potential new owners a feel for whether its worth picking up that challenge.

Seasons Greetings!


If you are taking one of these challenge ideas, you should either edit the existing sandbox entry with your ideas, or perhaps create a new sandbox entry.

\$\endgroup\$
4
  • \$\begingroup\$ Why this is off-topic? \$\endgroup\$
    – Xwtek
    Commented Jan 1, 2016 at 0:16
  • 1
    \$\begingroup\$ @ChristianIrwan IMO its on-topic, and I think now its safe to say the community agrees - I just wasn't sure when I posted the question. \$\endgroup\$ Commented Jan 2, 2016 at 4:52
  • 1
    \$\begingroup\$ If you take a challenge, you should edit the original sandbox post when you do, and make sure to do so when it's posted as well, so we don't end up with duplicates. \$\endgroup\$
    – mbomb007
    Commented Sep 13, 2016 at 13:56
  • 2
    \$\begingroup\$ See also question ideas which haven't even been sandboxed \$\endgroup\$ Commented Jun 26, 2017 at 16:37

17 Answers 17

20
\$\begingroup\$

You're welcome to take this over. I don't have time, sorry :-(


Count the pips in a pair of dice

Here are two photographs of a pair of randomly thrown dice. (OK, they're 3D renderings, but never mind). In the photo on the left, the dice are showing one and five pips. In the photo on the right, they are showing three and four pips. Can you program your computer to count the pips automatically?

enter image description here enter image description here

The challenge:

Write a program that takes as its input the filename of a 240×180 JPEG image similar to the above examples, and outputs two numbers corresponding to the pips visible on the top faces of the dice (in ascending order). Your program must accomplish this in less than five seconds on an averagely specced desktop computer.

Images:

For training and testing purposes, I have created a set of 1,000 JPEG images together with information about the number of pips visible in each image.

Scoring:

For scoring purposes, it might be worth converting these to arrays of RGB values (or at least excluding the JPEG conversion code from the length of the submitted code). You might want to provide a randomly selected subset of these images for training, and reserve the other images for testing.

Notes:

  • There are no images with any die intersecting the edge of the image frame. However, there are many images where one die is partially obscuring the other.

  • Both dice are standard right-handed dice, where each pair of opposite sides adds up to 7, and the numbers 1, 2 and 3 are arranged in anti-clockwise order around their shared vertex.

\$\endgroup\$
3
  • 7
    \$\begingroup\$ I don't know who downvoted this, it's pretty solid \$\endgroup\$ Commented Jul 3, 2018 at 4:12
  • \$\begingroup\$ Is this possible? \$\endgroup\$
    – S.S. Anne
    Commented Jan 11, 2020 at 21:28
  • \$\begingroup\$ Sure. Finding the dice should be quite easy. Then with a bit of pattern matching, it shouldn't be too hard to count the pips on their upper surfaces with reasonable accuracy. \$\endgroup\$
    – r3mainer
    Commented Jan 12, 2020 at 20:55
3
\$\begingroup\$

Frame ASCII art

A great gift with six sandbox upvotes!

I don't know what to do about the similarity to challenges about removing leading spaces, printing a border a border, and others I know exist but am not finding in a search.

\$\endgroup\$
3
\$\begingroup\$

Posted

Let's Play Mafia! pending removal of this post

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I will try this. \$\endgroup\$
    – user63187
    Commented Dec 20, 2017 at 16:51
  • 1
    \$\begingroup\$ and after a few edits i am posting O_O \$\endgroup\$
    – user63187
    Commented Dec 20, 2017 at 16:56
3
\$\begingroup\$

Posted

\$\endgroup\$
2
  • \$\begingroup\$ (The aspect ratio of this tends towards the golden ratio, and you can approximate a golden spiral by connecting quarter-circles in each box) \$\endgroup\$
    – tjjfvi
    Commented Aug 7, 2021 at 23:21
  • \$\begingroup\$ I'll try and clean this up, looks quite good! \$\endgroup\$
    – emanresu A
    Commented Dec 21, 2021 at 21:24
2
\$\begingroup\$

Golf the numbers round a dartboard

In its current state, this one is fairly trivial, without a ton of creativity required for solutions. But the sequence is interesting. Perhaps there is some inspiration to had here.

\$\endgroup\$
5
  • \$\begingroup\$ The plain 'print 20 1 18 4 13 6 10 15 2 17 3 19 7 16 8 11 14 9 12 5' will be hardcoded in non-golfing languages, and in golfing languages with permutations; indexed into permutations. For example, Pyth will just be @.pS20C"[an 8 char string]. To be interesting, we'll need to prevent both of the uninteresting solutions. \$\endgroup\$
    – lirtosiast
    Commented Dec 30, 2015 at 22:00
  • \$\begingroup\$ @ThomasKwa That pyth solution is pretty clever IMO. Once you've found the right 8-char string, I wonder how long pyth would actually take to output the right answer. \$\endgroup\$ Commented Dec 30, 2015 at 22:13
  • 1
    \$\begingroup\$ It's just (19*19!+0*18!+16*17!+2*16!+...) converted to base 256, and more than a year if it doesn't run out of memory. \$\endgroup\$
    – lirtosiast
    Commented Dec 30, 2015 at 22:18
  • \$\begingroup\$ Just an idea, but maybe instead of only outputting the first 20 numbers, we output all possible dart-scores in that same clockwise rotation, going inward in terms of doubles, singles, triples, singles, and bull. So the output would be this instead. Still not too hard, but somewhat more interesting to golf. \$\endgroup\$ Commented Jun 27, 2019 at 9:33
  • \$\begingroup\$ PS: Your current challenge is 16 bytes in 05AB1E with two alternative approaches: compressed list or n'th permutation (second could be 1 byte shorter by changing A to 9 and removing < if digits were allowed). \$\endgroup\$ Commented Jun 27, 2019 at 9:34
2
\$\begingroup\$

Draughts KOTH

Definitely will be a fun KOTH, but I don't have the time or energy to write up the controller, so I'm giving it up to whoever wants to take it over.

\$\endgroup\$
1
\$\begingroup\$

Stitch a Picture

I think this is an interesting idea, but the comments seemed to indicate that this is a lot harder to solve than I had anticipated. Perhaps it can be modified somewhat to make it reasonably solvable.

\$\endgroup\$
4
  • \$\begingroup\$ I want to take this one. \$\endgroup\$
    – Xwtek
    Commented Dec 31, 2015 at 23:59
  • \$\begingroup\$ I actually am taking this one and posting again in sandbox \$\endgroup\$
    – user63187
    Commented May 16, 2017 at 15:11
  • \$\begingroup\$ @Christopher Please post a link if you did. And if you did, you should comment on the original one so it gets deleted. We don't need duplicates. \$\endgroup\$
    – mbomb007
    Commented Jun 5, 2017 at 21:26
  • \$\begingroup\$ codegolf.meta.stackexchange.com/questions/2140/… \$\endgroup\$
    – user63187
    Commented Jun 5, 2017 at 23:20
1
\$\begingroup\$

Do-nothing Polyglot

I think this one is pretty awful. But perhaps there is something to be salvaged.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Why do you think it is awful? \$\endgroup\$
    – TanMath
    Commented Dec 25, 2015 at 21:41
  • \$\begingroup\$ @TanMath Perhaps "awful" is too strong of a word. My concern is that in its current state, it would probably be closed as unclear AND too broad. But perhaps with the right editing/sandboxing it can be fixed... \$\endgroup\$ Commented Dec 26, 2015 at 18:10
  • 1
    \$\begingroup\$ I plan to take this one... would a scoring based on the versatile integer printer challenge be good? \$\endgroup\$
    – TanMath
    Commented Dec 28, 2015 at 15:58
  • \$\begingroup\$ @TanMath I assume this is the challenge you're referring to \$\endgroup\$ Commented Dec 28, 2015 at 18:57
  • \$\begingroup\$ yes! that is the challenge I mean. \$\endgroup\$
    – TanMath
    Commented Dec 28, 2015 at 20:33
1
\$\begingroup\$

This is a quick-and-dirty handmade ASCII art of our new logo.

Feel free to use it, either as-is or as a basis for something better. Maybe there's something interesting to do with it... or maybe we just have enough / challenges.

   .##   ###########   ##.
  '#'   ## ####### ##   '#.
  ##   ###         ###   ##
  ##  #####       #####  ##
  ##   #####     #####   ##
  ##    #####   #####    ##
  ##     ##### #####     ##
 .#'      ### #####      '#.
<#+        # #####        +#>
 '#.        .===.        .#'
  ##      +" +++ "+      ##
  ##     # .#####. #     ##
  ##    # +#######+ #    ##
  ##    # +#######+ #    ##
  ##     # '#####' #     ##
  .#.     +, +++ ,+     .#'
   '##      '==='      ##'
\$\endgroup\$
1
\$\begingroup\$

Tower Defense (Abandoned)

Anyone is free to take over this challenge and fork as necessary. Just give me credit ;)


Tower Defense Example

View it here | Chat

Tower Defense is a format for casual games that was popularized in the Flash era. The player places towers that shoot down invaders moving along a predefined path.

Overview

Two submissions will compete against each other to invade the other player's village without being invaded themselves. They will have the ability to place towers, upgrade them, and spawn invaders to attack the enemy village. The game will be simulated deterministically in a turn based fashion, with each player being able to do one action each turn.

The game board is made up of two paths, each 100 spaces long. Each player begins with 500 gold, which is used for building towers and spawning invaders; and 100 life. Your objective is to bring your opponent's life down to 0. If neither player has been defeated after 100000 turns, the winner will be the player with the most life at that point, with ties being broken by who has the most gold at that point. If, somehow, there is still a tie, the match will be considered a tie.

Income

Every 10 turns, players will receive gold. Initially, they receive 10 gold, but this amount increases by 3 every 100 turns.

Each time you successfully get an invader through your opponent's defenses, your income increases by 1 and you receive a portion of your income proportional to how much HP the invader had left.

Each time one of your towers defeats an invader, you receive gold. (More on that below)

Towers

Each space on the path can house one tower. There are 3 types of towers, which have a range and a power. It takes 10 turns for a tower to be ready after it is built. Towers can be upgraded either with a wider range or an increased power, in increments of 1. There is no hard limit to how many times a tower can be upgraded.

Range refers to how many spaces away from the tower that can be reached by the tower's abilities. A range of 0 means that only the space that the tower is on is affected by the tower's attacks.

Power has a different meaning depending on the kind of tower.

Turrets

Each turn, turrets fire at the invader within range that is farthest along the path to your village. They deal damage equal to the tower's power.

Turrets begin with a range of 1 and a power of 1.

Stunners

Stunners fire at the invader within range that is farthest along the path to your village. However, instead of dealing damage, they stun the invader for a number of turns equal to the tower's power. After firing, stunners cannot fire again for their power + 1 turns. Stunners will not fire at invaders that are already stunned.

Stunners begin with a range of 0 and a power of 3

Bombs

When an invader is on the same space as the bomb tower, it triggers and deals damage equal to its power to all invaders within its range. After being triggered, it cannot fire again for another 5 turns.

Bombs begin with a range of 2 and a power of 2

Invaders

Each turn, you may spawn an invader. At minimum, it costs 10 gold and has a base HP of 10. You can spend additional gold to increase its power:

  • (1G) +1 HP
  • (10G) +1 Defense (reduce damage taken by 1, but not lower than 1)
  • (10G) +1 Stun resistance (reduces stun time by 1 turn)

You are limited on the maximum stats. You start off unable to boost stats, but every 100 turns, the maximum increases by 5

There can only be one invader on each space of the board and invaders cannot pass through each other. You cannot spawn an invader if there is already an invader on the first space of the board. Therefore, a potential counterplay from defenders to prevent massive hordes of invaders is to put stunners on the first few spaces.

Coding

The main game / AI driver is here (still a work in progress)

Submission logistics TBD

Both players will have complete knowledge about the state of the game and will be allowed to maintain state from the beginning of the game. They may not directly modify the game state. Any attempts to do so will be disqualified as will any attempt to obfuscate such an attempt.

(api description will go here)

Defenders should return an object with an action property that is either 'build', 'upgrade', or 'destroy'. Each requires some additional properties to be set: (will add later)

Invaders should return an object which contains any stat boosts desired: hp, defense, and stunRes.

Both defenders or invaders may also return undefined or null to indicate not taking an action.

AIs must return their desired action in less than 10 milliseconds, averaged over 100 turns. Invalid actions returned by the AI will be ignored.

Scoring

All submissions will compete against all other submissions in a round-robin tournament. The bot that wins the most matches is declared the winner. In the event of a tie, the number of turns it took to win will be totaled for all winning matches with the smallest cumulative turn count to victory wins. In the unlikely event of a further tie, the turns to loss will be totaled for all losing matches and the bot with the highest cumulative turn count to loss wins.

Only one submission per user can be scored in the round-robin tournament.

Rules

  • No abusing standard loopholes
  • No direct modification of the game state passed to you. It will not be defensively deep-copied. Don't obfuscate your code to try to hide state modification.
  • Any uncaught exceptions will result in disqualification.
  • Implementations must be totally deterministic, i.e. random number generators are only allowed if seeded consistently (either with a constant or with game state) and must use isolated random state which the other AI in play cannot access.
  • Submissions shall include an explanation of the AI's strategy.
\$\endgroup\$
1
\$\begingroup\$

xnor's hoard

I have a bunch of old Sandbox posts that I don't feel like developing, some of which have a number of upvotes. Feel free to edit and post them. I just ask that you ping me before you post in case I have suggestions.

\$\endgroup\$
0
\$\begingroup\$

Crazy Librarian's Interesting Numbers Game

A card game between two bots. Interesting premise, got a couple of quick upvotes, and KOTHs are generally pretty well-received. I've just realized that I don't have the time to actually put a controller together and run a tourney, and that lack-of-time doesn't look to have changed in the past year. So ... donation time!

\$\endgroup\$
0
\$\begingroup\$

Is the string ASCIIbetically ordered?

Seems interesting, but I am not sure if it's a dupe or not.

\$\endgroup\$
0
\$\begingroup\$

Who is the winner?

I like the idea of this but I am finding it difficult to write a spec. So if anyone can come up with a better way to run this, please, go ahead!

\$\endgroup\$
0
\$\begingroup\$

Tell me my vocabulary words!

I personally really like this challenge idea but no one has really understood what I want from it yet, so if you can write a better spec for it than I, go right ahead!

\$\endgroup\$
0
\$\begingroup\$

Hope you don't mind me posting this here instead of linking to the sandbox post - it's more of a rough idea than something I could even begin to make a formal writeup for.

I just came up with this idea recently, but don't have the patience to work out objective rules, or even the input format.

Essentially, I recently saw Tom Scott's video on the way the internet has taken over grammatical structures, such as punctuation and capitalisation, to give them a much more complex meaning that can almost convey all of the intonation and registers we use in normal, verbal conversation. So, I thought that some sort of challenge, that takes an input somehow describing the intentions of a post (e.g "this sentence is a rhetorical question", "I'm talking formally now", "put emphasis on this phrase"), can convert it into 'internet format', using just the few examples of rules that are used in the video.

Alternatively, you may want to reverse the challenge, and make an internet-speak decoder.

Some potential ideas for input format:

  • A nested object, consisting of different parts, arranged in literal order (the order they appear in the sentence). This would be a good challenge. The parts are separated according to where new info needs to be introduced, so you may have something like:
...
{
  type: "sentence",
  contains: [
    {
      type: "phrase",
      text: "And how are"
    },
    {
      type: "phrase",
      text: "you",
      emphasis: true
    },
    {
      type: "phrase",
      text: "today?"
    }
  ],
  ...
}
...
  • Potentially, it could take audio input along with a transcript, so it needs to detect intonation too. This could potentially be used in a challenge, where the number of layers/weights, as well as the accuracy, all contribute to a final score.

In the case you decide to use the reverse (decoding) challenge idea instead, simply inputting Internet-speak and outputting normal English will do too.

\$\endgroup\$
-9
\$\begingroup\$

C Compiler

Implement a basic C Compiler.

You do not need to implement the libraries. Compiler would output an object file containing a function, that would be linked with some libraries using GNU binutils ld and run.

No function calls, unions, structs, casts will be used in the test cases.

Test case:

int test(int i, int j) {
  int x[10][20];
  int i, j = 0, s = 0;
  for(i = 0; i < 10; i++)
    while (j < 20)
    {
      j += 1;
      x[i][j] = i * j;
    }
  for(i = 0; i < 10; i++)
    while (j < 20) {
      s += x[1][j];
    }
  return s;
}

\$\endgroup\$

You must log in to answer this question.

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