552
\$\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".

Get the Sandbox Viewer to view the sandbox more easily!

\$\endgroup\$
0

3850 Answers 3850

1
66 67
68
69 70
129
1
\$\begingroup\$

Permutation of all the number which separated by ':' and ','

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to Code Golf and thanks for using the Sandbox! This is a great challenge, but as it stands it's a little unclear from the instructions what's being asked. For example it's clear from the example that 1-2,11,44:110-113 means output every permutation of 1,2,11,44 on the left column and 110,111,112,113 on the right column, but that's not explained in the instructions. \$\endgroup\$
    – Mayube
    Nov 12, 2021 at 20:52
  • \$\begingroup\$ @Mayube Thanks for your comment, I've updated the instructions. \$\endgroup\$
    – obnews
    Nov 12, 2021 at 22:02
1
\$\begingroup\$

Print random characters indefinitely

Task


Continuously print a random character (a-z, A-Z, 0-9) not separated by a newline (\n).

Expected output


b7gFDRtgFc67h90h8H76f5dD55f7GJ6GRT86hG7TH6T7302f2f4 ...

Note: output should be randomised.

Requirements/Rules


  1. Output must be continuous (i.e. never ending),
  2. Output may not comprise of newlines,
  3. Output must be random,
  4. Output must be only composed of characters: a-z, A-Z, 0-9.
  5. No loopholes, regarding programming language version(s). Use only the tools available with that programming language, no third-party packages, modules, or other addons.

Points


  • Smallest file size (in bytes)

Notes

Concerns: None at the moment...

\$\endgroup\$
9
  • 1
    \$\begingroup\$ I think this would count as a duplicate of this. It's a language specific version, and indefinite, but making something loop forever isn't really the hard part of the challenge I think. \$\endgroup\$
    – Riker
    Nov 29, 2021 at 0:51
  • \$\begingroup\$ @Rɪᴋᴇʀ no, not because different. \$\endgroup\$
    – Fmbalbuena
    Nov 29, 2021 at 0:51
  • 1
    \$\begingroup\$ Is "creativity" part of the scoring? If so, there's no way to objectively determine how creative something is, so you can't use that as a scoring criterion. You should probably clarify Python 3.8 is the only allowed language, or just drop that entirely (which I'd strongly recommend). \$\endgroup\$ Nov 29, 2021 at 0:52
  • 1
    \$\begingroup\$ @RedwolfPrograms and Riker thank you for the tips, i'll make the suggested edits to the criterias ASAP. \$\endgroup\$ Nov 29, 2021 at 0:57
  • 1
    \$\begingroup\$ Not limited to python, this might be different enough. I consider something a duplicate if the more specific challenge doesn't really encourage any different approaches than whatever worked for the previous ones, but limiting to alphanumeric and forcing an infinite stream is probably good. You should probably check if there's any other ones tagged [random] that look too similar though. \$\endgroup\$
    – Riker
    Nov 29, 2021 at 0:59
  • \$\begingroup\$ @Rɪᴋᴇʀ Understood. Thanks again! \$\endgroup\$ Nov 29, 2021 at 1:01
  • 1
    \$\begingroup\$ No problem! It's an interesting challenge, and if it really hasn't been done before then I think it would be quite fun to do. \$\endgroup\$
    – Riker
    Nov 29, 2021 at 1:13
  • \$\begingroup\$ Ok! Will post this in ~22 hours... \$\endgroup\$ Nov 29, 2021 at 1:16
  • \$\begingroup\$ We've had similar versions of this challenge before, and they've all been closed as a dupe of this and/or this. Personally, I would hammer this closed as a dupe of those two, as I don't think this adds anything that they don't - it's just a trivial combination of the two \$\endgroup\$ Nov 29, 2021 at 1:20
1
\$\begingroup\$

Largest SKI Reduction in under 100 characters

The challenge

Create a program in SKI Combinator Calculus in under 100 characters that produces the largest result after terminating.

Scoring

The score will be the number of characters in the final reduction. The highest is the winner.

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

Fully matched numbers

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

Convert superscript numbers to normal numbers

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Maybe specify exactly what characters will be included in the input? \$\endgroup\$
    – emanresu A
    Dec 11, 2021 at 22:02
  • \$\begingroup\$ @emanresuA Done \$\endgroup\$
    – Ginger
    Dec 12, 2021 at 0:05
1
\$\begingroup\$

Posted here

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

Rotate two differently cased subwords independently

You have one string made of two subwords in different cases, the upper case first, then the lowercase:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

And you must return each subword cycled by a given increment. (N.b. the letters aren't rotated through the alphabet, but each character is shifted in the word)

The subwords are not always the same length as each other, and are part of the same 'data' structure. If your language cannot store strings, you're permitted to store the 'string' in a single array, e.g. ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

Here are the test cases:

Input Output
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 13 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
"ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyzabcdefghijklm", 13 'NOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyz'
"ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyz", 26 'ABCDEFGHIJKLMNOPQRSTUVWXYZopqrstuvwxyzn'
"ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyz", 13 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyz'
"ABCnopqrstuvwxyz", 2 'BCAyznopqrstuvwx'
"AAABBBcccddd", 2 "BBAAABddcccd"
"AAABBBcccddd", 6 "AAABBBcccddd"
"HELLOworld", 5 'LLOHErldwo'
"CODEgolf", 0 'CODEgolf'

Here is an ungolfed example program:

const subWordRotate = (original, rot) => [...original.split(/([A-Z]+)(?![A-Z][a-z]+)/)].map(list => [, ...list].reduce((memo, char, index, input) => {
  memo = memo.slice(0, input.length);
  memo.splice((index + rot) % (input.length), 1, char);
  return memo
}, Array(original.length).fill('')).join('')).join('')


const testCases = [
  ["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 13],
  ["ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyzabcdefghijklm", 13],
  ["ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyz", 26],
  ["ABCDEFGHIJKLMNOPQRSTUVWXYZnopqrstuvwxyz", 13],
  ["ABCnopqrstuvwxyz", 2],
  ["AAABBBcccddd", 2],
  ["AAABBBcccddd", 3],
  ["AAABBBcccddd", 4],
  ["AAABBBcccddd", 5],
  ["AAABBBcccddd", 6],
  ["AAABBBcccddd", 7],
  ["AAABBBcccddd", 8],
  ["AAABBBcccddd", 9],
  ["AAABBBcccddd", 10],
  ["HELLOworld", 69],
  ["CODEgolf", 0]
]
testCases.forEach(
    testCase => console.log(`original: ${testCase[0]}, rotated by ${testCase[1]}: ${subWordRotate(...testCase)}`)
  );


Sandbox note: I think there is a bug in my code, such that ["AAABBBcccddd", 6],["AAABBBcccddd", 7], return the same values. I think this is the same bug that is preventing me specifying how negative numbers work. Any help fixing the code would be much appreciated

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

The Most Wanted Prime Numbers

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

Can we patch the corona certificate validation code (part 1/3)?

The new chancellor of Germany, Mr. Olaf Scholz, is in deep trouble: the Covid app does not show the vaccination status correctly beginning with booster vaccinations. He was not involved in the development of the app, since that was under chancellor Angela Merkel. He is now hiring you, Secret Agent 0x007, in order to understand the problem and later apply a strategy to fix the problem.

In step 1, Mr. Scholz wants to understand how the app has worked correctly when booster vaccinations were not even thought of. Mr. Scholz is an important person, so he has no time to read lengthy source code. Your code has to be .

These are the rules of valid vaccinations:

  • There are 4 vaccination types in Germany: BioNTech (B), Moderna (M), Astra Zeneca (A) and Johnson&Johnson (J).
  • A person is considered vaccinated 14 days after the necessary amount of injections.
  • Biontech, Moderna and Astra Zeneca need 2 injections, Johnson needs 1 injection only.
  • If 2 injections are needed, the second injection may occur earliest 28 days after the first injection.
  • If 2 injections are needed, the second injection may only be with the same vaccination type.
  • You get an entry in your vaccination pass which has the date in the format YYMMDD. COVID-19 is all post 2000, so we never need a 4 digit year.
  • A full entry is in the form YYMMDD X followed by a newline, where X is the vaccination type.

How the application works:

You get the input in a reasonable form, e.g.

  • from stdin, separated by newlines of your platform
  • an array of strings (like argv)
  • a function with variable number of arguments (like ...)

The first line/entry is today's date, which you check the validity against. This comes from a time server, so it's always valid. Each following line/entry is for one injection. There may be many of them, mainly limited by your platform (254 is certainly enough, also for part 2 and 3).

The application gives the following output:

  • injected after a successful injection with the 14 days period not over
  • vaccinated 14 days after the necessary amount of injections
  • manipulated in case things do not match

manipulated takes precedence over vaccinated over injected. The output may contain arbitrary leading or trailing whitespace. A newline is not needed (it will be displayed in a mobile phone app textbox anyway).

The output can be

  • on stdout
  • the return value of the function

As there are quite some anti-vaxxers, the application checks for manipulations.

  • Totally invalid vaccination types (like Y)
  • Mix of vaccination types for the first and second injection
  • More injections than needed
  • Invalid date (like 200231 - there is no February 31st)
  • Date too early (earlier than 200101, the beginning of the pandemic)
  • Injection date later than today
  • Injections in wrong order (second date before first date)

You don't need to consider:

  • dates other than 6 digits
  • characters in the date other than 0-9
  • other character than space as the separator
  • more than 1 character as vaccination type

Test cases:

<any date>
200231 X
= manipulated (invalid vaccination type)

<any date>
210301 B
210329 A
= manipulated (different vaccination types)

<any date>
210301 B
210329 B
210426 B
= manipulated (too many injections)

210814
210301 J
210814 J
= manipulated (too many injections)

<any date>
200231 B 
= manipulated (invalid date February 31st)

<any date>
191231 B 
= manipulated (date earlier than the pandemic)

210301
210302 J
= manipulated (date of the injection is tomorrow)
 
210301
210301 J
= injected (14 days not over)

210315
210301 J
= vaccinated (14 days over, only 1 injection needed)

210315
210301 B
= injected (14 days over, but 2 injections needed)

<any date>
210301 B
210302 B
= manipulated (28 days between 2 injections required)

210331
210301 B
210329 B
= injected (28 days between 2 injections, but not 14 days after the last one)

210412
210301 B
210329 B
= vaccinated (28 days between 2 injections, 14 days after the last one)

210412
210329 B
210301 B
= manipulated (injections in wrong order)

About realism: while this challenge has a realistic background, not all vaccination of rules in Germany are considered. Do not claim that your program can calculate the validity of a COVID-19 vaccination certificate.

Coming up:

  • part 2, in which you need to consider booster vaccinations the wrong way
  • part 3, in which you check whether you can patch the wrong code of part 2 to make it work correctly

I would appreciate if you participate in all 3 parts.

\$\endgroup\$
5
  • \$\begingroup\$ Regarding the process: I will start writing part 2 when I have received feedback on part 1. I will start writing part 3 when I received feedback on part 2. I want to release part 1 not before all 3 parts were reviewed. Would that be fine? \$\endgroup\$ Dec 18, 2021 at 21:06
  • \$\begingroup\$ Interesting question, and I like it. The only thing that really sticks out to me is the input format, you should probably clarify before anybody asks - can you take input as an array/list of strings, rather than a newline delimited string? i.e. ["a", "b"] instead of "a\nb". It really doesn't matter much which you pick but since newline delimited strings would take more bytes for most langs, it's probably going to get asked immediately. \$\endgroup\$
    – Riker
    Dec 18, 2021 at 21:24
  • \$\begingroup\$ @Riker: thank you for the feedback. Yes, if that's a common thing to have for input, that's totally fine. Is there an example for a formulation considering all the common inputs? \$\endgroup\$ Dec 18, 2021 at 21:26
  • 1
    \$\begingroup\$ I'm unsure if it counts as common, but yeah - it's just that indexing an array is probably shorter than calling .split("\n") for many languages, lol. Regarding posting 3 challenges, I think it's worthwhile to sandbox all 3 before posting any of course, but then posting maybe each one on sunday or something for 3 weeks would be fun. Somebody in chat compared it to a mini advent of code (golf) :) \$\endgroup\$
    – Riker
    Dec 18, 2021 at 21:29
  • \$\begingroup\$ I implemented this challenge (non-golfed) and all test cases work. I'll start working on the next one now. \$\endgroup\$ Dec 27, 2021 at 15:22
1
\$\begingroup\$

Fuzzy friends

Introduction

Congratulations! You've been selected to do research a a newly discovered animal called a fuzzy, a docile, simple creature that strongly resembles a cotton ball. Fuzzies love to be near other fuzzies, but not all fuzzies want to be near each other.

There are 6 types of fuzzies, 1a, 1b, 2a, 2b, 3a, and 3b. Each obeys different rules.

  • Type 1a fuzzies want to be near any type b fuzzy. (vice versa for 1b)

  • Type 3a fuzzies want to be near any type a fuzzy. (vice versa for 3b)

  • Finally, type 2 fuzzies want to be near any fuzzy type, a or b.

  • Perfect pairings are matches in which both fuzzies want to be near each other (ex. 1a and 1b)

  • Semiperfect pairings are matches in which only one fuzzy wants to be near the other (ex 3a and 1b)

  • Imperfect pairings are matches in which neither fuzzy wants to be with the other (ex. 3a and 3b)

Your Challenge

Given a list of fuzzies:

  1. Output the total number of perfect pairings. If there are any left:
  2. Output the number of semiperfect pairings. If there are any left:
  3. Output how many leftover bachelors there are.

Output and input format don't matter as long as you state them both.

Test cases

1a, 1b:
1a and 1b are a perfect match
> 1 perfect, 0 semiperfect, 0 bachelors
1a, 2b, 2a, 3b:
1a and 2b are a perfect match
2a and 3b are a semiperfect match
> 1 perfect, 1 semiperfect, 0 bachelors
1a, 1b, 2a, 3a, 3b, 3b:
1a and 1b are a perfect match
2a and 3a are a perfect match
3b and 3b are an imperfect match
> 2 perfect, 0 semiperfect, 1 bachelor
1b, 2a, 3a
1b and 2a are a perfect match
3a is left over
(note: could also be:
2a and 3a are a perfect match
1b is left over
for the same result)
> 1 perfect, 0 semiperfect, 1 bachelor

Scoring

This is , so shortest in bytes wins.

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

Make a negative afterimage

We've all seen the strange, inverted-color images of the American Flag or similar that look correct after you stare at them for a minute and look at a white object. These are called negative afterimages.

Your Challenge

Given an image as input, your program should return that same image, recolored to create a negative afterimage. To do this, simply invert each color in the image. Your program may take either raw image data or a path to an image file as input, and either create a new image file or display the inverted image as output.

Scoring

This is code-golf, so shortest answer wins.

\$\endgroup\$
2
  • \$\begingroup\$ What does inverted-color mean? For example, if input color is pink, should I output darkred, darkgreen or lightgreen? \$\endgroup\$
    – tsh
    Dec 23, 2021 at 8:23
  • \$\begingroup\$ How many colors should I support at least. Is a program only support black-white image acceptable? Or what about 16 color image? \$\endgroup\$
    – tsh
    Dec 23, 2021 at 8:24
1
\$\begingroup\$

Loading Circle Animation

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I think it would be simpler if a program was just required to output eight frames, then stop. The infinite looping is unnecessary. (I think it's fine how it is) \$\endgroup\$ Oct 28, 2021 at 1:45
  • \$\begingroup\$ For example, someone submit a progrom like this: while True: print(".#\n#\n#..#\n.##);clearScreen();print(.##\n#\n#\n.##);clearScreen()... The program try to print a frame, and then clear the screen immediately. It in theory output each frame one by one. But user would be hard to distinguish each frames. Also, if you try to take a screenshot, most time you will got an empty screen (suppose clearScreen would be much slower than print). Is this still a valid answer? \$\endgroup\$
    – tsh
    Nov 4, 2021 at 8:03
  • \$\begingroup\$ @tsh Yes, as long as the user can tell what the animation is. \$\endgroup\$
    – Yousername
    Nov 12, 2021 at 22:59
1
\$\begingroup\$

Shuffle a subsequence

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

Pluralize a Noun List

Currently Closed

\$\endgroup\$
7
  • \$\begingroup\$ Can you change dropbox to github? \$\endgroup\$
    – Fmbalbuena
    Jan 3 at 3:17
  • \$\begingroup\$ I can see if I can do that. Got some other big changes this thing probably needs though. \$\endgroup\$
    – Romanp
    Jan 4 at 4:02
  • \$\begingroup\$ most users use Github \$\endgroup\$
    – Fmbalbuena
    Jan 4 at 4:03
  • \$\begingroup\$ Got it. I realized that my lists of words were not particularly accurate, so as soon as I get better ones, I will switch to Github. \$\endgroup\$
    – Romanp
    Jan 5 at 12:58
  • \$\begingroup\$ The link example fakehtpps://python.org can be [link](fakehtpps://python.org) \$\endgroup\$
    – Fmbalbuena
    Jan 5 at 15:03
  • \$\begingroup\$ test-battery would be a good tag for this, I think \$\endgroup\$
    – user
    Jan 12 at 1:45
  • \$\begingroup\$ Now that this is posted, could you edit it down to a stub and delete it? \$\endgroup\$ Jan 12 at 3:05
1
\$\begingroup\$

Minimal Randomness

In this challenge, you take input and shuffle the letters in a random, non-deterministic way which minimizes the probability that the output is different from the input.

Rules

  1. Your program must take input and use only substitution and transposition to randomly modify the input.

  2. There must be a slight, non-zero probability that the output differs from the input.

  3. Your program is graded based on the probability of its output differing from the input, with a lower probability being better.

  4. If two programs are tied in score, the tie is settled by the code size, with a shorter code being better.

  5. Your program must be non-deterministic.

Meta

I'll post this to main soon unless there are any issues with it.

\$\endgroup\$
3
  • \$\begingroup\$ don't post it to main right away, wait for feedback and upvotes \$\endgroup\$ Jan 13 at 22:59
  • 1
    \$\begingroup\$ yeah. That's what I meant, sorry if it sounded like "if nobody looks at this, it must be amazing!" \$\endgroup\$
    – Binary198
    Jan 14 at 15:52
  • \$\begingroup\$ Seem a busy beaver and shuffle/next_permu, assuming it's possible to return differ \$\endgroup\$
    – l4m2
    Jan 18 at 13:00
1
\$\begingroup\$

Short programs for fixed outputs

Inspired by Lynn's Jelly puzzles. Check them out if you're interested in practicing your Jelly skills

Cops

The cops should choose three things:

  • A freely available programming language,
  • a byte count \$B\$, and
  • a number of programs to write, \$n\$ (minimum 5)

They should then write \$n\$ programs, each of which:

  • is exactly \$B\$ bytes long, and

  • outputs a fixed, non-empty, non-whitespace output. That is, the output should contain at least one non-whitespace character. "Fixed" can mean that either:

    • it outputs the same thing no matter what input is provided, or
    • that it always outputs the same thing and takes no input.

    You may choose which of these meanings to take, but it must be the same for all \$n\$ programs. Please mention which of these options your programs use.

The cops should then reveal the following bits of information:

  • The programming language used,
  • the byte count \$B\$,
  • any command line flags used for specific outputs,
  • the \$n\$ outputs for each of the \$n\$ programs. If the outputs use any non-printable ASCII characters, please include a hexdump of the output.

The Robbers will be attempting to find \$B\$ byte long programs that output the same outputs, so you should keep your programs secret.

For example, if you choose to write 7 programs in Python, each of them 10 bytes, that output

4, True, 2 3 , 1, 72, ! and [0]

then you may have these 7 programs (one per line).

Robbers will crack one of your \$n\$ outputs if they can find any \$B\$ byte program in your language that has the same output. Note that the program does not have to be the same as the cop's program.

Any outputs that go a week without being cracked can be marked safe, and the programs for each output should be revealed. Until the program is revealed for a specific output, it can still be cracked.

You may post multiple answers, but each answer should be independent from all others. Your score is equal to the total number of safe outputs across all your answers. The user with the highest score wins.

Robbers

You should find a Cops answer with at least one uncracked, unsafe output, and attempt to crack any of the outputs. That is, find a program that is exactly \$B\$ bytes long that outputs the same fixed output. Note that your program does not have to be the same as the Cop's original answer, just that the output has to be equal.

If you crack an answer, please do the following:

  • Leave a comment on the Cop's answer, linking to either your answer or a TIO (or similar) link demonstrating the crack
  • If this is your first crack, post an answer to the Robbers thread with your crack, linking to the relevant Cop answer
  • For further cracks, edit them in to your existing answer, linking to the relevant Cop answer

A Robber's score is equal to the total number of cracks they make. The Robber with the highest score wins.


Meta

\$\endgroup\$
1
  • \$\begingroup\$ Other than the original inspiration, is there any reason to have multiple tasks in one cop submission? Since they're not related to each other and each one can be cracked individually, it seems like they should each be separate answers. \$\endgroup\$
    – DLosc
    Jan 15 at 0:46
1
\$\begingroup\$

Cell Evolution

Your lab needed to simulate how a particular cell evolves over time in a 2D grid space. A sample 2D grid space below shows a single cell at the centre of the grid.

0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0

The cell evolution follows these rules:

  1. '0' indicates no live cell
  2. A positive number indicates a live cell. The number indicates its age.
  3. A cell will grow from age 1 to 5 in each evolution
  4. After age 5, a cell will die at the next evolution (resetting to '0')
  5. If a cell has 4 or more neighbours (adjacent and diagonally), it will die due to over-crowding.
  6. In each evolution, a live cell will spread to its neighbour (adjacent and diagonally) if there is no live cell there and that neighbour is not overcrowded (surrounded by less than 4 cells)

Given an integer n in the input, which represents the size of the grid given, output the next generation of cells until all cells are dead ("0")

Extra rules:

  1. The first live cell is always in the center of the grid
  2. n must be odd so the live cell is always centered
  3. The grid size <=9 to prevent incredibly large outputs of data

Test case

Only 1 to save space in question

Input: 3

0 0 0
0 1 0
0 0 0
1 1 1
1 2 1
1 1 1
2 0 2
0 0 0
2 0 2
3 1 3
1 1 1
3 1 3
4 0 4
0 0 0
4 0 4
5 1 5
1 1 1
5 1 5
0 0 0
0 0 0
0 0 0

This is code-golf, so shortest bytes wins!

Tags:

matrix

code-golf

ascii-art

cellular-automata

Please check the tags or edit them if they're wrong or you think a particular tag is not here. Feel free to comment on this puzzle!

\$\endgroup\$
3
  • \$\begingroup\$ What happens to the centre if n is even? Will there be 4 alive cells or 1? Where would the alive cell be placed? \$\endgroup\$
    – PyGamer0
    Jan 19 at 8:39
  • \$\begingroup\$ The grid size must be odd so the live cell is always centered. Read the rules carefully @PyGamer0 u didnt read the extra rules \$\endgroup\$
    – DialFrost
    Jan 19 at 8:48
  • 1
    \$\begingroup\$ Could you include a test case to illustrate? Great idea btw. \$\endgroup\$
    – ophact
    Jan 19 at 13:29
1
\$\begingroup\$

From code to golf (Cops and Robbers)

\$\endgroup\$
6
  • \$\begingroup\$ Is allowed to remove letter? \$\endgroup\$
    – Fmbalbuena
    Jan 17 at 23:45
  • \$\begingroup\$ @Fmbalbuena Nope. \$\endgroup\$
    – emanresu A
    Jan 17 at 23:55
  • \$\begingroup\$ there will be someone say that the program are changed “239742387” times \$\endgroup\$
    – okie
    Jan 17 at 23:55
  • 1
    \$\begingroup\$ @okie Then there will probably be some sort of pattern, and it'll be possible to find that. \$\endgroup\$
    – emanresu A
    Jan 17 at 23:56
  • \$\begingroup\$ @emanresuA yea and that will be another interesting part of this challenge. \$\endgroup\$
    – okie
    Jan 17 at 23:59
  • \$\begingroup\$ @okie Exactly!! \$\endgroup\$
    – emanresu A
    Jan 18 at 0:01
1
\$\begingroup\$

Navigate the city

The government of your country has just completed a city designed to accommodate a few hundred thousand people. It has all sorts of facilities including roads, restaurants, malls, houses, etc. You have been invited to test the road system, but you are completely unfamiliar with it, so you need a GPS. Your challenge is to make one.

Description of the city

Note: when I say "a x a grid", I mean that there are a horizontal roads and a vertical roads within the grid.

To make the challenge easier (because of course making a GPS is difficult in itself), the city is fixed. The city's road system is based on a very rigid grid. This grid is pictured further below.

The grid has a size of 15x15 and the roads are labeled as [r/c num][dir] where "r/c num" is the row/column number (whether it is a row or column depends on the direction of the road) and "dir" is the direction. If the road runs from west to east, "dir" is E, and if it runs from north to south, "dir" is S. For instance, "1E" is the first row of the grid, while "12S" is the twelfth column of the grid. Each row and column of the grid has a length of 14km (1km between each intersection).

The Central Business District (CBD) is the 5x5 sub-grid situated in the middle of the grid. Due to the traffic parameters set below, it is important for your GPS to route the user away from the CBD if it is not necessary to pass through that district. Note that the CBD includes the borders of the 5x5 sub-grid.

At each intersection, there is a traffic light. The amount of time to wait is as follows:

  • there is a "base time" which is 400 if the intersection is in the CBD, and is the row position of the intersection (row 1 column 2 would be the intersection between 1E and 2S) times the column position otherwise;
  • the waiting time to turn left is equal to the base time;
  • the waiting time to go straight is equal to the base time, multiplied by 2;
  • the waiting time to turn right is equal to the base time, multiplied by 3.

The times above are measured in seconds.

In addition to the standard grid of roads, there is an expressway circling the inner part of the city. It passes directly over parts of the 4E, 4S, 12E and 12S roads in such a way that it forms a square. In both directions, there is an innovative exit/entry elevator at each place where there would be an intersection if you took the 4E, 4S, 12E or 12S road rather than the expressway. It is positioned in such a way that you can skip the traffic light for that intersection and get going, and in addition to that you can turn your car around in whichever direction you would like and go that way. I know it sounds rather confusing, but in essence you can exit at any intersection and go whichever way you wish, with the distances still being measured in kilometers in all cases. Note that the elevator is instantaneous (once again, not very realistic, but who uses elevators for cars on the main road anyway?). Upon entering the expressway, you can go in either direction. On the expressway, there are no at-grade intersections, so the traffic is free-flowing, and there are no waits at traffic lights or any other obstruction. Entry onto the expressway is done at any intersection involving the 4E, 4S, 12E or 12S road. Cars entering the expressway do not need to wait at a traffic light before doing so. Once again, the way in which the entry elevator is designed ensures that all distances are still measured in kilometers. This means that you can drive 1km from an intersection, enter the expressway there, and drive 3km on the expressway, with the total distance being 4km.

The city sets speed limits as follows:

  • 30 for all roads within the CBD;
  • 60 for all standard roads outside the CBD;
  • 120 for the expressway.

These speeds are measured in kilometers per hour.

Picture of the grid

Everything inside, and including, the bold black outline, is the Central Business District. The blue outline represents the expressway.

enter image description here

Challenge

Write a GPS which takes in a start intersection and end intersection, and attempts to output the fastest route from the start to the end. The "intersection" must be an intersection between two roads and can be specified in whichever reasonable input format you would like. You could take the row and column, the names of the two roads, etc. as long as it's reasonable.

Your output should be a list of directions in whichever reasonable output format you would like. Each direction should specify the direction to turn (straight, left, right, and for the expressway, enter/exit), the road to turn on and the number of "kilometers after the previous direction" to wait before executing this direction. For instance, "After 7km, exit the expressway onto 12E (East)". If the direction is to be executed while on the expressway, it must not take intersections into account. Your program may optionally decide to omit directions telling the user to "continue straight", but it may not omit any other direction. As shown above, directions telling the user to enter or exit an expressway must specify the direction to head upon entry ("enter the expressway (South)", for instance). You may direct the user in any direction from the starting intersection, and arrive at the end intersection from any side. It should also tell the user for how long he or she will have to drive, down to the second, and, optionally, the distance he or she will have to drive, which is necessarily measured in kilometers.

Your GPS may assume that the user will always be driving at the speed limit. It may also assume that the start and end are different.

Scoring

There are 225 x 224 = 50400 ways to choose start/end pairs. Your GPS will be scored based on the sum of the amounts of time it takes to drive from the start to the end, for each pair of start/end points. The GPS with the smallest total is the winner.

In the unlikely event of a tie between two or more submissions, length of code shall be the tiebreaker.

No test cases because there is never a single route for any start/end pair.


The tags for this challenge are , , and .

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

Play chess (KOTH)

Your task is to write a chess engine that will compete with other submissions in a chess tournament. Well, almost. Since writing a full engine can be a bit tedious, you only need to write the evaluation function.

An evaluation function takes a chessboard as input and returns how "favorable" the position is. If white is winning, the evaluation function should return a large positive number. If black is winning, a large negative number. If the situation is tied, a number close to zero.

Chess engines then simulate different possible games to some depth and choose the moves that lead to the best result.

A classic evaluation function is as follows:

  • Set r=0
  • For every white pawn, add 1. For every black pawn, subtract 1.
  • Same for knights and bishops, except add or subtract 3.
  • For rooks, use 5
  • And for queens, use 9

This evaluation function only takes into account material advantage; that is, just the raw amount of different pieces. More complicated evaluation functions may consider the position of individual pieces, what kind of structures do the pawns form etc.

Your task is to write an evaluation function in C in at most 150 bytes. The evaluation function takes as input 7 bitboards. A bitboard is a 64-bit integer that assigns one bit to every square of the chessboard. The first bitboard has a bit set for every piece in the chessboard. The second one encodes the owner of the piece. The remaining bitboards have a bit set for every pawn, knight, bishop, rook and queen respectively. There is no bitboard for the king, since you can calculate it using the first and last 5 bitboards. Your function will return a signed integer.

For your convenience, I've aliased __builtin__popcount to p and uint64_t to q, and also included every standard header. You should name your function e.

Note that a slow evaluation function means that the engine won't be able to search as deep as with a fast one.

TODO: more details... and also write the engine

Meta

  • Is 150 bytes a good number?
  • Almost tempted to not alias the popcount... would have interesting results
\$\endgroup\$
4
  • \$\begingroup\$ How will this be KOTH if nobody actually competes in a game of chess? \$\endgroup\$ Jan 24 at 20:38
  • 1
    \$\begingroup\$ @thejonymyster You write the evaluation function. A chess bot with your evaluation function competes (rest of the bot is standardized). \$\endgroup\$
    – AnttiP
    Jan 24 at 20:39
  • \$\begingroup\$ Oh, interesting! \$\endgroup\$ Jan 24 at 20:40
  • 1
    \$\begingroup\$ @thejonymyster counts how many bits are set in a number. It's massively useful here, since the board data is in 64-bit integers. \$\endgroup\$
    – AnttiP
    Jan 24 at 20:50
1
\$\begingroup\$

Count the ways to transform (2)

Your input is a matrix (2d array) of positive integers. For example:

\begin{matrix} 1 & 1 & 4 & 7\\ 1 & 3 & 5 & 6\\ 2 & 1 & 4 & 5 \\ \end{matrix}

A semi-continuous transformation of this matrix is a rearranging of elements that preserves immediate neighbors. For example, we can swap the \$2\$ in the bottom left, and the \$1\$ in the top left corner.

\begin{matrix} 2 & 1 & 4 & 7\\ 1 & 3 & 5 & 6\\ 1 & 1 & 4 & 5 \\ \end{matrix}

This is fine, because every number has the same neighborhood counts. That is, we can make a sorted list of numbers and their neighbors, and verify the they are the same:

\begin{matrix} \text{Number} & \text{Neighbors} \\ 1 & 1,1 \\ 1 & 1,2,3 \\ 1 & 1,3,4 \\ 1 & 2,3,4 \\ 2 & 1,1 \\ 3 & 1,1,1,5 \\ 4 & 1,5,7 \\ 4 & 1,5,5 \\ 5 & 3,4,4,6 \\ 6 & 5,5,7 \\ 7 & 4,6 \end{matrix}

Here is another example.

\begin{matrix} 2 & 1 & 1\\ 1 & 3 & 1\\ 1 & 1 & 4\\ \end{matrix}

Let's make a neighbor list. Note that we are gonna have duplicate entries (which is fine)

\begin{matrix} \text{Number} & \text{Neighbors} \\ 1 & 1,1 \\ 1 & 1,1 \\ 1 & 1,2,3 \\ 1 & 1,2,3 \\ 1 & 1,3,4 \\ 1 & 1,3,4 \\ 2 & 1,1 \\ 3 & 1,1,1,1 \\ 4 & 1,1 \\ \end{matrix}

Now, can we swap the top left \$2\$ and the bottom left \$1\$? It may look fine at first glance, but we must be careful! By swapping those two elements we would create a \$1\$ which has neighbors \$2,3,4\$, which didn't exist in the first input.

Just to demonstrate, here is the matrix after this non-semi-continuous transformation:

\begin{matrix} 1 & 1 & 1\\ 1 & 3 & 1\\ 2 & 1 & 4\\ \end{matrix}

And here is the neighbor list:

\begin{matrix} \text{Number} & \text{Neighbors} \\ 1 & 1,1 \\ 1 & 1,1 \\ 1 & 1,1,3 \\ 1 & 1,2,3 \\ 1 & 1,3,4 \\ 1 & 2,3,4 \\ 2 & 1,1 \\ 3 & 1,1,1,1 \\ 4 & 1,1 \\ \end{matrix}

Which is has changed after the transformation, ergo the transformation is non-semi-continuous (on this input).

To clarify, semi-continuity is a property of a transformation on some specific matrix.

Your code will take a matrix as input and output the number of (unique) semi-continuous transformations. Two transformations are different if the output is different. So for example swapping two identical numbers is the same as the identity transform (doing nothing).

Or in other words: Your code will take a matrix and return the number of matrices with those dimensions that have the same neighbor-list.

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

Trap the persistent hero in a maze

Last time a challenger tried to thwart your evil magical deeds, they got trapped in a maze that you created to be as small as possible, giving up only a few steps from the exit. Now there is another hero on the way. If it ain't broke, why fix it, so you ask the magic ball about the moves the hero will make in the maze. There are good news, and bad news.

The good news is that the hero's moves are still predictable. There is a list of moves, which determine how the hero moves in an intersection. The bad news is that the hero is persistent, never really giving up. What this means is that the list of moves repeats forever.

TODO Explanation of the move list and rules

Your task is to write a program that traps the hero in the maze. You may assume that the input has a solution.

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

Count count count..

Posted

\$\endgroup\$
4
  • \$\begingroup\$ what about something like [1,[2,5,10]] \$\endgroup\$ Jan 26 at 13:56
  • \$\begingroup\$ @thejonymyster count 1 to .. [2,5,10]->8 result is 7, ok I got it.. There's no test cases involving sorted lists, thanks \$\endgroup\$
    – AZTECCO
    Jan 26 at 13:59
  • 1
    \$\begingroup\$ actually i was being stupid, but im glad you found use in it :D +1 btw \$\endgroup\$ Jan 26 at 14:08
  • \$\begingroup\$ @thejonymyster glad you raised a doubt here on the sandbox ;) \$\endgroup\$
    – AZTECCO
    Jan 26 at 14:12
1
\$\begingroup\$

Alphabet Polygon

Intro

Given a number of sides \$a\$ and a side length \$b\$, generate an \$a\$-sided polygon with side length \$b\$. The fill value will be the alphabet going clockwise. If there are not enough letters, wrap around.

Test cases

3 4

     A
    H B
   I   C
  G F E D


4 4

ABCD
L  E
K  F
JIHG
```
\$\endgroup\$
2
  • \$\begingroup\$ This seems like it'd immediately run into problems with, say, a pentagon. But I digress, this is intriguing \$\endgroup\$ Jan 25 at 14:51
  • 3
    \$\begingroup\$ Good idea, it's just that I'm unsure as to how one might handle a heptagon, or dodecagon, for instance. And do we have to loop back to the beginning of the alphabet once we have exhausted the entirety of the alphabet? For instance, a square with a side length of 10? \$\endgroup\$
    – ophact
    Jan 25 at 17:55
1
\$\begingroup\$

Shuffle up a list

Given two lists \$A\$ and \$B\$, with no repeats in elements and so that the elements of \$B\$ are identical to the elements of \$A\$ except for the order they are in, we say \$B\$ is an \$n\$-well-shuffled list of \$A\$ (where \$n\$ is a nonnegative integer) if:

  • For any \$(a_1, a_2, \cdots, a_n) \in A^n\$, \$a_1\$'s position in \$A\$ is \$\neq\$ its position in \$B\$, \$a_2\$'s position in \$A\$ is \$\neq\$ its position in \$B\$, ... and \$a_n\$'s position in \$A\$ is \$\neq\$ its position in \$B\$
  • For any \$(a_1, a_2, \cdots, a_n) \in A^n\$, if \$a_i\$ precedes \$a_j\$ for some \$(i, j) \in [1, n]^2\$ in \$A\$, then \$a_i\$ follows \$a_j\$ in \$B\$

Your task is to take two nonnegative integers \$m, n\$ as input and return how-many \$n\$-well-shuffled lists of lists of length \$m\$ there are.

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

Is this a Hamiltonian cycle?

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

Climbing the Bookshelf

Climbing the Bookshelf

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Can we please have the option to output 0-indexed? \$\endgroup\$
    – ophact
    Jan 25 at 15:48
  • \$\begingroup\$ @ThisFieldIsRequired No, sorry. \$\endgroup\$
    – Ginger
    Jan 25 at 17:19
1
\$\begingroup\$

Is it an action?


Today, you will solve an abstract algebra challenge.

Consider a set \$G\$, which, to simplify things, is a finite subset of \$\mathbb{Z}\$ containing \$0\$. It has a binary operation \$*\$, which for our example will be \$+\$, but your program should be able to handle any binary operation. If \$G\$ is closed under \$*\$, i.e. \$g * g' \in G \forall g, g' \in G\$, there is associativity with regard to \$*\$, there is a unique element in \$G\$, which we will note as \$1_G\$, such that \$1_G * g = g * 1_G = g \forall g \in G\$, and there exists a unique \$g^{-1} \in G \forall g \in G\$ such that \$ g * g^{-1} = g^{-1} * g = 1_G \$, then \$G\$ is a group.

Consider a set \$X\$, which is also a finite subset of \$\mathbb{Z}\$. Then \$\circ: G \times X \to X\$, where \$G\$ is a group, is an action if:

  • \$1_G \circ x = x \forall x \in X\$, and
  • \$g \circ (g' \circ x) = (g * g') \circ x \forall g, g' \in G, x \in X\$ (associativity).

Challenge

Your task is to write a program or function which takes in the following:

  • \$G\$, a finite subset of \$\mathbb{Z}\$ that includes \$0\$;
  • \$X\$, also a finite subset of \$\mathbb{Z}\$, but not necessarily the same as \$G\$;
  • a binary operation \$*\$ that operates within \$G\$ and that makes \$(G, *)\$ a group, which can be taken in any reasonable manner you would like, such as taking it as a function with two parameters, and
  • an "application" \$\circ\$ from \$G \times X\$ to \$X\$, which can be taken in any reasonable manner you would like.

For the purposes of this challenge, \$1_G\$ is always \$0\$.

This program should then output true if \$\circ\$ is an action and false if not. You may use any two distinct values for true and false.

The shortest code, measured in bytes, wins.

Test cases.

\$G = \{0, 1, 2\}\$

\$X = \{1, 2, 3\}\$

\$*\$ defined by \$g * g' = (g + g') mod 3\$

\$\circ\$ defined by \$g \circ x = g + x\$

Output: false because:

  • \$1_G\$ is 0;
  • then \$1_G \circ x = 0 \circ x = 0 + x = x\$;
  • but \$(1 * 2) \circ 2 = 0 \circ 2 = 2 \neq 1 + (2 + 2) mod 3 = 1 + (2 \circ 2) = 1 \circ (2 \circ 2)\$, thus \$\circ\$ is not associative.

\$G = \{0, 1, 2\}\$

\$X = \{0, 1, 2\}\$

\$*\$ defined by \$g * g' = (g + g') mod 3\$

\$\circ\$ defined by \$g \circ x = (g + x) mod 3\$

Output: true because:

  • \$1_G\$ is 0;
  • then \$1_G \circ x = 0 \circ x = (0 + x) mod 3 = x mod 3 = x\$ (because \$x < 3\$);
  • and \$\circ\$ is associative (proof not provided)
\$\endgroup\$
1
\$\begingroup\$

Workout Numbers

I work out semi-regularly, but haven't the faintest clue what I'm doing. On weight machines, I never plan how many reps to do in advance, instead pursuing a dynamic goal based on how much I feel up to:

  • The bare minimum is \$5\$ reps, but I usually do at least \$8\$.
  • However, I feel more satisfied with \$10\$, \$12\$, or \$15\$.
  • If I don't have \$20\$ in me, there's no way in hell I'm doing \$16\$!

A Workout Number is a positive integer which is either a multiple of \$5\$, or a multiple of \$4\$ which does not have an absolute difference of \$1\$ with any multiple of \$5\$.

This is a standard challenge. You may choose to implement one of these three options:

  • Take a positive/nonnegative integer \$n\$, and output the \$n\$th Workout Number, 0- or 1-indexed.
  • Take a positive integer \$n\$, and output the first \$n\$ Workout Numbers.
  • Take no input and output the sequence of Workout Numbers indefinitely.

The first 100 Workout Numbers are:

5,8,10,12,15,20,25,28,30,32,35,40,45,48,50,52,55,60,65,68,70,72,75,80,85,88,90,92,95,100,105,108,110,112,115,120,125,128,130,132,135,140,145,148,150,152,155,160,165,168,170,172,175,180,185,188,190,192,195,200,205,208,210,212,215,220,225,228,230,232,235,240,245,248,250,252,255,260,265,268,270,272,275,280,285,288,290,292,295,300,305,308,310,312,315,320,325,328,330,332

Sandbox questions

  • Is this too trivial? The sequence is just positive integers congruent to one of \$\{0, 5, 8, 10, 12, 15\}\$ mod \$20\$.
    • Would it be more interesting taking an additional input?:
      • An integer \$k\$ for which the sequence consists of multiples of \$k\$ and multiples of \$k-1\$ not adjacent to multiples of \$k\$
      • A list of integers \$k_1...k_i\$ which, in order, populate the sequence with their multiples not adjacent to numbers already in the sequence
        • Subject to the constraint that they are given in descending order?
        • Pairwise coprime?
        • Could this variant work better as a ?
  • Better name? Too much context? I need to spend five minutes actually learning how to exercise effectively?
\$\endgroup\$
1
  • 1
    \$\begingroup\$ the "dynamic goal" thing made me think it was going to be a challenge about determining how much excersize youd be doing in a given section, the sequence thing seems way out of left field and the requirements to be a workout number arbitrary, even in relation to the lore \$\endgroup\$ Feb 3 at 4:43
1
\$\begingroup\$

Quicksand

In this challenge, you take a positive integer as input, which represents the height of a sand pile, located at (0,0) on an infinite square grid. For example, if our input is 123, the sand grid looks initially like this:

\$\begin{matrix} 0 & 0 & 0 \\ 0 &123& 0 \\ 0 & 0 & 0 \end{matrix}\$

Now, piles of sand are unstable, so they topple if their height is 4 or greater. When sand piles topple, they send sand equally in all four directions, but due to the quantum nature of sand, the amount sent is an integer. Or in other words, if there is a pile of height n, it sends sand as follows:

\$\begin{matrix} 0 & \lfloor\frac{n}{4}\rfloor & 0 \\ \lfloor\frac{n}{4}\rfloor & n\mod 4 & \lfloor\frac{n}{4}\rfloor \\ 0 & \lfloor\frac{n}{4}\rfloor & 0 \end{matrix}\$

This means that sandpiles evolve step by step. For example, if we have this initial position, here's how the sandpiles evolve.

\$\begin{matrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 6 & 0 \\ 0 & 2 & 7 & 0 \\ 0 & 0 & 0 & 0 \end{matrix}\$

\$\begin{matrix} 0 & 0 & 1 & 0 \\ 0 & 1 & 3 & 1 \\ 0 & 3 & 4 & 1 \\ 0 & 0 & 1 & 0 \end{matrix}\$

\$\begin{matrix} 0 & 0 & 1 & 0 \\ 0 & 1 & 4 & 1 \\ 0 & 4 & 0 & 2 \\ 0 & 0 & 2 & 0 \end{matrix}\$

\$\begin{matrix} 0 & 0 & 2 & 0 \\ 0 & 3 & 0 & 2 \\ 1 & 0 & 2 & 2 \\ 0 & 1 & 2 & 0 \end{matrix}\$

Now, since all the sandpiles have less than 4 sand, this sand grid is stable.

Rules

Your task is to take an positive integer \$i\$ as input, and output the eventually stable grid that the following initial position evolves to:

Todo add cool fractals

\$\begin{matrix} 0 & 0 & 0 \\ 0 & i & 0 \\ 0 & 0 & 0 \end{matrix}\$

(Note that the grid is still infinitely big)

The output format should be the following: "width;data", where width is an odd number representing the width a square that bounds the eventually stable arrangement (width doesn't have to be the smallest possible). Next is the raw data, which is just the square section of the grid flattened, and the numbers are represented with digits "0123"

\$\endgroup\$
1
  • \$\begingroup\$ by "IO format" do you mean input or output? if its input, i dont understand why youd take the ending width as an input. great pun btw \$\endgroup\$ Feb 3 at 4:46
1
66 67
68
69 70
129

You must log in to answer this question.

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