I challenge thee to a duel!
Please note that this is an experimental challenge idea. Constructive criticism is welcomed
Duels (on this site) are a type of competition between two people to perform a certain challenge is the shortest code they can. Your task is to duel a partner.
How this will work
You are to choose three things:
- A partner. You may choose anyone willing to be your partner, and they have to agree, but beyond that, there are no other restrictions.
- Between the two of you, you should choose a free (as in beer) language, with a publicly available interpreter (such as one on TIO). It must also be capable of primality testing and adding two integers.
- Also between the two of you, decide on a time limit for creating and golfing your submissions. Time periods can be up to 2 weeks, to prevent this challenge going on for years.
Once you have a partner and a language, you are to duel! You should aim to complete one of the below tasks in the lowest byte size possible, without revealing your bytecount. After you both believe your solutions are optimal (or the time period is about to finish), you should each post an answer (more detail below) containing the following information:
- Language used
- Length of your program
- MD5 hash of your program
- Who you were duelling, along with a link to their answer
What happens next
After you've both posted answers (as simultaneously as possible), your next action depends on who has the shorter answer:
- If you have the shorter answer, you should attempt to golf your answer even more without revealing your code. Take advantage of the time you have and find as many golfs as possible.
- If you have the longer answer, you should reveal your answer to your partner (and everyone else), and attempt to make your code shorter than your partner's, with help from people who know how to golf in the language (therefore choosing popular languages is more likely to help you golf more)
- If your codes are the same length (or have the same hash), reveal them both, and try to golf them as much as possible.
The winner (between the two of you) is the user who has the shorter code by the end of the time period. The overall challenge winners are the pair who have the highest score, when score is defined as the sum of the scores (upvotes minus downvotes) of each person in the pair's answer.
If you fail to post an answer within the time limit, there are two options:
If your partner did complete the program (but couldn't post an answer as you hadn't finished), then they should post their answer with a note saying that you couldn't complete your program in time.
If neither of you completed the task, then you can either choose a new language and try again, choose a new partner and try again, or just not post an answer at all.
Whether you finish in the time period or not, you shouldn't post an answer claiming to be 'non-competing' for whatever reason
Please vote regarding these criteria:
- Language used. Using a language such as Python can be (not always) easier than using Jelly for someone who has never used the language before, especially for some tasks.
- Amount golfed. Very obviously, an answer that golfs 100 bytes off in a never-before-used language is more impressive than golfing 5 bytes, but please keep the language and task in consideration. 100 bytes in C# isn't as difficult as 2 bytes in Husk.
- Time period. Creating your first 05AB1E answer in 1 hour is very obviously more impressive than taking 2 weeks to do the same task.
- Task chosen. Some of the below tasks are harder the others, and your votes should reflect that.
Please don't vote on the users and their partners. This should really need to be said, but you shouldn't upvote or downvote a given solution just because a high-rep user in one of the pair. An answer done by Dennis should be considered by the same criteria as an answer done by a new user.
Sandbox note: I am aiming for 6 challenges over varying difficulty, so that users don't have to jump in the deep end. I am also hoping to have a variety of tags (string, math, quine etc.) Feel free to suggest ideas or improvements
You and your partner should decide between you on a task from this list of 6:
Given a net of a cube, output it's 3D representation. The cube will always have a side length of 2. Example input:
l, output all positive integers less than
l which satisfy the equality
n = r % x where
r is an arbitrary positive integer.
n = 3, x = 5, l = 20 should output
[3, 8, 13, 18]
Given an array of integers representing Roman Numerals mapped to their Arabic equivalents (
MMCXV => [1000, 1000, 100, 10, 5]), output the array converted as though it were Roman numerals. Subtractive notation should be used. For example, for the above example, the result would be
IXCCMCI would map to the array
[1, 10, 100, 100, 1000, 100, 1] which would become ``. You may assume that the increments between values never oscillate (i.e the list will be sorted in ascending value until the maximal amount, the descending until the end of the list, like so:
[1, 5, 10, 5, 1])
Given a string as input, determine what case it's in. The cases you have to handle are uppercase (
LIKE THIS), lowercase (
like this), title case (
Like This) and sentence case (
Like this). You don't have to handle cases which are none of the case (
How to answer
Once you and your partner have completed your programs, you should make one of you Player A and the other Player B. Player A then posted their answer to the thread entitled: "I challenge thee to a duel - Player A", and Player B should post to the Player B thread.
You should (preferably) answer in the following format:
# [Language], [Length] bytes
I duelled with [opponent] over a period of [time limit]. Their answer is [here] and we attempted task [task number]
After having golfed your answers, and revealed your final solutions, please edit in your new bytecount, keeping your original, and your final code. Also consider adding your original code, if you can.
Just to reiterate, you are competing as a pair. The pair with the highest score a month after this is posted wins. Score is defined as the number of upvotes on both answers, minus the number of downvotes on both.
To my knowledge, this is a brand new challenge type, so I'm really hoping it goes well. If you'd like to give feedback, please make it constructive. The tags I have are
Please feel free to suggest other tags.