577
\$\begingroup\$

This "sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to main. This is useful because writing a clear and fully specified challenge on your first try can be difficult, and there is a much better chance of your challenge being well received if you post it in the sandbox first.

Sandbox FAQ

Posting

To post to the sandbox, scroll to the bottom of this page and click "Answer This Question". Click "OK" when it asks if you really want to add another answer.

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.

Discussion

The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

  • Parts of the challenge you found unclear
  • Comments addressing specific points mentioned in the proposal
  • Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.

Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal, use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

\$\endgroup\$
2
  • \$\begingroup\$ What if I posted on the sandbox a long time ago and get no response? \$\endgroup\$
    – None1
    Commented May 15 at 14:05
  • \$\begingroup\$ @None1 If you don't get feedback for a while you can ask in the nineteenth byte \$\endgroup\$ Commented May 29 at 13:27

4831 Answers 4831

1
24 25
26
27 28
162
3
\$\begingroup\$

Approximate a root of an odd degree polynomial

\$\endgroup\$
2
  • \$\begingroup\$ I've got a couple of answers so vote for to move to main page :p \$\endgroup\$
    – lesobrod
    Commented Feb 18, 2023 at 19:32
  • \$\begingroup\$ The only note: usually \$a_i\$ means coefficient of polinomial \$\endgroup\$
    – lesobrod
    Commented Feb 18, 2023 at 19:45
3
\$\begingroup\$

Whole Number Groups

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Where does 1/7 come from in the second example? \$\endgroup\$
    – chunes
    Commented Feb 17, 2023 at 10:21
3
\$\begingroup\$

Fibonacci Binary Squares

\$\endgroup\$
4
  • \$\begingroup\$ since this is a sequence, can we just use the default sequence rules? \$\endgroup\$
    – naffetS
    Commented Feb 21, 2023 at 1:01
  • \$\begingroup\$ I'd be willing to allow the Fibonacci sequence used to generate the answer to be 0 or 1 indexed, but I don't see the logic in allowing the main "sequence" to be 0 indexed. The rest of the rules I think would be fine. \$\endgroup\$ Commented Feb 21, 2023 at 11:55
  • \$\begingroup\$ Well, some languages use zero-indexing for arrays, and some use one-indexing, so it can help. \$\endgroup\$
    – naffetS
    Commented Feb 21, 2023 at 17:20
  • \$\begingroup\$ Fair. Changed it to allow for 0- or 1- indexing. \$\endgroup\$ Commented Feb 22, 2023 at 1:35
3
\$\begingroup\$

"Candy Crush" a string

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Suggested test case: 1322232223222311 -> (1332223222311 -> 1333222311 -> 1222311 ->) 1311. Since you mention you reiterate after every replacement from left to right again (well done for making that bold). :) If one would filter out all blocks of 3+ at once, it would incorrect result in -> 1333311 -> 111 -> "". Good challenge overall, so +1 from me. And welcome to CGCC. \$\endgroup\$ Commented Feb 21, 2023 at 12:19
  • \$\begingroup\$ @KevinCruijssen Thank you for your feedback! I added your test case to the list :) \$\endgroup\$
    – Fhuvi
    Commented Feb 21, 2023 at 12:43
3
\$\begingroup\$

Help Me Type on My New Keyboard

\$\endgroup\$
12
  • \$\begingroup\$ In the 5th test case first letter of output must be r not p \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 20:36
  • \$\begingroup\$ It is very hard to read q as я... can we remove this rule? :) I'm not expert but I have never seen that Russians use q as я \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 20:41
  • \$\begingroup\$ JFYI they widely use 4 as ч, so if you want you also can add this rule \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 20:44
  • \$\begingroup\$ @EzioMercer 1. Thanks. My english kicked in. for 2. and 3. this is the specific keyboard layout im using. most mnemonic layouts ive used use q as я \$\endgroup\$
    – Seggan
    Commented Feb 20, 2023 at 20:48
  • \$\begingroup\$ Your task your rules :) Also please remove additional space after second word in 5th test case \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 20:51
  • \$\begingroup\$ @EzioMercer read the comments after the test case: note the double space after "chtec". its required because c is a combining letter \$\endgroup\$
    – Seggan
    Commented Feb 20, 2023 at 20:54
  • \$\begingroup\$ And the last question :) Are you sure about these rules: "e" -> "е", "je" -> "э" and "ye" -> "э"? The letter j uses for я,ё,ю because in their pronunciation we have й at the start. я - йа, ё - йо, ю - йу and the same thing for letter е - йэ, so it is logical to have the these rules: "je" -> "е", "ye" -> "e" and "e" -> "э" \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 21:02
  • \$\begingroup\$ About c you already have the rule "c" -> "ц" you don't need any additional space after it \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 21:03
  • \$\begingroup\$ @EzioMercer yes im sure. i know it seems weird. for the second comment, note To type the single letters mapped to them, either press that key and then press space \$\endgroup\$
    – Seggan
    Commented Feb 20, 2023 at 21:05
  • \$\begingroup\$ You have weird keyboard :) \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 21:06
  • \$\begingroup\$ In 5th test case xepdyami -> xerdyami - change the p to r \$\endgroup\$
    – EzioMercer
    Commented Feb 20, 2023 at 21:08
  • 1
    \$\begingroup\$ @EzioMercer aargh the challenges of being bilingual :P \$\endgroup\$
    – Seggan
    Commented Feb 20, 2023 at 21:10
3
\$\begingroup\$

Largest Binary Area

\$\endgroup\$
1
  • 2
    \$\begingroup\$ You may want to clarify that each column in ASCII art is a binary number. I had to read it a couple times before that was clear to me. Writing it out might probably be even clearer (e.g. "Take the sequence of all natural numbers in binary: [1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,...]. Displaying each of these binary numbers as reversed columns gives: <insert current ascii-art here>") Apart from that the challenge is clear; nice challenge btw! I'm curious what kind of algorithms can be found instead of actually calculating the areas. \$\endgroup\$ Commented Feb 28, 2023 at 12:51
3
\$\begingroup\$

Calculate the p-adic square root of -1

Given a prime number \$p\$, a \$p\$-adic number is a number whose representation in base \$p\$ may have infinitely digits to the left of the radix point, but only finitely many digits to the right of it. A \$p\$-adic integer has no digits after the radix point.

\$p\$-adic numbers have some interesting properties. It can be proven that for any prime number \$p\$, there exists a \$p\$-adic integer \$x\$ such that \$x^2 = -1\$ if and only if the congruence \$x_0^2 \equiv -1 \pmod{p}\$ has a solution. (That is, there is some integer \$x_0\$ such that \$x_0^2 + 1\$ is divisible by \$p\$.)

Your task is to determine whether this is the case and calculate the digits of the number \$x\$. Note that there will always be two solutions which are additive inverses of each other; you only need to calculate one.

Input

A prime number \$p \ne 2\$. (You don't need to verify that it's prime.)

Output

Find the digits of the \$p\$-adic square root of \$-1\$, as described above. Following the standard sequence rules, do one of the following:

  • Given an index \$i\$, output the \$i\$-th digit from the end. Since base representations are naturally 0-indexed, you may not use 1-indexing.
  • Given a positive integer \$n\$, output the last \$n\$ digits. You can choose between little-endian and big-endian.
  • Output all digits in the form of a non-halting program, a generator, an infitite lazy list, etc.

If the \$p\$-adic square root of \$-1\$ does not exist, do anything that can be clearly distinguished from a valid output, such as raising an exception or returning an empty list.

Algorithm

Here I describe one possible way to solve this challenge.

  • Find a number \$x_0\$ between \$0\$ and \$p-1\$ such that \$x_0^2 \equiv -1 \pmod{p}\$. If not found, report failure.
  • Find a number \$y\$ between \$0\$ and \$p-1\$ such that \$2x_0y \equiv 1 \pmod{p}\$. (This is always possible.)
  • Let \$c_0 = \left\lfloor\frac{x_0}{p}\right\rfloor\$.
  • For each positive integer \$i\$:
    • Let \$h_i = c_{i-1} + \sum_{j=1}^{i-1} x_j x_{i-j}\$.
    • Let \$x_i = (p-1-h_i)\cdot y \bmod p\$.
    • Let \$c_i = \left\lfloor\frac{h_i + 2 x_0 x_i}{p}\right\rfloor\$.
  • The sequence \$\left(x_i\right)\$ is the output.

Ungolfed Python implementation:

def sqrt_minus_one(p, n):
    for x in range(p):
        if (x * x + 1) % p == 0:
            last_digit = x
            break
    else:
        return None # no solution
    for x in range(p):
        if (x * 2 * last_digit) % p == 1:
            inv = x
    digits = [last_digit]
    carry = (last_digit * last_digit) // p
    for i in range(1, n):
        h = sum(digits[j] * digits[i - j] for j in range(1, i)) + carry
        digits.append((p - 1 - h) * inv % p)
        carry = (h + 2 * last_digit * digits[i]) // p
    return digits

It's also possible to use a brute-force approach where you find an \$n\$-digit number \$x\$ such that \$x^2 + 1\$ ends with \$n\$ zeroes in base \$p\$. I suppose this could lead to much golfier solutions, so maybe I should make the challenge restricted-complexity to forbid this?

Test cases

  p | first 20 digits (two possible outputs)
  3 | ---
  5 | 2,1,2,1,3,4,2,3,0,3,2,2,0,4,1,3,2,4,0,4
    | 3,3,2,3,1,0,2,1,4,1,2,2,4,0,3,1,2,0,4,0
  7 | ---
 11 | ---
 13 | 5,5,1,0,5,5,1,0,1,8,8,6,12,6,3,0,4,7,4,5
    | 8,7,11,12,7,7,11,12,11,4,4,6,0,6,9,12,8,5,8,7
 17 | 4,2,10,5,12,16,12,8,13,3,14,0,6,1,0,15,1,8,14,5
    | 13,14,6,11,4,0,4,8,3,13,2,16,10,15,16,1,15,8,2,11
 47 | ---
101 | 10,5,29,66,10,30,44,29,72,25,34,82,83,5,52,17,67,94,65,52
    | 91,95,71,34,90,70,56,71,28,75,66,18,17,95,48,83,33,6,35,48
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Perhaps allow assuming a square root of -1 exists? Testing for the existence of it isn't too related to finding it \$\endgroup\$ Commented Mar 17, 2023 at 12:21
3
\$\begingroup\$

Is it traversable?

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

Implement the <=> three-way comparison operator on numbers

Tags:

\$\endgroup\$
4
  • \$\begingroup\$ How do the bonuses stack? Is the final score (100-n)% of the program length, or 0.99^n? \$\endgroup\$
    – Bbrk24
    Commented Mar 17, 2023 at 15:13
  • 1
    \$\begingroup\$ @Bbrk24 just edited the bonuses bit; if your solution is n bytes, and your solution supports k numeric types, your score is (100-(k-1)%) * n. \$\endgroup\$
    – bigyihsuan
    Commented Mar 17, 2023 at 15:26
  • \$\begingroup\$ The bonus disadvantages languages with less number types, and seems non-observable. Additionally, in many languages you would have a solution which works for any comparable type, which can be user-defined. How would you define number types in that case? Regardless, bonuses are usually recommended against. \$\endgroup\$ Commented Mar 18, 2023 at 8:06
  • 4
    \$\begingroup\$ Axed the bonuses. \$\endgroup\$
    – bigyihsuan
    Commented Mar 18, 2023 at 15:05
3
\$\begingroup\$

Qat Equation Solver

\$\endgroup\$
2
  • \$\begingroup\$ I think you should include both . and brackets, since they both add more power without being cumbersome. For example, I can't see how to express A=(.);B=aAt;C=aAe without using both of these. \$\endgroup\$ Commented Mar 23, 2023 at 8:31
  • \$\begingroup\$ @CommandMaster In that specific case, it could be expressed as B=a.t;B=aAt;C=aAe, but that makes me realize I should specify you can have more than one equation referencing the same variable I suppose \$\endgroup\$ Commented Mar 23, 2023 at 14:10
3
\$\begingroup\$

Record Least Uncommon Multiple Counts

\$\endgroup\$
2
  • 2
    \$\begingroup\$ You probably meant \$\frac{\text{lcm}}{\text{gcd}}\$, the other way around is less than 1 \$\endgroup\$ Commented Mar 23, 2023 at 15:49
  • 1
    \$\begingroup\$ Good catch. I did \$\endgroup\$ Commented Mar 23, 2023 at 16:10
3
\$\begingroup\$

Rendevous!

Your bots went to the mall together, but they got lost! Worse, they didn't agree on any strategy to find one another again.

Here's what they do know:

  • There are \$n\$ stores, and bots can only meet each other in the stores.

  • Each time step, each bot must choose one store to be in.

  • Two bots go to the mall simultaneously. Their score for the outing is the number of time steps it took for them to find one another.

  • The mall closes after \$n^2\$ time steps. If some bots are still at the mall, they will receive a score of \$n^2+1\$.

Bots must be written in Javascript. Your bot must be a generator function, receiving a single input \$n\$ (the number of stores) and output at least \$n^2\$ integers in the range \$[0..n-1]\$. Your bot's score will be the average of its scores when played with all of the other bots.

The stores will be scrambled - what is room 1 for one bot may be room 5 for another. There will be many rounds of the game (1000 right now, but if there are lots of entries and it takes longer than an hour, I may lower that number), and each round will be a round-robin with a set number of stores. \$n\$ will be in the range \$[4..25]\$.

There are better and worse strategies, but optimal strategies (when symmetric) are only known for \$n=2\$ and \$n=3\$. An example bot (which will be playing):

function* randomSearchBot(n){
  while (true){
    yield Math.floor(Math.random() * n);
  }
}

Here is the controller:

function shuffle(array) {
    for (let i = array.length - 1; i > 0; i--) {
        let j = Math.floor(Math.random() * (i + 1));
        [array[i], array[j]] = [array[j], array[i]];
    }
}
function runRound(bot1, bot2, n){
    let b1 = bot1(n), b2 = bot2(n);
    let stores = Array(n).fill(0).map((_, i) => i);
    shuffle(stores);
    let turn = 0;
    while (turn++ < n ** 2){
        if (b1.next().value == stores[b2.next().value]) break;
    }
    return turn;
}
function runAllRounds(...bots){
    const nameLength = Math.max(bots.map(b => b.name));
    bots = bots.map(b => {
        return {
            bot: b,
            totalScore: 0
        };
    });
    const rounds = 1000;
    let round = rounds;
    const pairs = bots.map((b, i) => bots.slice(i + 1).map(w => [b, w])).flat();
    while (round--){
        const n = Math.floor(Math.random() * 22) + 4; // [4..25]
        for (let [a, b] of pairs) {
            const score = runRound(a.bot, b.bot, n);
            a.totalScore += score;
            b.totalScore += score;
        }
    }
    bots.forEach(b => {
        b.totalScore /= rounds * (bots.length - 1);
        console.log(b.bot.name.padEnd(nameLength) + ": " + b.totalScore.toFixed(5));
    });
}

The main feedback I'm looking for here is whether people think there's a big enough strategy space for it to be worth playing.

\$\endgroup\$
4
  • \$\begingroup\$ Ideally submissions would include the title and tags \$\endgroup\$ Commented Mar 30, 2023 at 10:56
  • \$\begingroup\$ When the bots are different I'm almost 100% one outputting a fixed output and the other outputting a permutation is optimal. \$\endgroup\$ Commented Mar 30, 2023 at 18:56
  • \$\begingroup\$ If both bots output random permutations I believe the expected score is around \$ \frac e{e-1}n \$. \$\endgroup\$ Commented Mar 30, 2023 at 19:08
  • 1
    \$\begingroup\$ I believe it is exactly \$ n+1 - \frac{ !(n+1) - n\cdot !n}{n!-!n} \$, or approximately \$ n + \frac{e-2}{e-1}\$, so it's ever so slightly worse than random search bot. \$\endgroup\$ Commented Mar 30, 2023 at 19:44
3
\$\begingroup\$

Shortest distinguishable slice (posted)

\$\endgroup\$
6
  • \$\begingroup\$ ime, it's more common to express ranges as [start, end + 1) rather than [start, end] -- that's what most C++ STL functions do, for example. Would that be accepted here? \$\endgroup\$
    – Bbrk24
    Commented Apr 2, 2023 at 3:18
  • 1
    \$\begingroup\$ @Jacob what I think Bbrk24 meant was that in a lot of languages, "abcdef"[1:4] would be bcd not bcde (Try it online!). Obviously it's your challenge, your rules, but IMO it might be worth allowing this format of slices as the output instead. \$\endgroup\$
    – The Thonnu
    Commented Apr 2, 2023 at 8:16
  • \$\begingroup\$ I'm pretty sure it's [start, end) not [start, end + 1) since the latter is the same as [start, end]. \$\endgroup\$
    – The Thonnu
    Commented Apr 2, 2023 at 13:25
  • 1
    \$\begingroup\$ @TheThonnu Yeah you are right, fixing now \$\endgroup\$ Commented Apr 2, 2023 at 13:28
  • \$\begingroup\$ Now this part requires fixing (or removing): A slice can also be 1 character long if the two indices are equal. \$\endgroup\$
    – pajonk
    Commented Apr 3, 2023 at 6:01
  • 1
    \$\begingroup\$ @pajonk Oh, duh. This is why the sandbox is so useful lol \$\endgroup\$ Commented Apr 3, 2023 at 11:13
3
\$\begingroup\$

How super is this prime?

Posted here

\$\endgroup\$
2
  • \$\begingroup\$ To me, this sounds like functions are disallowed - is that intentional? \$\endgroup\$ Commented Apr 6, 2023 at 19:45
  • \$\begingroup\$ @CreativeName No; I'll edit it \$\endgroup\$
    – Lecdi
    Commented Apr 6, 2023 at 21:44
3
\$\begingroup\$

The Jaccard Index

\$\endgroup\$
2
  • \$\begingroup\$ Could you add a bit more explanation for those of us who haven’t studied set theory? \$\endgroup\$ Commented Apr 6, 2023 at 11:18
  • 1
    \$\begingroup\$ @Jacob I added some historical background, a revised explanation and a few links for the set theory operations. Let me know if I missed something. Thanks. \$\endgroup\$
    – solid.py
    Commented Apr 6, 2023 at 13:00
3
\$\begingroup\$

Calculate Bloons RBE Equivalent

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

International Resource Trading KOTH

Your country wants to reach Mars, and do it as cheaply as possible. While you can produce all required resources domestically, other countries can produce them cheaper and trading can drastically reduce both your costs.

Goal of the game

There are 10 resources, numbered 1-10. You need 1,000 of each resource to build a rocket and colonize Mars.

The cost of each rocket is different for each player though. One will cost €10, one €20, €30, ... and the last costs €100 per unit. This number is different for every bot, for example resource 1 could cost €20 for one but but €90 for a different bot.

Without trading, the rocket would cost €550,000. But if you import resources that are expensive for you to produce, and sell resources that are cheap for you to produce. If you do it right, you can make the process massively cheaper or even potentially make a profit and still launch your rocket.

The game loop

The game consists of 7 rounds. Each round has 2 phases.

The first phase is the production phase. Each bot can choose to produce some number of resources locally. The total limit for how much you can produce is 10 the first round, 20, 40, 80 ... 1280 in the last round. Bots can choose to divide their production among every resource. For example, you can buy 6 of resource A and 4 of resource B in the first round. Money will be subtracted from your score proportional to the value the resource has for you.

The second phase is the trading phase. In turns, every bot has the option offer a trade. Then other bots can choose to accept the offer or to create a counteroffer. Then the bot may choose to accept any of the counteroffers or reject all of them.

Trades can either be money for resources or resources for money. You can't trade resources for resources directly.

There are 3 rounds of trading for every production phase.

If the game ends before you collect enough to launch your rocket, the rest of the resources will be produced domestically and cost you the domestic production price.

Example bot

class PriceBelowHalf:
    """
    Will only buy resources if the price is less than half the local production price
    Will only sell resources if the price is more than double the local production price
    """

    def __init__(self, bot_ids: list[int], resource_prices: dict[int, int], rng):
        # Randomness only allowed via the provided RNG.
        self.bot_ids = bot_ids
        self.resource_prices = resource_prices

    def production_phase(self, max_production: int, resources: dict[int, int]):
        # produce the maximum amount of the cheapest resource
        return {min(self.resource_prices, key=lambda i:resource_prices[i]): max_production}
    
    def trade(self, resources: dict[int, int]):
        # Offer to buy the resource we have the least of for half it's price
        resource = min(resources, key=lambda i:resources[i])

        # 2 item tuples are treated as resources, single integers are treated as money
        # First element is what you get, second is what you want to give
        return [(resource, 10),
                self.resource_prices[resource]*5]

    def trade_offer_accepted(self, resources: dict[int, int], counteroffers: list):
        for counteroffer in counteroffers:
            # Accept the first counteroffer that is a good deal
            if isinstance(counteroffer[0], tuple) and \
               counteroffer[0][1] * 2 > self.resource_prices[counteroffer[0][0]] * counteroffer[1]:
                return counteroffer

    def trade_offer_received(self, trade_offer: list, resources:dict[int, int]):
        # If you return a offer in the same format it would be treated as a counteroffer
        # Counteroffer must be for the same resource but you may change both the amount of money and the amount of the resource
        # If you want to unconditionally accept simply `return trade_offer`
        # If you return None you will reject the offer
        # third element of the trade offer is the bot that offered it

        # they want to give a resource for money
        if isinstance(trade_offer[0], tuple):
            # Must be greater than 2:1 ratio to our own price
            return [[counteroffer[0][0], counteroffer[0][1]],
                    # Pay half price or the other bot offered, whatever is cheaper
                    min(
                        self.resource_prices[counteroffer[0][0]] * counteroffer[0][1]] // 2,
                        trade_offer[1]
                    )
            ]
        else:
            # They want to give money for our resources, so we need to check if we have enough
            if resources[trade_offer[1][0]]>=trade_offer[1][1]:
                return [
                    max(
                        trade_offer[0],
                        self.resource_prices[trade_offer[1][0]] * trade_offer[1][1]
                    ),
                    trade_offer[1]
                ]
 

Extra Rules

  • No IO
  • No RNG except via the provided seeded PRNG
  • No exploiting the controller
  • No targeting a specific bot or specifically helping one specific bot. Hurting or helping a range of strategies is perfectly fine.
\$\endgroup\$
8
  • 1
    \$\begingroup\$ Suggestion: Use the ¤ generic currency symbol \$\endgroup\$
    – Ginger
    Commented Apr 17, 2023 at 11:53
  • \$\begingroup\$ @Ginger I'd rather not \$\endgroup\$ Commented Apr 17, 2023 at 11:54
  • \$\begingroup\$ Instead, use $, as it’s ASCII \$\endgroup\$
    – Seggan
    Commented Apr 21, 2023 at 19:34
  • \$\begingroup\$ It really isn't a issue for the bots, all math is plain integers. So whether the currency is ASCII doesn't matter at all. I prefer to use € since I'm from europe, but you are free to imagine the currency as pounds or yen or whatever. It really doesn't matter for the challenge. If there are any genuine concerns about the challenge instead of bikeshedding about the currency symbol used I'd love to hear it. \$\endgroup\$ Commented Apr 21, 2023 at 21:34
  • \$\begingroup\$ If multiple bots accept an offer, who gets it? Do all bots see all offers, even ones that have already been accepted? \$\endgroup\$ Commented Apr 24, 2023 at 4:33
  • \$\begingroup\$ Do bots get any info about other bots' production prices? \$\endgroup\$ Commented Apr 24, 2023 at 4:33
  • \$\begingroup\$ @Spitemaster Every bot can choose which counteroffer to accept, and they do not get info on others production prices \$\endgroup\$ Commented Apr 24, 2023 at 5:15
  • \$\begingroup\$ @Spitemaster I'm not sure yet if all bots will see all offers. I like the idea of being able to limit a trade offer to a certain subset of bot as a way to hide information but I'm afraid it would make the game too complex \$\endgroup\$ Commented Apr 24, 2023 at 5:16
3
\$\begingroup\$

Add two real numbers ... probably

\$\endgroup\$
1
  • \$\begingroup\$ @AnttiP The number of inputs which require reading an infinite number of bits like this has measure zero. The solution here is to simply loop forever in the tough cases. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Feb 9, 2023 at 12:42
3
\$\begingroup\$

Complex remainder

Complex remainder can be defined in a similar way to real remainder as \$ y - x \lfloor \frac y x \rfloor \$. However this depends on a suitable complex floor function. There are a number of ways of defining a complex floor function (for at least one of which there has been a previous challenge), but for this challenge I will relax the requirements to the following:

  • Every complex number has exactly one floor which is a Gaussian integer.
  • \$ \lfloor z \rfloor = \lfloor \Re ( z ) \rfloor \$ if \$ \Im (z) = 0 \$.
  • \$ \lfloor z + n \rfloor = \lfloor z \rfloor + n \$ where \$ n \$ is a Gaussian integer.

Note that this implies that \$ \lfloor n \rfloor = n \$ for every Gaussian integer \$ n \$.

Please write a program or function that will perform complex remainder using a compatible definition.

Even if your language supports complex numbers you can choose to input them as separate real and imaginary parts. You can also choose to support only Gaussian integers as inputs and outputs.

If your language has suitable builtins for remainder or floor then you can earn extra brownie points by providing an additional solution that doesn't use them.

This is , so the shortest program that breaks no standard loopholes wins!

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Maybe some test cases? \$\endgroup\$
    – Adám
    Commented May 8, 2023 at 13:27
  • \$\begingroup\$ How about negative numbers? There are, rather famously, multiple ways to give a sign to a remainder involving negative numbers. \$\endgroup\$
    – Adám
    Commented May 8, 2023 at 13:28
  • \$\begingroup\$ @Adám I didn't want to provide test cases as they would assume a certain complex floor function. Also, the use of floor makes the result consistent for negative numbers (i.e. it's like Pascal's mod rather than rem). \$\endgroup\$
    – Neil
    Commented May 8, 2023 at 14:06
  • \$\begingroup\$ How do we demonstrate correctness of a submission? \$\endgroup\$
    – Adám
    Commented May 9, 2023 at 6:36
  • \$\begingroup\$ @Adám Probably showing that (y-y%x)/x is a Gaussian integer and (y+x)%x and (y+ix)%x both equal y%x for multple random test cases would be enough. \$\endgroup\$
    – Neil
    Commented May 9, 2023 at 7:44
  • 1
    \$\begingroup\$ You should probably explicitly say a Gaussian integer is a complex number whose real and imaginary parts are integers to avoid an inevitable comment about it. Similarly, adding your response to Adám's question will probably save you some time. \$\endgroup\$ Commented May 9, 2023 at 21:34
  • \$\begingroup\$ Will there ever be some different floor functions \$f_1\$ and \$f_2\$ both satisfy the requirement but have at least one \$x\in\mathbb{C}\$ that \$f_1(x)\ne f_2(x)\$? What if we change the second requirement into simply \$\lfloor 0\rfloor = 0\$? \$\endgroup\$
    – tsh
    Commented May 11, 2023 at 5:49
  • \$\begingroup\$ @tsh Yes it's quite easy to have different satisfactory floor functions. I do want real modulus to continue to work as expected though. \$\endgroup\$
    – Neil
    Commented May 11, 2023 at 7:00
3
\$\begingroup\$

Given an integer, output an if its English name begins with a vowel (namely it is positive, and its first digit is 8 or it has the form 11 followed by a multiple of 3 digits), and otherwise output a. This is code-golf, so the shortest code in bytes wins.

Test cases

10: a
0: a
8234987: an
110: a
11: an
11234: an
-8: a
-11: a
8: an

Note for the sandbox viewers: in the related question English An or A? the input is an arbitrary word as a string, and in the related question An A , or An An? the article a/an must be placed inside a sentence, properly capitalized. The present question has a more minimalistic input and output.

\$\endgroup\$
3
  • \$\begingroup\$ I feel like this is just arbitrarily adding a change to this challenge, as the answers would be pretty much the same except with the added conversion from integer to cardinal \$\endgroup\$
    – emirps
    Commented May 11, 2023 at 13:10
  • 3
    \$\begingroup\$ @emirps A solution to this could easily shortcut that using the pattern noted in the question body. Although a language with appropriate builtins might find the most direct approach shortest, I'd almost hesitate to call the challenges related at all. In any case, I'd recommend relaxing the output to make this a decision-problem, and possibly also excluding negative numbers from the input. Also, perhaps make it explicit that we don't have to handle octillions :P \$\endgroup\$ Commented May 11, 2023 at 13:47
  • \$\begingroup\$ Good point about the word octillion, although that cannot come up as the first word in the number's name, right? \$\endgroup\$ Commented May 11, 2023 at 23:03
3
\$\begingroup\$

Turn strings into hexagonal spirals!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Should it be hexagon or hexagonal spirals? Confused as an ESL, both sound correct to me. Perhaps they are? \$\endgroup\$
    – pan
    Commented May 11, 2023 at 21:37
  • 1
    \$\begingroup\$ Since you mentioned "You may start the spiral at any of the 6 points you like.", does this mean this would be a valid output for the first example as well? All your test cases and examples start at the top-left corner. As for the question in your comment, I'm not a native English speaker, but I'm pretty sure both hexagon spirals and hexagonal spirals are correct, as well as spirals of hexagons. I see all three used when I randomly google around. \$\endgroup\$ Commented May 15, 2023 at 10:03
  • \$\begingroup\$ @KevinCruijssen Yeah, it would be valid output. I will include it as an example, thanks! I think I will change the title to hexagonal spirals since that's how I'd have said it in my native language, thank you for clarifying. \$\endgroup\$
    – pan
    Commented May 15, 2023 at 10:30
3
\$\begingroup\$

Find the centroid of a spherical polygon on Earth

Given a list of N (latitude, longitude) coordinates in decimal degrees, coord={{lat1,lon1},{lat2, lon2}, ...,{latN,lonN}}, we consider the spherical polygon enclosed by the geodesics connecting successive pairs of coordinates (including the geodesic between the last and first pair of coordinates). We will follow the convention that the enclosed polygon is always to the left as we traverse each geodesic, i.e., the coordinates are given counter-clockwise around the boundary.

Your task is to find the coordinates of the centroid (center of mass) of the spherical polygon (technically, the projection of the centroid onto the surface of the Earth).

For example, the coordinates {{0,0}, {60,0}, {0, -90}} define a spherical triangle with a centroid at {24.5839, -37.5891}:

Simple Example

Specifications and Assumptions

  • Assume a perfectly spherical earth with a radius of 1.
  • At least 3 coordinates will be specified; there could be arbitrarily many. All the coordinates will be distinct and properly define a spherical polygon in counter-clockwise ordering (no crossing geodesics, no zero-area polygons, no lunes, etc.).
  • To avoid edge cases and indeterminate inverse trig evaluations, all given coordinates will be confined to a single hemisphere. Furthermore, you do not need to handle inputs that would result in a centroid at the North or South Pole nor a longitude of +180=-180 degrees. (These would be valid inputs though!).
  • The input format is flexible: list of lists, array, .csv file, etc. The output coordinates of the centroid should be given to at least 3 decimal places in the decimal degree format, but may otherwise be returned as you see fit.

One possible approach

One possible approach is a neat application of Stokes' Theorem, partially illustrated in this stack overflow answer, and is outlined as follows:

  1. Duplicate and append the first pair of coordinates: {{lat1,lon1},{lat2, lon2}, ...,{latN,lonN}, {lat1,lon1}}
  2. Convert these lat/long coordinates to unit vectors in Cartesian (rectangular) coordinates, \$\vec{v_i}\$, \$i=1,...,N+1\$. NB. Latitude is measured in degrees away from equator (\$xy\$-plane) as opposed to the common mathematical convention of measuring spherical coordinates from \$z\$-axis.
  3. Compute the sum \$\vec{c} = \sum_{i=1}^N \frac{1}{2}\cdot \frac{ \vec{v_i} \times \vec{v_{i+1}}}{\Vert \vec{v_i} \times \vec{v_{i+1}} \Vert} \mathrm{ang}(\vec{v_i}, \vec{v_{i+1}})\$ to find the 3D Cartesian coordinates of appropriate moment, where \$\times\$ is the cross-product and \$\mathrm{ang}(\vec{a}, \vec{b})\$ is the angle between vectors \$\vec{a}\$ and \$\vec{b}\$. (Note that \$\mathrm{ang}\$ can return either radians xor degrees, so long as it does so consistently. The choice of degrees vs radians effectively corresponds to a rescaling of the sphere, which is cancelled out in the following normalization step.)
  4. Normalize \$\vec{c}\$ to project the centroid to the surface of the sphere, \$\vec{c}/\Vert \vec{c} \Vert \$.
  5. Convert these Cartesian coordinates to lat/long using inverse trig functions.

Be careful to mind radians vs degrees and inverse trig function ranges within your chosen language. Also, some parts of this given algorithm may or may not be superfluous...

More Test Cases

{{0, 170}, {-90, 0}, {0, -160}} has a centroid of {-32.7795, -175.0000}

{{26.158, -80.326}, {35.803, -78.722}, {36.103, -115.178}, {32.791, -96.81}} has a centroid of {33.9037, -90.7267}

{{52.37, 4.89}, {41.89, 12.5}, {37.98, 23.73}, {46.06, 14.51}, {52.52, 13.38}, {52.26, 21.02}, {60.17, 24.94}} has a centroid of {50.0215, 14.5968}

Rules

E: Sandbox Questions

Any comments on difficulty/question scope? I think the connection with lat/long coordinates on earth is a nice motivation, but about half of my program to generate test cases is purely coordinate conversions. For reference, my very un-golfed program (complete with camelCase function names) is ~500 bytes.

There are certainly ways to make the task simpler or more complex:

  • The easiest version (I think) would be to forget about the earth and lat/long entirely and have a purely geometric question. Inputs and outputs as unit Cartesian vectors.
  • A harder version would not use a spherical earth approximation, but rather require an ellipsoidal earth or even a proper geodetic datum. However, I think this becomes very difficult very quickly--even finding a geodesic on a geoid is hard, let alone the given algorithm requiring proper (numerically approximated) line integrals rather than a sum. Simultaneously, the task would likely become trivial with commercial GIS software. Using a more accurate earth model does significantly impact the centroid coordinates, changing it by up to several degrees for the given test cases.
\$\endgroup\$
3
\$\begingroup\$

Logarithmic incrementation

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Is there precedent in using $x\ast$ for the length of a list? I've always encountered $#x$. \$\endgroup\$
    – RubenVerg
    Commented May 26, 2023 at 13:27
  • \$\begingroup\$ @RubenVerg just thought I’d use that notation. I don’t think it matters. \$\endgroup\$ Commented May 26, 2023 at 13:28
  • \$\begingroup\$ You're also missing an indication for empty lists: either say that they never occur or specify what the value should be \$\endgroup\$
    – RubenVerg
    Commented May 26, 2023 at 13:38
  • \$\begingroup\$ @RubenVerg fixed \$\endgroup\$ Commented May 26, 2023 at 14:28
  • 2
    \$\begingroup\$ actually, f([n, n, n, ..., n]) = n + 1 for any list length, which is even more interesting (and trivially provable) \$\endgroup\$
    – RubenVerg
    Commented May 26, 2023 at 17:01
  • \$\begingroup\$ Can we get some test cases please? \$\endgroup\$
    – The Thonnu
    Commented May 28, 2023 at 13:46
  • 1
    \$\begingroup\$ @TheThonnu test cases have been made. \$\endgroup\$ Commented May 28, 2023 at 15:38
3
\$\begingroup\$

Vanilla Natural Logarithm Challenge

There is a challenge for multiplying two numbers so I guess this counts too

Given as input a positive real number n compute its natural logarithm.

Your answer should be within \$10^{-6}\$ for \$1 \leq n \leq 10\$ and within \$10^{-3}\$ for \$0.1 \leq n \leq 100\$. You don't need to handle numbers outside this range.

See this thread on mathematics.se for various approaches to this problem. Just for inspiration, feel free to use a method not on that page.

Using builtins for logarithms is discouraged but not forbidden. Consider marking your language as "community wiki" if you just use a builtin.

Test Cases

x ln(x)
0.1 -2.3025850929940455
0.25 -1.3862943611198906
0.5 -0.6931471805599453
0.75 -0.2876820724517809
0.9 -0.10536051565782628
1.0 0.0
1.3 0.26236426446749106
2 0.6931471805599453
2.718281828459045 1.0
3.141592653589793 1.1447298858494002
4 1.3862943611198906
5 1.6094379124341003
7 1.9459101490553132
10 2.302585092994046
53 3.970291913552122
54.59815003314423 4.0
99 4.59511985013459

IO

Standard IO rules apply. Importantly, you may take input as a fraction if you prefer. You may also output as a fraction, which does not need to be fully reduced.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ "Using builtins" — surely one must use some buildins‽ \$\endgroup\$
    – Adám
    Commented May 30, 2023 at 12:29
  • \$\begingroup\$ @Adám Not really… there are methods for doing this. \$\endgroup\$ Commented May 30, 2023 at 12:30
  • 1
    \$\begingroup\$ @Hippopotomonstrosesquipedalian I can't imagine solving this without any builtins. \$\endgroup\$
    – Adám
    Commented May 30, 2023 at 12:31
  • \$\begingroup\$ @Adám just needs a for loop and the 4 basic arithmetic operations \$\endgroup\$ Commented May 30, 2023 at 12:44
  • 1
    \$\begingroup\$ According to Adam those are technically builtins, I've clarified though so there is no need to further pollute the comments \$\endgroup\$ Commented May 30, 2023 at 12:45
  • \$\begingroup\$ Is there any reason for the increased accuracy requirement between 1 and 10? \$\endgroup\$ Commented May 30, 2023 at 19:41
  • \$\begingroup\$ @Hippopotomonstrosesquipedalian most approximations are more accurate around that range \$\endgroup\$ Commented May 30, 2023 at 19:41
  • \$\begingroup\$ You deserve an upvote. Anyways, I have a programme in mind that just requires me to increase a k value if it isn't precise enough. \$\endgroup\$ Commented May 30, 2023 at 19:47
3
\$\begingroup\$

Lowest digit addition generator

A digit addition generator of an integer n is any integer x that satisfy the equation x + s(x) = n, with s(x) being the sum of the digits of x. (We will work under base 10 for convenience.)

For example, a digit addition generator for 29 would be 19, because 19 + (1 + 9) = 29. Some numbers have more than one generator. An example might be 216, which has generators of 198 and 207.

Your objective is to generate the lowest digit addition generator of every non-negative integer n, and output anything other than a non-negative integer if there is none for n. The non-negative terms in your result should match the sequence A096234. You may find this paper related to the challenge.

Fewest bytes win; standard rules apply.

\$\endgroup\$
11
  • \$\begingroup\$ Do sequence rules apply? (Since you haven't put any tags) \$\endgroup\$ Commented Jun 13, 2023 at 14:17
  • \$\begingroup\$ This doesn't output any sequence, to my knowledge... the program should accept an integer and output another. Maybe I should get that edited in. \$\endgroup\$ Commented Jun 13, 2023 at 14:20
  • \$\begingroup\$ It might be shorter to just output the LDA for every number in sequence infinitely \$\endgroup\$ Commented Jun 13, 2023 at 14:25
  • \$\begingroup\$ After 2 minutes of introspect, I realized that the OEIS didn't exist for nothing... Time to add a new tag and also a rewrite. \$\endgroup\$ Commented Jun 13, 2023 at 14:28
  • \$\begingroup\$ I'd also suggest allowing any non-positive value, not just -1 on errors. Something like None or "" could be shorter depending on the language. \$\endgroup\$ Commented Jun 13, 2023 at 14:30
  • \$\begingroup\$ @mousetail Edited. Do you have any more suggestions? \$\endgroup\$ Commented Jun 13, 2023 at 14:33
  • \$\begingroup\$ By the way, welcome to Code Golf, and thanks for using the Sandbox! \$\endgroup\$
    – The Thonnu
    Commented Jun 14, 2023 at 20:01
  • \$\begingroup\$ @TomEpsilon I feel like still @mousetails' suggestion isn't fully implemented - None doesn't fit the "any negative number" definition for when there is no generator. \$\endgroup\$
    – pajonk
    Commented Jun 15, 2023 at 4:33
  • \$\begingroup\$ I agree, and plan to implement the wording of "anything other than a non-negative integer". \$\endgroup\$ Commented Jun 15, 2023 at 6:40
  • \$\begingroup\$ Edit successful. Do you have any more suggestions? \$\endgroup\$ Commented Jun 15, 2023 at 6:42
  • \$\begingroup\$ Alright. If there is none, I shall post it on the site. \$\endgroup\$ Commented Jun 15, 2023 at 8:08
3
\$\begingroup\$

Compute the maximal Ducci period

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

Diagonalize a vector

\$\endgroup\$
3
  • \$\begingroup\$ +1 because this is an opportunity for less usable languages to do well or at least be able to compete. Could you add two or three test cases? \$\endgroup\$ Commented Jul 13, 2023 at 18:02
  • \$\begingroup\$ if $n = 0$, must the result be a 0x0 matrix (if such a concept exists in the language), or is a 0-element vector acceptable? \$\endgroup\$
    – RubenVerg
    Commented Jul 13, 2023 at 18:18
  • \$\begingroup\$ @RubenVerg yes, that's fine \$\endgroup\$
    – bigyihsuan
    Commented Jul 13, 2023 at 18:34
3
\$\begingroup\$

Fast and Golfiest Challenges

I am planning on creating a series of cops-and-robbers style challenges. My inspiration is the coexistance of code efficiency problems and code golfing problems on this site - and the problem that code efficiency challenges seem to be often overlooked, even though most of competitive programming is centered upon efficiency. So I plan to combine the two in order to let golfers on the site try considering code efficiency as well, and as an opportunity for competitive programming experts to show off their cool knowledge of segment trees and the Bellman-Ford ;-) (alright, maybe not such hard stuff since I still want the challenge to be accessible to most people, especially golfers).

So here comes my idea. Each challenge in the series will be based on one theme (for instance, one theme I have in mind is "The Lords of the Strings", aimed at string operations).

The cops will choose a problem (the difficulty must not be "easy") on the competitive coding platform LeetCode and independently (there's no way to do anti-cheat for this, though, so we'll leave it up to the integrity of the participants themselves) write a both efficient and golfed answer for it. The problem should not be too easy. However, for the cops efficiency is emphasized over golfiness.

The robbers need to improve on the cops' code by golfing up the code (in the same language as the cop's), but here comes the thing: the golfed up version must not be algorithmically slower than the cop version. The robber has to prove this by theoretically proving that the time complexity of their code is lower or equal to the cop code. If it is lower, the robber gets 2.718 times their normal score (will still be rounded to the nearest integer).

Both cops and robbers must report the UTC time of their answer post. The cop's score is the number of hours (rounded to the nearest whole) that pass before the first valid robber answer is posted. The robber's score is the percentage reduction of code bytes compared to the cop code, again rounded to the nearest whole number.

What do you think, community? Any suggestions are very welcome! Thanks in advance :-D

TL;DR: An unusual cops and robbers game. Cops choose a competitive programming problem under a certain theme and write code to solve it. Robbers golf up the cop's code but must not sacrifice efficiency in the process. Cops mainly aim for code efficiency, while robbers mainly aim for code golfing.

Example

Cop

Input n, output 2*n (in the actual challenge please go get a real problem on LeetCode and paste the link).

Code: ,[>+>+<<-]>>[<+>-]<. (Brainfuck, 20 bytes)

2 hours and 40 minutes later...

Robber

Code: ,[>+>+<<-]>[>+<-]>. (19 bytes)

Both have complexity O(n).

Results: Cop gets 3 points (3 hours before first solve) and robber gets 5 points (5% reduction in code length).

\$\endgroup\$
2
  • \$\begingroup\$ Thanks so much for people on The Nineteenth Byte for their suggestions! \$\endgroup\$ Commented Jul 20, 2023 at 3:06
  • \$\begingroup\$ challenge post on main site \$\endgroup\$ Commented Jul 20, 2023 at 9:37
3
\$\begingroup\$

[Dual scoring criterion challenge concept]

(that's right...three OWC tags on one post :p)


Inspired by The Fast and the Golfiest, I've come up with what might be a novel way to do a combined code golf/fastest code challenge. I haven't decided what the actual task would be, but here's how it would work:

Your score is the number of answers you outgolf, plus the number of answers you outperform.

This means the highest possible score is \$2(n-1)\$, where \$n\$ is the number of answers. The idea is that an answer could focus purely on golfing or on speed, and get a score close to \$n-1\$, but achieving a balance of the two is the only way to do better than that.

Since this scoring method depends on having many answers to compare against, I'm thinking it would work differently from our site's normal rules, and all languages would compete against one another (this is more commonly treated as true in ). In order to keep the side of things fair, any language (including a specific flag combination) used must have at least 10 2 answers, which must meet any of the following requirements:

  • Posted by a user other than OP
  • Posted before the challenge
  • Posted at least two months ago

This limits flag abuse and other tricks to a more acceptable degree. Common flags in flag-abuse-oriented languages like Japt or Vyxal might still be usable, but most languages which have these sorts of flags are enormously uncompetitive in performance.

That's another reason I want to make all languages compete; it makes choosing the language you use an opportunity to strategize. A faster language like C might beat more answers in speed, while losing badly on golfiness, while the reverse may be true for Jelly or Vyxal.

\$\endgroup\$
8
  • \$\begingroup\$ Myxal ought to do well. \$\endgroup\$ Commented Jul 21, 2023 at 11:48
  • \$\begingroup\$ Wow, cool thing my challenge inspired others :-) I think it's a cool idea but it's hard to measure performance. We need to find an extremely stable interpreter/compiler for every single language if we wanna do that, and it's just difficult overall. Still, the idea itself is very cool. \$\endgroup\$ Commented Jul 24, 2023 at 15:45
  • \$\begingroup\$ @ShiranYuan Testing a few dozen times on the same hardware with countermeasures taken to minimize random noise should make the scoring much more consistent, I think. And any time the distribution of times from two submissions overlaps enough that it's hard to say with certainty which is faster, could always just run a dozen more tests. It's imperfect, but should work fine \$\endgroup\$
    – rydwolf
    Commented Jul 24, 2023 at 16:34
  • \$\begingroup\$ @RydwolfPrograms Well, good luck establishing the protocol ;-) \$\endgroup\$ Commented Jul 24, 2023 at 21:07
  • \$\begingroup\$ @ShiranYuan I mean, we do already have quite a few fastest-code questions. I'd probably just add in some statistics to make it more rigorous, and set up my test machine in such a way that consistent performance is more likely (I've got a server which I'm going to be using for hosting an online interpreter with code timing functionality, so this will sort of be like an opportunity to get that sort of isolation set up) \$\endgroup\$
    – rydwolf
    Commented Jul 25, 2023 at 2:48
  • \$\begingroup\$ @RydwolfPrograms Well what if someone submits code in esoteric languages that have no "canon" interpreter, like Brainfuck? \$\endgroup\$ Commented Jul 25, 2023 at 2:57
  • \$\begingroup\$ @ShiranYuan A specific implementation would be required to be specified (and it would anyway, given that, e.g., BF has a wide range of unspecified behaviors that different interpreters vary on) \$\endgroup\$
    – rydwolf
    Commented Jul 25, 2023 at 14:14
  • \$\begingroup\$ @RydwolfPrograms Nice idea! I think it's pretty good to go ;-) \$\endgroup\$ Commented Jul 26, 2023 at 1:46
3
\$\begingroup\$

Print this pulsar (or "Print this diamond" gone beautifully wrong)

\$\endgroup\$
1
1
24 25
26
27 28
162

You must log in to answer this question.

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