490
\$\begingroup\$

What is the Sandbox?

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

To post to the Sandbox, scroll to the bottom of this page or click on the "Add Proposal" link below, 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. 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, replace the post here with a link to the challenge and delete it.

See the Sandbox FAQ for more information on how to use the Sandbox.

The Sandbox works best if you sort posts by "active".

Add Proposal

Search the Sandbox

Browse your pending proposals

Get the Sandbox Viewer to view the sandbox more easily

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]

| |
\$\endgroup\$

2970 Answers 2970

1
88 89
90
91 92
99
-1
\$\begingroup\$

Broken FizzBuzz - Greg Is Confused

(FizzBuzz suggested by quartata in chat)

(Related: Deletion of a blank line in source code which causes unexpected functionality, What? No error?, and Write a line in program that looks useless)

Meet Greg. Greg is the new debugger at your company, and he deals with checking programs to see if they work. If they don't, he tries to find out why and fix them.

Greg is rather new to programming and understands the basics, but still gets tripped up by some advanced things. Sometimes, programs don't work and he doesn't know why.

You don't really like Greg, so you decide to play a game. You create two nearly-identical FizzBuzz-style programs - one which works, and one which doesn't.

For example:

n = input()
if (n % 3 == 0) {
 print "Fizz"
}
if (n % 5 == 0) {
 print "Buzz"
}

works, but

n = input()
if (n % 3 = 0) {
 print "Fizz"
}
if (n % 5 == 0) {
 print "Buzz"
}

doesn't. Greg is confused (but not by something as simple as this).

And because Greg has a desk only a few feet away from you, your code must be as small as possible, so he doesn't catch on.

Rules

  • Your correct program must accept an integer as input and return output as specified below, and your incorrect program must do something else (such as throwing an error or giving invalid output).
    • The valid program's output must print "Fizz" if the number is divisible by 3, "Buzz" if it divisible by 5, "FizzBuzz" if it divisible by both 3 and 5, and nothing if it isn't divisible by 3 or 5.
    • The invalid program's output may do anything else.
  • Greg knows all programming languages to date, including super-obscure ones. Therefore, your answer may be in any language you choose (providing it was created before this challenge was posted.)
  • You MUST have the two programs be nearly identical, except for one small change. The more concealed or insignificant-looking, the better.
  • Greg uses PPCG and has participated in underhanded challenges before, so he knows about the C trigraph (??/). You can't trick him with it.
  • Greg has also seen replacing ASCII characters with nearly-identical Unicode or abusing fonts, meaning that won't work either. Therefore, your program's change must work with all fonts, any may not exploit visual similarity between characters with different code-points.
    • Changing an a to an A is allowed, as long as it's not obvious that that's what broke the program. However, changing a to <unicode character that looks exactly the same> is forbidden.
  • Both programs must be written in the same language with the same version.
  • Your answer must include:
    • The language both programs are written in
    • Two programs: one FizzBuzz program, and another that is broken
    • How to run both of them (the commands must be identical with identical arguments)
    • Why one doesn't work (in spoilertext)
    • The output of the broken one
  • Your programs must have a Levenshtein distance of no more than 10 from one-another. (Meaning that you may add, delete, or change up to 10 characters in the broken code from the correct one.)
  • Your score is the total bytecount of both of your programs.
  • The winner is the post with the smallest score over 20 votes.

Meta Questions

  • Is 10 too small a maximum Levenshtein distance? I was also considering 15.
  • Are any of my rules already forbidden by the standard loopholes? I'd like to remove them if possible to make the post shorter.
  • Similarly, should I remove or change any of my rules?
  • This is a code-golf version of this previous edit. Should I keep it as code-golf or change it back?
| |
\$\endgroup\$
  • 1
    \$\begingroup\$ "replacing ASCII characters with nearly-identical Unicode" doesn't really express what that old chestnut does. "Exploiting visual similarity between characters with different code-points" is more accurate. Although it's arguable whether that covers e.g. switching space for non-breaking space, and I don't think it covers using non-whitespace non-printable characters (which with the right font are invisible). \$\endgroup\$ – Peter Taylor Dec 16 '15 at 16:44
  • 4
    \$\begingroup\$ I think there is something interesting here in making seemingly equivalent programs behave very differently. But I'm generally sceptical of underhanded pop-cons, because they're usually way too broad and this one doesn't seem to be an exception. The primary cause is probably that there's no actual task that the program should accomplish. That means you can literally write any code that leads to failure from a small change (which is probably most code although the failure will not be surprising for most of those changes). I'd recommend giving a task for at least one of the two programs. \$\endgroup\$ – Martin Ender Dec 16 '15 at 16:49
  • \$\begingroup\$ @PeterTaylor Maybe something like "Your program's change must work with all fonts, any may not exploit visual similarity between characters with different code-points"? \$\endgroup\$ – ASCIIThenANSI Dec 16 '15 at 16:53
  • \$\begingroup\$ @MartinBüttner I've changed it to two programs that should print "Hello, world!" (only the correct program will work). How does this look? \$\endgroup\$ – ASCIIThenANSI Dec 16 '15 at 16:57
  • 1
    \$\begingroup\$ There are some very closely related underhanded challenges: codegolf.stackexchange.com/q/31647/8478 codegolf.stackexchange.com/questions/23250/what-no-error codegolf.stackexchange.com/questions/19379/… \$\endgroup\$ – Martin Ender Dec 18 '15 at 16:37
  • \$\begingroup\$ @MartinBüttner I've added them in. Do you think they're close enough to be duplicates? \$\endgroup\$ – ASCIIThenANSI Dec 18 '15 at 16:42
  • \$\begingroup\$ @ASCIIThenANSI I can't predict how the community will vote, but I wouldn't mod hammer it. \$\endgroup\$ – Martin Ender Dec 18 '15 at 16:45
-1
\$\begingroup\$

There's an App SE Site for that

Oftentimes, when searching through StackExchange, I find myself seeking to post a question about something or another, but not knowing where to post it. That's where you come in.

The Challenge

Write a full-functioning program that does the following:

  1. Takes an input string
  2. Attempts to find suitable SE sites relevant to the input string (this is very flexible, but should not be returning English.SE for questions about Coffee, for example)
  3. Attempts to find 3 questions on each suitable site that may relate to the input string (should match the list of questions if I searched in the search bar of each site, sorted by number of votes)
  4. "Output" is a folder tree written to disk with the following qualities:
    • The highest folder of the tree should be named the input string.
    • The second-highest layer should consist of folders named the same as the sites on which the input string was found suitable.
    • The third layer should be <=3 .md files that are named the same as the questions found when searching through the suitable sites, the contents of which are the question's markup content.

Rules

  • You MUST query for this information. I don't want 50EB solutions.
  • "Suitable sites" are defined as the keyword appearing in the site description.
  • Run time should be <5 minutes for >3 MB internet speed.

Bonuses

There are no bonuses.

Remember - SE is a big place now, and, as of such, we must compensate with short code. This is , everybody, so the shortest solution wins!

| |
\$\endgroup\$
  • 5
    \$\begingroup\$ "Whatever defines "suitable" for your code is up to you" is too broad IMO. \$\endgroup\$ – Peter Taylor Jan 25 '16 at 14:35
  • \$\begingroup\$ @PeterTaylor Refined. Please see edit. \$\endgroup\$ – Addison Crump Jan 29 '16 at 17:50
  • \$\begingroup\$ @RikerW I don't know what you're saying. \$\endgroup\$ – Addison Crump Jan 29 '16 at 17:57
  • \$\begingroup\$ Me neither. lol \$\endgroup\$ – Rɪᴋᴇʀ Jan 29 '16 at 17:58
  • 2
    \$\begingroup\$ What's the yardstick for whether two words are synonyms? If that's up to answers to decide, no-one will waste any bytes on it, so you should simplify the question by removing the mention of synonyms. Otherwise you need to add a source (and risk the question being largely a kolmogorov-complexity for that list). \$\endgroup\$ – Peter Taylor Jan 29 '16 at 19:48
  • \$\begingroup\$ @PeterTaylor Fixed. \$\endgroup\$ – Addison Crump Jan 29 '16 at 20:45
-1
\$\begingroup\$

Are bug hunts like this allowed?

Bug Hunt - Make a change in a Git repo that Git cannot detect

Challenge: In the working directory of a Git repo, make a change that Git cannot detect.

  • Changes can be on any file in the working directory or subdirectories that is tracked by Git.
  • You may use any tool to make the change, or script your own program to do so.
  • For tools, state the tool used and the steps to reproduce.
  • For script or program, produce the code (please use GitHub Gist if it's too long). State the language and compiler version, if any.
  • You can also do the change manually. In this case, outline the steps.
  • State the version and platform of the Git binary used.
  • Show a comparison between an actual clean working directory and the modified one to show the change Git can't detect.
  • Show that git status says "nothing to commit, working directory clean".

Winning Criterion:

  • The extend of the undetected change - the bigger the change, the better.
  • Reasonably latest Git version.
  • Easy to reproduce.
  • [Optional] Short code or simple steps. It's OK if it's not, as long as you do something exceptional.
  • Most upvotes (for tiebreaker reasons).
  • [Optional] You located an actual unfixed bug in the Git source code, and not just a quirk in something else.

Restrictions:

  • Obviously, using .gitignore is not allowed. It's a bug hunt. Changes that Git is designed to ignore are not allowed. We should reasonably expect Git to see and report the change, but find that Git doesn't.
  • Use latest Git version you can get. Some old version with some bug that's already fixed doesn't count.

Please let me know if this is OK, so I can go ahead to post it on the main site.

I could only find . A suggested tag would have been the best.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Currently bug hunts aren't allowed. Because no one proposed them, you can propose bug hunts by asking a question on meta. \$\endgroup\$ – user48538 Mar 20 '16 at 12:28
  • 1
    \$\begingroup\$ I have a strong feeling that this won't be allowed. We don't allow code that exploits bugs or harms computers. \$\endgroup\$ – Nathan Merrill Mar 20 '16 at 12:31
  • \$\begingroup\$ @NathanMerrill source? \$\endgroup\$ – ADTC Mar 21 '16 at 0:17
  • 2
    \$\begingroup\$ meta.codegolf.stackexchange.com/q/4829/20198 \$\endgroup\$ – Nathan Merrill Mar 21 '16 at 2:21
  • \$\begingroup\$ Is this essentially asking for an AES collision? \$\endgroup\$ – Peter Taylor Mar 21 '16 at 11:14
  • \$\begingroup\$ @PeterTaylor now that wouldn't be a bug, would it? But yes, I guess that's also a valid scenario. Can you create one? \$\endgroup\$ – ADTC Mar 23 '16 at 6:06
  • \$\begingroup\$ This sandbox post has had little activity in a while and little positive reception from the community. Please improve / edit it or delete it to help us clean up the sandbox. \$\endgroup\$ – programmer5000 Jun 9 '17 at 14:11
-1
\$\begingroup\$

Calculate the number of consecutive 0's at the end of n!


Simply put, write a program or function that takes n and returns the number of consecutive 0's at the end of n!


Examples

Input: 12
Output: 2

Input: 12345
Output: 3082

Input: 100000
Output: 24999
| |
\$\endgroup\$
  • \$\begingroup\$ I think this might be a dupe. \$\endgroup\$ – Rɪᴋᴇʀ Apr 2 '16 at 21:45
  • \$\begingroup\$ @EasterlyIrk Do you have a link to the duplicate problem? \$\endgroup\$ – MrPublic Apr 4 '16 at 11:38
  • \$\begingroup\$ This is extremely similar. \$\endgroup\$ – FryAmTheEggman Apr 4 '16 at 17:20
  • 2
    \$\begingroup\$ This proposal would be similar to finding the position of the last nonzero digit, but it's not similar to the linked challenge, which finds the value of the last nonzero digit \$\endgroup\$ – Luis Mendo Apr 6 '16 at 11:14
-1
\$\begingroup\$

Self-identification before golfing

Since golfed code is harder to read, answers often contain an less golfed version. There are a number of potential golfing transformations depending on the language, so you may be able to score more highly using a more traditional language. Some examples of golfing transformations:

  • Removal of spaces, tabs and/or newlines
  • Removal of disambiguating parentheses
  • Removal of braces around single controlled statements
  • Conversion from statements to comma operator
  • Removal of explicit return statements
  • Renaming identifiers

Your challenge is to write a program or function that can identify an ungolfed version of itself. Scoring is based on the number of golfing transformations that can be recognised. The submission must be capable of identifying all "original" code that is itself capable of self-identification (at least one such code must exist). Each supported transformation scores 1 point, but there are also bonus points available:

  • 1 bonus point if the transformation can be repeated multiple times
  • 1 bonus point of the program rejects at least one invalid transformation of itself (e.g. white space added inside a keyword)
  • 1 bonus point if the program only accepts valid transformations of itself
  • 1 bonus point if the transformation shortened the code (so if you only supported renaming a 1-letter variable to another letter, you would not qualify)
  • 1 bonus bonus point if in addition the transformed program recognises the original program as a transformation of itself

Example: A submission accepts the name of another program as a command-line parameter. It opens itself using its own name hard-coded into itself. It recognises the following transformations:

  • A change to the hard-coded file name (3 points, as there is only one file)
  • A change to the amount of space between words (5 points, as there are no invalid transformations to reject)
  • A change to the names of its variables (4 points, as it doesn't check whether the variables are renamed consistently or to keywords)

Total score: 12 points.

In the event of a tie on score, shortest code wins.

Tags: code-golf, quine

| |
\$\endgroup\$
  • 4
    \$\begingroup\$ This is hopelessly subjective. \$\endgroup\$ – feersum Apr 5 '16 at 13:35
-1
\$\begingroup\$

Random Wikipedia Browsing

Here's a short one for you. Create a program or function prints or returns the title of a random Wikipedia page (similar to Alt + x functionality)

Rules:

  • Program or function will take no input
  • Program or function will print to STDOUT (or nearest equivalent) or return only the page name. I don't care about trailing spaces or newlines. Preceding spaces or new lines are disallowed
  • Program or function may not access a list of Wikipedia page names stored within a local file.
  • There is no requirement to use English language Wikipedia (en.wikipedia.org)
  • Page must be chosen (psuedo) randomly

For reference, here is a link to the Wikipedia API. Shortest program or function in bytes wins.

| |
\$\endgroup\$
  • \$\begingroup\$ Bash: xdg-open http://bit.ly/19UDVJs (I think it's open). That Bitly link points to the Random Page link, which redirects to a random page. Wouldn't be hard to find a shorter URL, either. \$\endgroup\$ – Fund Monica's Lawsuit Apr 14 '16 at 17:10
  • \$\begingroup\$ Aww man, I had no idea that existed, guess it makes this pretty trivial \$\endgroup\$ – wnnmaw Apr 14 '16 at 17:11
  • \$\begingroup\$ Yep. Though if the language's builtins don't support automatic handling of redirects, it might be more challenging. \$\endgroup\$ – Fund Monica's Lawsuit Apr 14 '16 at 17:11
  • \$\begingroup\$ Could I disallow using that link? \$\endgroup\$ – wnnmaw Apr 14 '16 at 17:12
  • \$\begingroup\$ I dunno, to be honest. I'm not very good at writing challenges. \$\endgroup\$ – Fund Monica's Lawsuit Apr 14 '16 at 17:13
  • \$\begingroup\$ Relevant chat discussion, this challenge is trival \$\endgroup\$ – wnnmaw Apr 14 '16 at 17:21
  • \$\begingroup\$ @wnnmaw the Random Page is often used for wiki-racing. It's pretty fun. You can do either shortest distance (pages traversed), or fastest time. Maybe you could make this into a King of the Hill challenge to write a bot that wiki-races against other bots? \$\endgroup\$ – mbomb007 Apr 21 '16 at 18:15
-1
\$\begingroup\$

What can I build?

The Rules

Today I have decided to make geometric shapes out of toothpicks and gumdrops! However, I have a limited supply, so you have to figure out what I can build. I will give you an input in the format m n, where m is toothpicks (edges) and n is gumdrops (vertices.) Your output should be, in any output format of your choice, all 3D geometric shapes such that the amount of edges=m and the amount of vertices=n. The list of 3D geometric shapes you will use is this: Gist

  • You may NOT access the Internet.
  • No builtins relating to geometry or solids
  • This is code golf, so shortest code wins.
  • For no solids and invalid input, output nothing

Examples

In: 3 2 Out: <empty>
In: CodeGolf123 Out: <empty>
In: 12 6 Out (Bonus): {regular tetrahedron,unit equilateral square pyramid,unit equilateral triangular dipyramid,unit equilateral triangular prism,unit equilateral pentagonal pyramid,regular octahedron} Out (Regular): {regular octahedron} `

| |
\$\endgroup\$
  • \$\begingroup\$ The first 3 rules can be deleted, as they're ppcg defaults \$\endgroup\$ – Bálint May 22 '16 at 20:03
  • \$\begingroup\$ Not the first... \$\endgroup\$ – user46167 May 22 '16 at 20:04
  • \$\begingroup\$ I think this would work better with 1 solid with exactly n and m edges and sides. \$\endgroup\$ – Rɪᴋᴇʀ May 22 '16 at 20:29
  • \$\begingroup\$ How about doing that, but having this as a bonus? \$\endgroup\$ – user46167 May 22 '16 at 20:37
  • 4
    \$\begingroup\$ 1. KISS. Ditch the stuff about the external file: the overhead to load it and the overhead generated by requiring it to be UTF-8 mean that no-one would want to use it anyway. 2. "No builtins" literally bans people from using any language. Specify what built-ins are banned. 3. Make the data available in a usable format: i.e. a text file hosted on gist.github.com or pastebin. 4. The bonus is a no-brainer: a 10% saving for changing two == to <=. Either make it compulsory or remove it entirely, because as it stands it's just complication. \$\endgroup\$ – Peter Taylor May 22 '16 at 22:38
  • \$\begingroup\$ @petertaylor: I am currently on a phone so I can't put a gist... \$\endgroup\$ – user46167 May 23 '16 at 10:42
  • 2
    \$\begingroup\$ There are a lot of shapes in that gist. Some of them are specified in different formats. If they're all to be supported it would be nice to have a standard format to represent them. Also some of these shapes specify different edge lengths. Will the challenge assume all edges are length 1 or will you potentially need to break toothpicks and keep track of the remaining pieces? \$\endgroup\$ – Poke May 26 '16 at 21:02
  • 1
    \$\begingroup\$ @Poke 1. Will fix 2. Irrelevant-- you have all sorts of toothpicks, some miniscule and others huge. \$\endgroup\$ – user46167 May 26 '16 at 23:43
-1
\$\begingroup\$

Golf a golf-scoring program!

Given a space delimited array of integers, find the smallest number. It's that simple.

[Meta] This may in fact be a duplicate. Please tell me if so.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ This is basically a dupe of any regular sorting question, isn't it? Particularly something like Sign that word. \$\endgroup\$ – FryAmTheEggman Jun 9 '16 at 12:52
-1
\$\begingroup\$

Quine-ify PPCG Answers!

Write a program that, when executed, returns the markdown file to your answer.

So, something like this:

#Python: 123 bytes

`{insert code here}`

Required things:

  • Header must be one hash (#)
  • The "code part" must be indented with four spaces (or surrounded with backticks if it's a one-liner).
  • The code part must be the actual code used to run the program.
  • There must be a separation of a newline between the header and the code.
  • The program's display bytecount MUST equal the program's actual bytecount.

Meta:

  • Most importantly: is it even possible, at all?
  • Do I need more clarifications?
  • Has this been done already?
| |
\$\endgroup\$
  • 4
    \$\begingroup\$ "Most importantly: is it even possible, at all?" Definitely possible and in most languages no more difficult than a standard quine. The points in this answer probably apply as well. Also the third-to-last paragraph in this answer since languages with longer names will have a disadvantage. And finally, there's this related challenge (same thing without the quine part). \$\endgroup\$ – Martin Ender Jul 27 '16 at 7:25
  • \$\begingroup\$ Actually, it's just too easy. Just use a normal quine with stuff before. \$\endgroup\$ – Erik the Outgolfer Aug 3 '16 at 17:50
-1
\$\begingroup\$

Your task is to print the Champernowne constant (A033307) indefinitely.

There must be no spaces in your output and the solution with the fewest bytes wins!

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ 1. The Cham-whatever constant has infinitely many digits, making this challenge the same as this \$\endgroup\$ – Leaky Nun Aug 4 '16 at 18:23
  • 1
    \$\begingroup\$ 2. Duplicate. \$\endgroup\$ – Leaky Nun Aug 4 '16 at 18:25
  • \$\begingroup\$ @LeakyNun To prevent this being a duplicate could the challenge be "Print the Champernowne constant in base n", where the input is the base? \$\endgroup\$ – ASCIIThenANSI Aug 5 '16 at 14:35
  • \$\begingroup\$ Also, this question isn't self contained. If you were to post an acceptably modified version of this, please explain what this constant/sequence is within the question itself, even if there is a link \$\endgroup\$ – MildlyMilquetoast Jan 20 '17 at 1:03
-1
\$\begingroup\$

Left and Right

Given an input string, in ASCII, output ")|]" as many times as the case-insensitive word "right" appears in input, and output "(|[" as many times as the case-insensitive word "left" appears in input. The order is irrelevant. If and only if no occurences of these words are in input, output "X|X". Spacing between items is optional

This is , less bytes is best

Test cases:

input -> output
RightRightighteftleft -> (|[ )|] )|], or some other ordering
this doesn't contain either word -> X|X
LEfT, LeFT, leFT, righT -> (|[ (|[ (|[ )|]
(|[ -> X|X
| |
\$\endgroup\$
-1
\$\begingroup\$

Enterprise Quality Code!

Summary of this challenge

Print (to make it more fair when competing with another language changing the output method could be a trivial way to golf) the first N Prime numbers. Your score will be the sum of the byte counts of all entries which no one has been able to golf down (by removing one or more characters and rearrange the program). If you golf down someones program, post it as another submission.

You may not golf your own programs once submitted.


This is not a dupe because it significantly changes the scoring method. Writing code which allows a single byte to be golfed off will cost the whole of the score. Also as this is a challenge the winner is likely going to have high scores across a multitude of languages. It is likely that scores will be incredibly near 30k for each language. This limit allows a more interesting competition as it prevents submissions of exponentially large lengths.

Back-story and explanation

At Pretty Good consultants there is a focus on writing "quality" verbose code that is sufficiently engineered. Your boss has decided to test you on your skills.


Consider the set of all programming languages in existence before the posting of this challenge. For this challenge there will technically be one individual "winner" in each language, however the boss will give a promotion accepted tick mark to only one answer based on your score.
The goal of this challenge is to receive an integer N strictly smaller than 2^16-1 and print the first N prime numbers (in less than 24 hours) separated by your platforms choice of new line. OEIS sequence A000040 in as many bytes as possible in as many languages as possible. However, note that others vying for the promotion will try to "help" you by golfing down your score.

Sample output for an input 11

2
3
5
7
11
13
17
19
23
29
31

How to participate

Pick any language X, but please avoid selecting a language which is just another version or derivative of another answer. If there is no existing answer in language X than you will write a program (which must fit into a single post) that solves this challenge. The length in bytes of the source (in any reasonable preexisting textual encoding) will be added to your score. You must avoid using any unnecessary characters for reasons that will soon become apparent.

If language X already has been used to answer this question, then you must answer using any permutation of any proper subset of the characters used in the shortest answer (I.E take the shortest X answer and remove some (>=1) characters and optionally rearrange the resulting code). The previous holder of the shortest X answer will lose all of the bytes provided by his answer from his score, and the number of bytes of your submission will now be added to your score. The number of bytes golfed off gets "lost" forever.


Clarifications shamelessly lifted adapted from this challenge

Rules for Languages

Languages used should be distinctly different. A language is different iff:

  • It is not a different version of another language (Java 7, Java 8)
  • They must not be derived from another language (Branf*** versus Alphf***)
  • One language may not be a subset or superset or trivial of the other one (e.g. hq9+ versus hq9+b).

HQ9+ wouldnt be a language anyway, but please be judicious when selecting a language, if you have any clarifications on a language that may be significantly different from an existing answer please ping me and we can work it out.


| |
\$\endgroup\$
  • \$\begingroup\$ If anyone knows how to make a scoreboard for this I will be much obliged \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 17:28
  • \$\begingroup\$ So the highest score wins, overall (from all your still-valid answers). And when you outgolf somebody, they lose their points, you gain your points, but do you get the points that they lost? \$\endgroup\$ – Rɪᴋᴇʀ Aug 20 '16 at 17:42
  • \$\begingroup\$ @EasterlyIrk the way I had it planned out is that the amount of bytes golfed off is forever lost. I don't know if thats fair but that essentially prevents people from "profiting" off of ridiculous answers that were not fortified against being golfed. \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 17:49
  • 2
    \$\begingroup\$ Yeah, that's what I figured. You might want to clarify that a bit though. I really like the idea. \$\endgroup\$ – Rɪᴋᴇʀ Aug 20 '16 at 17:52
  • \$\begingroup\$ @EasterlyIrk clarifications added, let me know if this is ready for main \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 17:59
  • 2
    \$\begingroup\$ It might be ready, but you should wait for somebody else to also give input. \$\endgroup\$ – Rɪᴋᴇʀ Aug 20 '16 at 18:01
  • \$\begingroup\$ All right sounds good \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 18:04
  • 2
    \$\begingroup\$ 1. So basically the accepted answer goes to the shortest answer in Unary? 2. The tags code-golf and code-bowling are mutually exclusive. This isn't really either. \$\endgroup\$ – Peter Taylor Aug 20 '16 at 19:49
  • \$\begingroup\$ @PeterTaylor please read the whole thing. The answer must fit within 30k \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 20:02
  • \$\begingroup\$ If someone can write a brainf*** program that is only about 6 chars long or so than they deserve the accept tick \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 20:03
  • \$\begingroup\$ @RohanJhunjhunwala Golunar wins \$\endgroup\$ – Rɪᴋᴇʀ Aug 20 '16 at 22:07
  • \$\begingroup\$ @EasterlyIrk lol thats actually just a compressed form of Brainf*** it probably wouldn't score that well \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 23:15
  • \$\begingroup\$ @PeterTaylor essentially I restrict answers to fit in one post which means the best score for a single language is slightly under 30 characters \$\endgroup\$ – Rohan Jhunjhunwala Aug 20 '16 at 23:15
  • 2
    \$\begingroup\$ I find the intro confusing. I didn't understand what the challenge is broadly about until reading to the end. Can you cleanly state the challenge at the beginning, and move the details later? \$\endgroup\$ – xnor Aug 21 '16 at 0:42
  • 1
    \$\begingroup\$ @trichoplax the overall winner with the highest score summed up over all of their answer posts will receive the tick on their highest scored post. It doesn't really matter which post in particular (as long as it is a post of the winner) receives the tick, but it makes sense to tick off the highest scoring post. \$\endgroup\$ – Rohan Jhunjhunwala Aug 21 '16 at 12:44
-1
\$\begingroup\$

Find all paths in a matrix maze.

A maze is represented as a two-dimensional array of 0s and 1s. Zero indicates a closed door and one indicates an open door. An example representation of maze is given below.

0100
0010
1101

to avoid loops input square matrix should not contain a square of once like

111      11
101  or  11
111

Write an application either in Java,C,C++,Python,C# or Javascript. It takes as input a maze(mxn array) and prints out all the possible ways out.

• No database should be used.

• Yes...Way out is any edge containing 1.

• Enter from any edges of the maze

• Exit from any edges of the maze

• Should not enter and exit from the same door

• Move can be one unit distance either top/bottom/left/right/diagonal

For the above maze, one possible way out is: [0,1] -> [1,2] -> [2,3] i.e you start at [0,1] and then move to [1,2] and then to [2,3]. There are other possible ways as you can see.

| |
\$\endgroup\$
  • \$\begingroup\$ Probable dupes: One, Two \$\endgroup\$ – Emigna Sep 8 '16 at 15:10
  • 4
    \$\begingroup\$ Also, restricting challenges to specific languages are frowned upon. An objective winning criterion is also needed. \$\endgroup\$ – Emigna Sep 8 '16 at 15:10
  • \$\begingroup\$ @Emigna, No Actually, here we need to find all the paths not the shortest path or straight path and here we can also traverse diagonal in the matrix. \$\endgroup\$ – Ali786 Sep 8 '16 at 15:15
  • \$\begingroup\$ okay will add few more languages that I know so that I can evaluate ... \$\endgroup\$ – Ali786 Sep 8 '16 at 15:16
  • 1
    \$\begingroup\$ 1. "Handle error cases like a production application" is not a clear requirement. Different production applications have different standards for how to handle errors. 2. "prints out all the possible ways out" runs into trouble when there's an infinite number, and I don't see any guarantee that there won't be loops. 3. The example doesn't make the input format very clear. What's the non-rectangular border for? 4. Path-finding with a trivial input format is definitely a dupe of at least one previous question. \$\endgroup\$ – Peter Taylor Sep 8 '16 at 15:31
  • \$\begingroup\$ @PeterTaylor, I have modified my question, can you plz check once. \$\endgroup\$ – Ali786 Sep 8 '16 at 16:04
-1
\$\begingroup\$

Quine tree

Inspired by that really weird quine challenge

For this challenge, you must construct a quine tree, which is a thing I made up, specifically an infinite binary tree.

How a quine tree works:

A quine tree has infinite nodes.

  • Each node is associated with a program

    • Let X, Y, Z, be the programming languages. This program is a polyglot in X and Y. In all but the root node, it is also a polyglot in Z. Note the

    • see below for more details

  • Each node has exactly two children

  • Every node but the root has a parent. Their parent has the node as a child (obviously).

Programs:

  • When a node's program is run in X, it produces the program of the first child of that node.
  • When run in Y, it produces the program of the second child of that node.
  • The programs produced must be different (node foo's program, cannot have the same output in X and Y. This output must also be different than the nodes program).
  • If not the root node, when run in Z, it produces the parent of the node.

Example

Imagine that we have the (fake) programming languages Hello, World, and Foobaz. Say the root node is $QQ$QQ$;:

  • when run in Hello, perhaps it produces $QQ$QQ$;;
    • When this is run with Hello again, perhaps produces $QQ$QQ$;;;
    • When this is run with World, perhaps produces $QQ$QQ$;;Q
    • Both these programs must produce, run in Foobaz, $QQ$QQ$;; (Output of root node run in Hello)
  • when run in World, perhaps it produces $QQ$QQ$;Q
    • When this is run with Hello, perhaps produces $QQ$QQ$;Q;
    • When this is run with World again, perhaps produces $QQ$QQ$;QQ
    • Both these programs must produce, run in Foobaz, $QQ$QQ$;Q (Output of root node run in World)
  • Both these programs, run in Foobaz, must produce $QQ$QQ$; (root program).
| |
\$\endgroup\$
  • \$\begingroup\$ This seems like a really interesting challenge. I'm not sure how possible it is, though! Substitution languages like /// might be easiest to solve this in. \$\endgroup\$ – wizzwizz4 May 27 '17 at 8:20
-1
\$\begingroup\$

The only differences that matter

Cops' task

Write two programs (or functions) A and B in the same version of the same programming language. They also should be called in the same way, meaning you can't write one program and one function. Each should accept an integer n and output the term n of a different integer sequence on OEIS.

You should reveal a substring of each of A and B. Call them PA and PB. If one instance of PA is replaced by PB from A, it should become B. That means every byte except the reveal part in A and B should be exactly the same. You also reveal the lengths of A and B, and the two OEIS sequences. You don't reveal the programming language you use.

Your answer is cracked if a robber finds two programs A' and B' that also print the elements in the two integer sequences respectively, where A' is no longer than A, and A' with one instance of PA replaced by PB is also B'. They don't have to be the same with your original A and B. And they don't have to be in the same programming language as yours, as long as they are in the same programming language themselves.

If your answer isn't cracked 7 days after you post the answer, you can reveal your language and the original A and B and mark the answer safe, and it will be immune to future crack. Your answer can still be cracked if you don't do it.

Your score is max(len(A)+len(PA)*5, len(B)+len(PB)*5). The safe answer posted before a certain date with the minimum score wins.

For example, if your two programs are The first program and The second program, you can reveal first and second. Your score is 18 + 6*5 = 48. And a robber can crack your answer by <<first>> <<second>> if they work. But you can also reveal first pro and second pro to prevent this crack.

Please post your answer using this template:

# <length of PA> / <length of A> bytes, <length of PB> / <length of B> bytes, score <score>, <open / safe / cracked>

Part of program A (outputing [<OEIS number>](<OEIS link>)):

    <code of PA>

Part of program B (outputing [<OEIS number>](<OEIS link>)):

    <code of PB>

<any other explanations>

Robbers' task

(To do.)

| |
\$\endgroup\$
  • \$\begingroup\$ Do robbers have to produce the same program, or any program? \$\endgroup\$ – Nathan Merrill Oct 28 '16 at 14:47
  • \$\begingroup\$ There are two tricky edge cases around character encodings which the question needs to address. 1. It talks about substrings of A and B, saying that every byte except the revealed ones must be the same. If A and B differ in one Unicode codepoint, such that in UTF-8 they differ in only one byte but it's part of a three-byte sequence, can I post just that one byte as PA/PB or must I post the three-byte sequence? (I.e. are the substrings operating on the bytes or on the codepoints?) \$\endgroup\$ – Peter Taylor Oct 28 '16 at 20:57
  • \$\begingroup\$ 2. If my program is in APL using an 8-bit encoding, do robbers answering in a language other than APL have to have the same bytes in the part of their file corresponding to PA/PB or the same Unicode codepoints? \$\endgroup\$ – Peter Taylor Oct 28 '16 at 20:57
  • \$\begingroup\$ @NathanMerrill Any program. \$\endgroup\$ – jimmy23013 Oct 28 '16 at 21:05
  • \$\begingroup\$ @PeterTaylor I'm considering requiring every program to be in printable ASCII (and tabs and newlines), as some special characters effectively banned many languages. But I'm not sure about newlines, which have the \r problem. \$\endgroup\$ – jimmy23013 Oct 28 '16 at 21:09
  • \$\begingroup\$ Maybe I'll just say \r\n is counted one byte in this challenge, and is interchangeable with \n. But the programs in one submission must use only \n or only \r\n. \$\endgroup\$ – jimmy23013 Oct 28 '16 at 21:13
  • \$\begingroup\$ An example would make this easier to understand, \$\endgroup\$ – xnor Oct 29 '16 at 6:08
  • 2
    \$\begingroup\$ I'm skeptical about having the programming language be a free variable. If a cop writes an answer using a verbose language, a robber can comment out all the visible parts and stuff a terse language answer into the cracks. \$\endgroup\$ – feersum Oct 29 '16 at 11:24
  • \$\begingroup\$ @feersum But that's the whole point of all the requirements. If you comment out all the visible parts, both your programs usually should output the same thing. But I realized it's easy to have some workarounds in languages such as Befunge. I may try to find a way to ban them, or just abandon this post. \$\endgroup\$ – jimmy23013 Oct 31 '16 at 0:59
-1
\$\begingroup\$

Translation Polyglot

Your task is to write a program which runs in two distinct programming languages to translate text. Input should be translated between each language i.e. running your code in Code Language A translates from language 1 to 2, while running your code in Code Language B translates from language 2 to 1.

Rules:

  • Code Languages must be distinct, two versions of the same language are disallowed
  • Your code may be a full program or function
  • Your code must take one string (or nearest equivalent) as input. Input may be user input, function arguments, or other reasonable form
  • Output may be a function return, output to STDOUT, or other reasonable form. I do not care about trailing newlines or spaces
  • Your code may translate from/to any language on the official language list on Wikipedia. List the languages in your answer
  • To accomplish your goal, you may use prebuilt language tanslation dictionaries such as the ones found here.
  • If you read your dictionary as an external file, only the code to read in the file (f = open("dictionary.txt", 'r') in Python) counts towards your byte count. If your dictionary is hardcoded in, only count the bytes required to make it syntatically valid code (s="word1_in_english word1_in_french ..." would be 4 (s="")). Essentially, do not include the dictionary as part of your submissions byte count.
  • The dictionary you use must have been created before this post (including sandbox time). You may not modifiy the dictionary in any way.
  • Any built-in translation tools are disallowed. Built-in dictionaries are ok, but whatever code used to import them into your code must be included in the byte count

This is code golf, so shortest answer in bytes wins.

| |
\$\endgroup\$
  • \$\begingroup\$ wait... Are you actually asking for machine translation? Seems very difficult. Haven't you ever seen bad translator? If it actually is machine translation, this won't work, because of the different resolution of the languages (like converting a jpg to a png and expecting the same quality back) \$\endgroup\$ – Destructible Lemon Nov 1 '16 at 4:11
  • \$\begingroup\$ It's really just value lookup. I'm not asking people to to make their own dictionary, just use a pre-built and accept whatever it translates \$\endgroup\$ – wnnmaw Nov 1 '16 at 13:45
  • \$\begingroup\$ But that doesn't really satisfy Language A produces output O from input I, while running in Language B produces output I from input O. \$\endgroup\$ – Destructible Lemon Nov 1 '16 at 22:04
  • \$\begingroup\$ Ah, now I see the source of confusion. Updated text to require basic translation, not symmetric translation \$\endgroup\$ – wnnmaw Nov 2 '16 at 11:53
  • \$\begingroup\$ Also I don't think translation is objective enough for code golf... \$\endgroup\$ – Destructible Lemon Nov 3 '16 at 5:30
-1
\$\begingroup\$

What in the heck just happened?

I want you to write a program that will bleep out the H-word, regardless of where it occurs, whether it is inside of another word or a stand-alone word, whether capitalized or not.

Input and Output

The inputs and outputs of your program may be any of the following: an array of characters, a string, or any other standard data structure which does the job. However, the output must match the case of the input.

Samples:

In the format of Input: Output
A Shell gas station : A Sheck gas station
Hell is a very bad place to be. : Heck is a very bad place to be.
Ella fell and Nelly dug a well. : Ella fell and Nelly dug a well.
Chellsea Thell bought shells. : Checksea Theck bought shecks.

Standard loopholes apply, and the entry submitted by [insert date here] with the lowest number of bytes as defined by the Meta will win.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ I can't say for sure, as I don't have an exact reference, but I'm pretty sure a simple find and replace challenge has been done before. \$\endgroup\$ – ATaco Feb 13 '17 at 0:19
  • 1
    \$\begingroup\$ "Hell" and "heck" are both "H-words", so you need to be clearer. Also, I feel like this is a duplicate. Though these are milder swear words, I think someone did one with swear words in general and it got deleted. If you're going to make a find/replace challenge, it's simple enough to make it about something else. \$\endgroup\$ – mbomb007 Feb 13 '17 at 0:19
  • \$\begingroup\$ Ah, I see. So, are you saying I should change what's being replaced or what my idea is? \$\endgroup\$ – Drew Christensen Feb 14 '17 at 0:50
-1
\$\begingroup\$

Google Logo in Conway's Game of Life

Conway's Game of Life base challenges are always fun so here is a new one.

This is Google's Logo (if you have not somehow seen it): Google Logo

The font is called Product Sans. Your job is to replicate this logo (no color of course) in 800x439px just like the image (just the letters).

Have fun! This is a popularity contest so the most votes wins. :D Good luck. Of course, this may not be possible but, you never know until you try.

Usual rules apply.

Inspired by this.

| |
\$\endgroup\$
  • 6
    \$\begingroup\$ "looks like" isn't a tight enough specification for a challenge. \$\endgroup\$ – user45941 May 29 '17 at 21:20
  • 1
    \$\begingroup\$ Also consider some method besides first-past-the-post, that winning criteria doesn't really work well with this site. \$\endgroup\$ – FryAmTheEggman May 30 '17 at 0:22
  • 1
    \$\begingroup\$ So the answer could replicate it at the 0th generation? \$\endgroup\$ – Peter Taylor May 30 '17 at 10:48
  • \$\begingroup\$ @PeterTaylor Good point \$\endgroup\$ – arodebaugh May 30 '17 at 13:14
  • \$\begingroup\$ @FryAmTheEggman Popularity contest? \$\endgroup\$ – arodebaugh May 30 '17 at 13:14
  • \$\begingroup\$ @Mego Also good point \$\endgroup\$ – arodebaugh May 30 '17 at 13:15
  • \$\begingroup\$ OK I updated stuff maybe it will make this challenge better \$\endgroup\$ – arodebaugh May 30 '17 at 13:16
  • 3
    \$\begingroup\$ 1. I don't see how the change you've made addresses my previous point. 2. Pop-con is barely any better than fastest-gun-in-the-west. 3. It's possible to test whether this is possible or not (I highly doubt it) by running the CA backwards. \$\endgroup\$ – Peter Taylor May 30 '17 at 16:09
-1
\$\begingroup\$

The 2017 Loader contest

Here's a thing: Let's do the bignum bakeoff again.

Because why not.

What to do

Write a program in less than 256 characters that outputs the biggest number you can.
Yep, that's it. Biggest return value wins.

We'll run the program on a VM with infinite memory. (How do we do this?)

Rules

  • 256 chars max, excluding whitespace
  • Different leagues for each language
  • Output however you want
    • No explicitly printing numbers until your loop runs out. Print the number you generate directly. {1}
  • Program must terminate
  • No implementation-dependent shenanigans.
  • Implementation-independent shenanigans is encouraged.
  • ints are infinite.
  • Program must return the same number every time
  • Submission must include the approximate return value in any suitable googological notation.
  • Whitespace is space, tab, newline, formfeed, and return
    • BrainF***: Whitespace is all non-[]+-<> characters

{1} Allowed ways to return: printf("%d", num); return num;, etc.
Banned ways to return: for(;num>0;num--)printf("99999");, etc.


This is not a dupe of...

This because you can put any characters you want, not just non-digits; because we're hard-limiting the characters.


Suggested rules

  • No floats: float double long double, etc
  • No strings or chars
  • No bitfeilds
  • No looking at Command-line args

Next year's contest will be named after this year's winner, for no particular reason.

http://djm.cc/bignum-rules-posted.txt


Sandbox

  • How do you even test these programs?
  • What other rules should we have?
| |
\$\endgroup\$
  • \$\begingroup\$ You don't actually explain the rules of the challenge, we would have to go to that link to find out what we are supposed to do. Aside from that, I think this has a lot of problems with your typing restrictions if these are not limited to C, but limiting it to C wouldn't really fit the spirit of the site. I think you may want to rethink how you want to approach this question. \$\endgroup\$ – FryAmTheEggman May 29 '17 at 16:43
  • \$\begingroup\$ @FryAmTheEggman "Typing restrictions"? (Added proper instructions) \$\endgroup\$ – SIGSTACKFAULT May 29 '17 at 16:45
  • \$\begingroup\$ Your post doesn't describe how people win. Is it by the largest possible number? Anyway, the problems are things like not counting whitespace, which can easily result in degenerate answers, as well as things like I/O streams and whatnot. All of your extra rules seem entirely based around C with no regard for other languages, which will not go well. \$\endgroup\$ – FryAmTheEggman May 29 '17 at 16:48
  • 4
    \$\begingroup\$ In answer to "Because why not": because it will be closed as a dupe. \$\endgroup\$ – Peter Taylor May 29 '17 at 17:59
  • \$\begingroup\$ Here's a couple of rules I would consider. 1. Program must generate the same result every time (e.g. not based on timer, probability, or the like). 2. Submissions should include, if not the exact resulting number, at least a best estimate, in scientific notation if need be. \$\endgroup\$ – Computronium May 30 '17 at 18:32
  • \$\begingroup\$ Scientific notation? People will post answers that far, far exceed that. In fact, Mathematica, 22: Fold[Power,2~Range~9999] It's 2^3^4^...^9999. That's not being represented anytime soon. \$\endgroup\$ – CalculatorFeline May 31 '17 at 3:31
  • 1
    \$\begingroup\$ This is a duplicate, and is also going to come down a lot to whether or not you allow programs that exceed the computational capacity of any existing computer. (If you require programs to work on a physical computer, the best they can possibly do is to use the entirety of memory as a counter and print out 9s over and over again. If you don't, the answers can easily be large enough that you need to use notation invented specifically for describing the number, because all other notations are not enough.) \$\endgroup\$ – user62131 May 31 '17 at 22:40
  • \$\begingroup\$ If your code can simulate a Turing machine, it becomes hard to judge who the winner is, and whether an answer is valid at all. \$\endgroup\$ – anatolyg Jun 1 '17 at 20:35
  • \$\begingroup\$ Re your latest edit: you're wrong. The question it's a dupe of also has a hard limit to the number of characters; in fact it's a harder one, but the best answers could be copied with slight tweaking to take advantage of the extra space. And the digit restriction turned out not to be a serious problem: the winning answer would gain extremely little from being able to use digits. \$\endgroup\$ – Peter Taylor Jun 2 '17 at 9:07
-1
\$\begingroup\$

Golf Cubically code

Your task is to optimize Cubically source code using one or more optimizations in this post.

How this challenge works:

  • You will choose one or more optimizations below and write a program (in the language of your choice) that performs those optimizations on a Cubically program.
  • Your program will take a Cubically program as input using any allowed input methods, and output a Cubically program using any allowed output methods.
  • The first answer to successfully perform all optimizations wins!

Optimizations

1. Face turn arguments

Before a face turn is performed, the interpreter calculates turns = turns mod 4. So R5 would be equivalent to R1 which is equivalent to R, R7 is equivalent to R3 which is equivalent to R', etc. Also note that R11111 is equivalent to R5, and R22 is equivalent to nothing at all.

Performing this optimization will mean evaluating all arguments to an R, L, U, D, M, E, or S command and shortening them as much as possible.

Test cases:

Relevant code -> Optimization
R11           -> R2
R1            -> R
L33           -> L2
U22           ->
D222          -> D2
M11111        -> M
E00001        -> E
S9            -> S

2. Repeated face turn

When multiple calls to the same face turn command are present right next to each other, they can clearly be golfed. For example, R2R1 is equivalent to R3. UUU is equivalent to U3. F2F2F2F2 is equivalent F8.

Test cases:

Relevant code -> optimization
R2R2R2        -> R6            (R2 if you also choose optimization 1)
LLL           -> L3
UU            -> UU or U2
D3D2D1        -> D6            (D2 if you also choose optimization 1)

3. "Set notepad to" commands

There are some commands that, instead of adding to/subtracting from/multiplying by/dividing by the notepad, just assign to it. Here are all such commands:

_^=<>⊕«»·|:

When called with multiple arguments, since each argument calls the command separately, only the final argument is relevant. So =123 is equivalent to =3, _00000 is equivalent to _0, and :12345678987654321 is equivalent to 1.

Test cases:

Relevant code -> Optimization
_333          -> _3
=12321        -> =1
+54321        -> +54321
:55           -> :5
/55           -> /55

4. Repeated non-face-turn commands

When multiple face turn commands are present right by each other, their arguments can simply be added together. Commands do not act this way. While R2 calls R with 2, =2 calls = with the face sum of the front face (face index 2).

To perform this optimization, when multiple commands outside of RLUDFBMES appear next to each other, simply remove the duplicated commands without removing the arguments.

Relevant code -> Optimization
_1_1_1_1      -> _1111         (_1 if you also choose optimization 3)
%11%22%33     -> %112233       (%3 if you also choose optimization 3)
+12345+67+8   -> +12345678

5. Nonexistent commands

Go check out the Cubically commands page and you'll see that there are plenty of characters that are not commands. For example, there are no commands that are lowercase letters.

To perform this optimization, remove all nonexistent commands and their arguments from the Cubically source. If the commands also have arguments, you must remove the arguments so that they are not passed to the previous command.

Test cases:

Relevant code -> Optimization
moo cow moo   -> 
moo2cow2moo   -> 
misteR2 FOO   -> R2F
FEAR ME.      -> ERME
u1U2u3U4u5U6  -> U2U4U6   (nothing if you also choose optimization 1, U12 if you also choose optimization 2)

6. Non-implicit commands

There are lots of implicit commands in Cubically (RLUDFBMES()$~&E!), but there are plenty that need to be called with arguments. So %%%% is equivalent to nothing at all while %%2%% is equivalent to %2.

Test cases:

Relevant code -> Optimization
%%%%          -> 
$$$$          -> $$$$
++2++2++2     -> +2+2+2                 (+222 if you also choose optimization 4)
+++>--<-      -> Not Brainf**k, sorry!  (:P)

Sandbox

I'll add more optimizations later.

| |
\$\endgroup\$
  • \$\begingroup\$ Clarification on R123: That's the same as R6 and R2, not R3, right? Digits are summed, there are multidigit numbers? That would be better to specify \$\endgroup\$ – isaacg Aug 17 '17 at 20:13
  • \$\begingroup\$ A few things: first, I can't find the tag "fgitw", is there a typo? Second, does optimization 1 require handling F and B as well, or just the currently listed ones? Third, in optimization 3 most of the listed commands seem invalid because the notepad is used in calculation and then overwritten with the output; for example =11 is not the same as =1 in most circumstances. In fact, I think only _: are valid. Fourth, is the winning answer one which performs all optimizations in a single program, or one which contains a separate program for each optimization? \$\endgroup\$ – Kamil Drakari Aug 18 '17 at 18:03
-1
\$\begingroup\$

Proper Kerning

Kerning is the adjustment of spacing between pairs of letters in order to obtain an aesthetic result. When kerning is applied automatically by a program (typically whatever editor you're using), it is said to be automatic. There are two types of automatic kerning. The one used in this challenge is metric kerning. With metric kerning, the amount of space between pairs of letters is dictated by the kerning tables found in the font file.

Given a TrueType font file, output the kerning values for each mapping in the kerning table for ASCII characters 48 - 122 inclusive.

Example

calibri.ttf

l="A" r="C" v="-15"
l="A" r="G" v="-15"
l="A" r="J" v="23"
l="A" r="O" v="-23"
l="A" r="Q" v="-23"
l="A" r="T" v="-160"
l="A" r="U" v="-32"
l="A" r="V" v="-89"
l="A" r="W" v="-80"
l="A" r="Y" v="-150"
l="A" r="t" v="-52"
l="A" r="v" v="-38"
l="A" r="y" v="-41"
l="A" r="?" v="-68"
l="B" r="A" v="-20"
l="B" r="T" v="-48"
l="B" r="V" v="-25"
l="B" r="W" v="-24"
l="B" r="X" v="-44"
l="B" r="Y" v="-57"
l="B" r="Z" v="-20"
l="B" r="f" v="-20"
l="B" r="t" v="-20"
l="B" r="v" v="-20"
l="B" r="x" v="-15"
l="B" r="y" v="-20"
l="C" r="G" v="-18"
l="C" r="J" v="12"
l="C" r="O" v="-18"
l="C" r="Q" v="-18"
l="C" r="T" v="10"
l="D" r="A" v="-30"
l="D" r="J" v="-22"
l="D" r="T" v="-23"
l="D" r="V" v="-24"
l="D" r="W" v="-14"
l="D" r="X" v="-31"
l="D" r="Y" v="-39"
l="D" r="Z" v="-22"
l="E" r="A" v="-22"
l="E" r="C" v="-24"
l="E" r="G" v="-24"
l="E" r="O" v="-32"
l="E" r="Q" v="-32"
l="E" r="S" v="-20"
l="E" r="Z" v="-10"
l="E" r="a" v="-34"
l="E" r="c" v="-28"
l="E" r="d" v="-30"
l="E" r="e" v="-37"
l="E" r="f" v="-64"
l="E" r="o" v="-37"
l="E" r="q" v="-30"
l="E" r="t" v="-24"
l="E" r="v" v="-48"
l="E" r="w" v="-34"
l="E" r="y" v="-48"
l="F" r="A" v="-115"
l="F" r="C" v="-18"
l="F" r="G" v="-18"
l="F" r="J" v="-109"
l="F" r="O" v="-18"
l="F" r="Q" v="-18"
l="F" r="S" v="-29"
l="F" r="X" v="-22"
l="F" r="Z" v="-11"
l="F" r="a" v="-55"
l="F" r="c" v="-28"
l="F" r="d" v="-20"
l="F" r="e" v="-30"
l="F" r="o" v="-28"
l="F" r="q" v="-20"
l="F" r="s" v="-35"
l="G" r="T" v="-10"
l="G" r="V" v="-10"
l="G" r="W" v="-9"
l="G" r="Y" v="-30"
l="G" r="v" v="-29"
l="G" r="w" v="-22"
l="G" r="x" v="-14"
l="G" r="y" v="-30"
l="J" r="A" v="-35"
l="J" r="X" v="-20"
l="K" r="C" v="-78"
l="K" r="G" v="-80"
l="K" r="O" v="-97"
l="K" r="Q" v="-97"
l="K" r="S" v="-18"
l="K" r="U" v="-29"
l="K" r="W" v="-34"
l="K" r="a" v="-34"
l="K" r="c" v="-40"
l="K" r="d" v="-33"
l="K" r="e" v="-37"
l="K" r="f" v="-25"
l="K" r="m" v="-32"
l="K" r="n" v="-32"
l="K" r="o" v="-37"
l="K" r="p" v="-32"
l="K" r="q" v="-33"
l="K" r="r" v="-32"
l="K" r="s" v="-18"
l="K" r="t" v="-38"
l="K" r="u" v="-32"
l="K" r="v" v="-101"
l="K" r="w" v="-95"
l="K" r="y" v="-85"
l="L" r="C" v="-22"
l="L" r="G" v="-47"
l="L" r="J" v="25"
l="L" r="O" v="-45"
l="L" r="Q" v="-45"
l="L" r="T" v="-150"
l="L" r="U" v="-44"
l="L" r="V" v="-147"
l="L" r="W" v="-118"
l="L" r="Y" v="-167"
l="L" r="f" v="-23"
l="L" r="t" v="-38"
l="L" r="v" v="-78"
l="L" r="w" v="-72"
l="L" r="y" v="-79"
l="O" r="A" v="-23"
l="O" r="J" v="-27"
l="O" r="T" v="-55"
l="O" r="V" v="-25"
l="O" r="W" v="-22"
l="O" r="X" v="-64"
l="O" r="Y" v="-55"
l="O" r="Z" v="-38"
l="O" r="x" v="-12"
l="O" r="z" v="-10"
l="P" r="A" v="-151"
l="P" r="J" v="-140"
l="P" r="T" v="-9"
l="P" r="V" v="-10"
l="P" r="X" v="-35"
l="P" r="Y" v="-11"
l="P" r="Z" v="-29"
l="P" r="a" v="-44"
l="P" r="c" v="-43"
l="P" r="d" v="-34"
l="P" r="e" v="-41"
l="P" r="f" v="12"
l="P" r="o" v="-41"
l="P" r="q" v="-34"
l="P" r="s" v="-32"
l="P" r="t" v="12"
l="P" r="y" v="12"
l="Q" r="J" v="41"
l="Q" r="T" v="-47"
l="Q" r="V" v="-25"
l="Q" r="W" v="-12"
l="Q" r="X" v="12"
l="Q" r="Y" v="-46"
l="Q" r="g" v="59"
l="Q" r="j" v="79"
l="Q" r="x" v="31"
l="Q" r=";" v="60"
l="Q" r="]" v="32"
l="R" r="C" v="-18"
l="R" r="G" v="-19"
l="R" r="O" v="-20"
l="R" r="Q" v="-20"
l="R" r="S" v="-27"
l="R" r="T" v="-20"
l="R" r="V" v="-28"
l="R" r="W" v="-18"
l="R" r="Y" v="-30"
l="R" r="e" v="-36"
l="R" r="o" v="-42"
l="R" r="v" v="-26"
l="R" r="w" v="-33"
l="R" r="y" v="-33"
l="S" r="A" v="-15"
l="S" r="J" v="-9"
l="S" r="T" v="-14"
l="S" r="V" v="-14"
l="S" r="W" v="-15"
l="S" r="X" v="-13"
l="S" r="Y" v="-20"
l="S" r="v" v="-23"
l="S" r="w" v="-17"
l="S" r="y" v="-25"
l="T" r="A" v="-160"
l="T" r="C" v="-42"
l="T" r="G" v="-59"
l="T" r="J" v="-65"
l="T" r="O" v="-58"
l="T" r="Q" v="-58"
l="T" r="S" v="-10"
l="T" r="T" v="28"
l="T" r="a" v="-160"
l="T" r="c" v="-177"
l="T" r="d" v="-147"
l="T" r="e" v="-182"
l="T" r="g" v="-151"
l="T" r="m" v="-127"
l="T" r="n" v="-127"
l="T" r="o" v="-182"
l="T" r="p" v="-127"
l="T" r="q" v="-147"
l="T" r="r" v="-127"
l="T" r="s" v="-153"
l="T" r="u" v="-127"
l="T" r="v" v="-92"
l="T" r="w" v="-86"
l="T" r="x" v="-90"
l="T" r="y" v="-93"
l="T" r="z" v="-142"
l="T" r=";" v="-114"
l="T" r=":" v="-134"
l="U" r="A" v="-45"
l="U" r="J" v="-40"
l="V" r="A" v="-96"
l="V" r="C" v="-18"
l="V" r="G" v="-25"
l="V" r="J" v="-80"
l="V" r="O" v="-27"
l="V" r="Q" v="-27"
l="V" r="S" v="-12"
l="V" r="V" v="9"
l="V" r="a" v="-114"
l="V" r="c" v="-103"
l="V" r="d" v="-87"
l="V" r="e" v="-102"
l="V" r="g" v="-100"
l="V" r="m" v="-50"
l="V" r="n" v="-50"
l="V" r="o" v="-86"
l="V" r="p" v="-50"
l="V" r="q" v="-87"
l="V" r="r" v="-50"
l="V" r="s" v="-90"
l="V" r="u" v="-50"
l="V" r="y" v="-35"
l="V" r="z" v="-82"
l="V" r=";" v="-108"
l="V" r=":" v="-73"
l="W" r="A" v="-93"
l="W" r="C" v="-22"
l="W" r="G" v="-22"
l="W" r="J" v="-88"
l="W" r="O" v="-22"
l="W" r="Q" v="-22"
l="W" r="S" v="-10"
l="W" r="X" v="-13"
l="W" r="a" v="-71"
l="W" r="c" v="-78"
l="W" r="d" v="-72"
l="W" r="e" v="-75"
l="W" r="g" v="-54"
l="W" r="m" v="-60"
l="W" r="n" v="-60"
l="W" r="o" v="-86"
l="W" r="p" v="-60"
l="W" r="q" v="-72"
l="W" r="r" v="-60"
l="W" r="s" v="-73"
l="W" r="u" v="-60"
l="W" r="v" v="-34"
l="W" r="y" v="-53"
l="W" r=";" v="-156"
l="X" r="C" v="-57"
l="X" r="G" v="-65"
l="X" r="O" v="-57"
l="X" r="Q" v="-57"
l="X" r="S" v="-20"
l="X" r="d" v="-44"
l="X" r="e" v="-39"
l="X" r="g" v="-9"
l="X" r="o" v="-38"
l="X" r="q" v="-44"
l="X" r="t" v="-31"
l="X" r="u" v="-38"
l="X" r="v" v="-55"
l="X" r="w" v="-49"
l="X" r="y" v="-43"
l="Y" r="A" v="-152"
l="Y" r="C" v="-67"
l="Y" r="G" v="-67"
l="Y" r="J" v="-112"
l="Y" r="O" v="-66"
l="Y" r="Q" v="-66"
l="Y" r="S" v="-17"
l="Y" r="Z" v="-10"
l="Y" r="a" v="-134"
l="Y" r="c" v="-159"
l="Y" r="d" v="-131"
l="Y" r="e" v="-147"
l="Y" r="f" v="-62"
l="Y" r="g" v="-142"
l="Y" r="i" v="-32"
l="Y" r="j" v="-49"
l="Y" r="m" v="-94"
l="Y" r="n" v="-94"
l="Y" r="o" v="-153"
l="Y" r="p" v="-94"
l="Y" r="q" v="-131"
l="Y" r="r" v="-94"
l="Y" r="s" v="-115"
l="Y" r="t" v="-44"
l="Y" r="u" v="-94"
l="Y" r="v" v="-69"
l="Y" r="w" v="-62"
l="Y" r="x" v="-70"
l="Y" r="y" v="-65"
l="Y" r="z" v="-100"
l="Y" r=";" v="-138"
l="Y" r=":" v="-154"
l="Z" r="A" v="-11"
l="Z" r="C" v="-25"
l="Z" r="G" v="-24"
l="Z" r="O" v="-24"
l="Z" r="Q" v="-24"
l="Z" r="W" v="-7"
l="Z" r="Y" v="-7"
l="Z" r="a" v="-10"
l="Z" r="c" v="-12"
l="Z" r="d" v="-18"
l="Z" r="e" v="-31"
l="Z" r="o" v="-29"
l="Z" r="q" v="-18"
l="Z" r="v" v="-45"
l="Z" r="w" v="-38"
l="Z" r="y" v="-37"
l="a" r="f" v="-12"
l="a" r="t" v="-19"
l="a" r="v" v="-34"
l="a" r="w" v="-14"
l="a" r="x" v="-19"
l="a" r="y" v="-38"
l="b" r="f" v="-17"
l="b" r="s" v="-10"
l="b" r="t" v="-9"
l="b" r="v" v="-10"
l="b" r="w" v="-10"
l="b" r="x" v="-41"
l="b" r="y" v="-10"
l="b" r="z" v="-28"
l="c" r="a" v="-17"
l="c" r="o" v="-17"
l="e" r="f" v="-18"
l="e" r="t" v="-11"
l="e" r="v" v="-10"
l="e" r="w" v="-10"
l="e" r="x" v="-31"
l="e" r="y" v="-13"
l="e" r="z" v="-20"
l="f" r="a" v="-40"
l="f" r="c" v="-45"
l="f" r="d" v="-53"
l="f" r="e" v="-51"
l="f" r="f" v="-20"
l="f" r="g" v="-60"
l="f" r="o" v="-43"
l="f" r="q" v="-53"
l="f" r="s" v="-27"
l="f" r="v" v="13"
l="f" r="w" v="6"
l="f" r="y" v="10"
l="f" r="z" v="-20"
l="g" r="a" v="-38"
l="g" r="c" v="-12"
l="g" r="d" v="-19"
l="g" r="e" v="-17"
l="g" r="g" v="19"
l="g" r="o" v="-14"
l="g" r="q" v="-19"
l="g" r="t" v="-31"
l="h" r="f" v="-12"
l="h" r="t" v="-19"
l="h" r="v" v="-34"
l="h" r="w" v="-14"
l="h" r="x" v="-19"
l="h" r="y" v="-38"
l="k" r="a" v="-35"
l="k" r="c" v="-48"
l="k" r="d" v="-56"
l="k" r="e" v="-66"
l="k" r="o" v="-69"
l="k" r="q" v="-56"
l="k" r="s" v="-19"
l="k" r="t" v="-10"
l="k" r="u" v="-26"
l="m" r="f" v="-12"
l="m" r="t" v="-19"
l="m" r="v" v="-34"
l="m" r="w" v="-14"
l="m" r="x" v="-19"
l="m" r="y" v="-38"
l="n" r="f" v="-12"
l="n" r="t" v="-19"
l="n" r="v" v="-34"
l="n" r="w" v="-14"
l="n" r="x" v="-19"
l="n" r="y" v="-38"
l="o" r="v" v="-9"
l="o" r="w" v="-8"
l="o" r="x" v="-40"
l="o" r="y" v="-11"
l="o" r="z" v="-27"
l="p" r="f" v="-17"
l="p" r="s" v="-10"
l="p" r="t" v="-9"
l="p" r="v" v="-10"
l="p" r="w" v="-10"
l="p" r="x" v="-41"
l="p" r="y" v="-10"
l="p" r="z" v="-28"
l="q" r="g" v="10"
l="r" r="a" v="-42"
l="r" r="c" v="-30"
l="r" r="d" v="-28"
l="r" r="e" v="-27"
l="r" r="g" v="-28"
l="r" r="o" v="-33"
l="r" r="q" v="-28"
l="r" r="s" v="-35"
l="r" r="v" v="19"
l="r" r="w" v="11"
l="r" r="y" v="10"
l="s" r="f" v="-19"
l="s" r="t" v="-23"
l="s" r="v" v="-31"
l="s" r="w" v="-10"
l="s" r="x" v="-22"
l="s" r="y" v="-37"
l="s" r="z" v="-18"
l="t" r="a" v="-25"
l="t" r="c" v="-25"
l="t" r="d" v="-23"
l="t" r="e" v="-22"
l="t" r="o" v="-20"
l="t" r="q" v="-23"
l="t" r="t" v="-29"
l="v" r="a" v="-30"
l="v" r="c" v="-25"
l="v" r="d" v="-20"
l="v" r="e" v="-20"
l="v" r="f" v="11"
l="v" r="g" v="-28"
l="v" r="o" v="-19"
l="v" r="q" v="-20"
l="v" r="s" v="-9"
l="v" r="t" v="10"
l="v" r="v" v="12"
l="v" r="w" v="12"
l="v" r="y" v="12"
l="v" r="z" v="-26"
l="w" r="a" v="-23"
l="w" r="c" v="-20"
l="w" r="d" v="-18"
l="w" r="e" v="-18"
l="w" r="f" v="6"
l="w" r="g" v="-18"
l="w" r="o" v="-19"
l="w" r="q" v="-18"
l="w" r="s" v="-18"
l="w" r="t" v="4"
l="w" r="v" v="12"
l="w" r="w" v="8"
l="w" r="y" v="12"
l="w" r="z" v="-17"
l="x" r="a" v="-37"
l="x" r="c" v="-46"
l="x" r="d" v="-44"
l="x" r="e" v="-54"
l="x" r="o" v="-55"
l="x" r="q" v="-44"
l="x" r="s" v="-12"
l="x" r="t" v="6"
l="x" r="u" v="-20"
l="y" r="a" v="-31"
l="y" r="c" v="-26"
l="y" r="d" v="-24"
l="y" r="e" v="-25"
l="y" r="f" v="10"
l="y" r="g" v="-26"
l="y" r="o" v="-24"
l="y" r="q" v="-24"
l="y" r="s" v="-19"
l="y" r="t" v="10"
l="y" r="v" v="12"
l="y" r="w" v="8"
l="y" r="y" v="10"
l="y" r="z" v="-17"
l="z" r="a" v="-34"
l="z" r="c" v="-45"
l="z" r="d" v="-46"
l="z" r="e" v="-46"
l="z" r="f" v="-10"
l="z" r="g" v="-17"
l="z" r="o" v="-45"
l="z" r="q" v="-46"
l="z" r="s" v="-22"
l="z" r="u" v="-10"
l="z" r="v" v="-18"
l="z" r="w" v="-22"
l="z" r="y" v="-18"

Scoring

This is , so the shortest answer (in bytes) wins.

Meta

I know this challenge is going to need a lot of work before it's ready for main. Please hold criticisms for now. Helpful ideas and thoughts are welcome.

| |
\$\endgroup\$
  • \$\begingroup\$ I'm not sure that the problem is well defined. There's a reason it's called font hinting: the rendering application is free to take it into account or not, or even to apply more complex logic. E.g. some fonts have multiple sets of font hints for different contexts. There are other complex issues. A font can have Latin and Cyrillic letters and define hints for kerning between pairs of Latin and pairs of Cyrillic but not between Latin and Cyrillic; however, some letters may have identical glyphs, so a judgement on whether the kerning is "correct" might be ambiguous. Then there's antialiasing. \$\endgroup\$ – Peter Taylor May 24 '17 at 6:15
  • \$\begingroup\$ @PeterTaylor Good notes. I will likely restrict the character set. I just wanted to start getting ideas down in the sandbox. \$\endgroup\$ – Poke May 24 '17 at 6:51
  • \$\begingroup\$ Very ambiguous. \$\endgroup\$ – anna328p May 25 '17 at 17:48
  • \$\begingroup\$ @Mendeleev It's not done yet. I'm aware it's ambiguous. \$\endgroup\$ – Poke May 26 '17 at 16:10
  • \$\begingroup\$ Looking at developer.apple.com/fonts/TrueType-Reference-Manual/RM06/… I can see a number of issues to address. 16- vs 32-bit entries? Should multiple tables be combined or printed separately? All tables or only tables with certain coverage values? Which of the four defined formats need to be supported? Do you have a test case which covers glyph index differing from codepoint? \$\endgroup\$ – Peter Taylor Sep 16 '17 at 17:28
  • \$\begingroup\$ @PeterTaylor I have a proof of concept that I wrote (it's the reason I have taken so long to update this) and I'm planning to address all of your questions. Thanks for doing a bit of research to help me out, though :] \$\endgroup\$ – Poke Sep 16 '17 at 18:57
  • \$\begingroup\$ Downvoter, why? \$\endgroup\$ – Poke Oct 4 '17 at 21:03
-1
\$\begingroup\$

Six Flags over HTTP

Let's say you need to transmit six boolean flags in a URL string. Obviously you could do it with six ones or zeroes, but you want better compression. With a little math you can pack them into two characters using 0-7 octal.

How about mapping all six to a single ASCII character? Here we have a problem: you are not allowed to use , / ? : @ & = + $ # or space. Now the range of printable ASCII no longer has 64 valid characters in a row.

In Javascript (or another language that can run from a web page, if any), what is the shortest code for a pair of functions to encode and decode this data, between an array of six booleans and a single character?

| |
\$\endgroup\$
  • \$\begingroup\$ -1 language restriction, most languages have HTTP libraries so I think any language should be allowed \$\endgroup\$ – ASCII-only Sep 24 '17 at 13:11
  • \$\begingroup\$ This challenge could be improved by rephrasing it to: "Write a bijective function between an array of six booleans and a single printable character excluding the characters ,/?:@&=+$# ". Mentioning that the encoder and decoder should be separate programs/functions would be helpful. Also, may the encoder and decoder share code? \$\endgroup\$ – fireflame241 Sep 24 '17 at 22:08
-1
\$\begingroup\$

Count letter frequency

Inspired by question Tweetable hash function challenge, you should take the English dictionary used there and produce a program or function that outputs the the absolute and relative frequency of each character. It is CASE SENSITIVE and the APOSTROPHE is also accountable as a real letter.

Example of a valid output format (but with stupid guessing values):

A      5566    20%
...
Z        60     0.2%
a     27000    30%
...
z       120     0.01%
'       450     3.5%

It is , but no answer will be accepted. Wanna know shortest script for each language.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ -1 (01) Don't rely on another challenge to define yours; include all the information we need in your write-up. (02) Make an effort to come up with some actual test cases - do you honestly expect us to verify our solutions against "stupid guessing values"? \$\endgroup\$ – Shaggy Sep 30 '17 at 0:55
-1
\$\begingroup\$

Is it a perfect loop?

Your task is to take a GIF or an animated image in any reasonable format as input (including taking the file name of a GIF in the current directory), and output whether it is a "perfect loop" - that is, the frames transition seamlessly from the end to the start, and a human cannot notice where it starts and ends at first glance. Return or print a truthy value if it is a perfect loop, otherwise print or return a falsy value.

Scoring

Winners will be determined from the percentage of test cases they get correct. In the event of a tie, highest votes wins. You can view test cases at https://ghostbin.com/paste/m3yaw. Show your score against the test cases when you post.

Input

If you are not taking input in a GIF, please provide a program that will convert a GIF to your desired format.

Images corresponding to a truthy value have been taken from /r/perfectloops and for falsy test cases, /r/almostperfectloops and /r/gifs.

Restrictions

  • Hard coding is not allowed (violates standard loophole 1 and 2).
  • You must provide consistent results for the same GIF (no randomness)
  • Remember, this is not , so byte count is not needed in your solution. Just post the language name and add the percentage correct when I comment.
| |
\$\endgroup\$
  • \$\begingroup\$ I'm not sure it's as simple as comparing the first to the last frame, if it is we'd have duplicate frames. is this challenge allowing HTTP requests? \$\endgroup\$ – tuskiomi Oct 17 '17 at 21:15
  • \$\begingroup\$ If hashing the inputs is not allowed, then you should clearly define what constitutes a “perfect loop”. It's not good to extrapolate from a handful of test cases where the pass/fail cases are very similar. \$\endgroup\$ – japh Oct 18 '17 at 14:31
-1
\$\begingroup\$

Highest code size∕output ratio to generate a large executable section inside an elf file.

Your challenge is to create the shortest code in your language of choice or the tools of your choice (like objcopy) that will create an elf file with a the executable section as large as possible.
I mean that if I extract the.text section of the elf binary, the resulting extracted file should be at least 90% of the elf binary.

Requirements

  • The program should takes the desired section size as input.
  • The .text section name needs to corresponds to the executable section.
  • The type of the .text section should bePROGBITSand it should contains instructions.
  • The elf file should have a .shstrtab section.
  • The .text section should be readable and writable.
  • The target architecture should be Pnacl or armelv7 or x86_64.
  • The elf file should be valid and pass Google nacl’s validation whitelist in order to be loaded (but I don´t care if the sandbox segfault).
    If you have no idea about what Google native client is, just create a script that call the patched version of binutils from the nacl_sdk, or make sure the elf file is valid and can be executed on Linux.

Of course, you normally can’t use a compiler because it would takes too much computational years in order to finish.

Winner

The answer with the highest code size∕program output ratio.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Why not make scoring output size / code size? \$\endgroup\$ – anna328p Apr 4 '17 at 3:49
  • \$\begingroup\$ Make it a code-challenge \$\endgroup\$ – anna328p Apr 4 '17 at 3:49
  • \$\begingroup\$ This is essentially the same challenge as this one, and would be closed as a duplicate. Although it's not exactly the same, some answers to the previous question would require very little modification and answers to this question would also require very little modification to be answers to the other one. \$\endgroup\$ – Peter Taylor Apr 4 '17 at 8:37
  • \$\begingroup\$ @Alt-F4 : it was a code challenge. \$\endgroup\$ – user2284570 Apr 4 '17 at 21:52
  • \$\begingroup\$ @PeterTaylor : they were no answer to the previous question. In order to be closed as a duplicate the target needs to be already answered. You known it was closed an unclear, so please suggest change to make this answer clearer. \$\endgroup\$ – user2284570 Apr 4 '17 at 21:54
  • \$\begingroup\$ Huh? It's open and has 15 answers. \$\endgroup\$ – Peter Taylor Apr 4 '17 at 22:09
  • \$\begingroup\$ @PeterTaylor sorry, I thought to an another question that was closed as unclear and didn’t take time to read your link. In that case NO, the aim is to not use the compiler in order to actually build the file. This normally can’t be done with a compiler or an assembler. \$\endgroup\$ – user2284570 Apr 4 '17 at 22:16
  • \$\begingroup\$ Can't it? Why not? \$\endgroup\$ – wizzwizz4 Dec 16 '17 at 19:55
  • \$\begingroup\$ Wait... shortest code that generate any program? Or what? Don't think this is a good idea... \$\endgroup\$ – user202729 Jan 6 '18 at 12:10
-1
\$\begingroup\$

Removing a Letter adds a Letter

Your program should output nothing when unaltered, however, when any single character is removed it should have an output length of 1. This extends to any number of characters being removed from the program, as long as there is, at minimum, a single character remaining.


For example, if my program were abcdefg, it should output nothing if unaltered.

However, if I were to remove a and d from this program to get bcefg, it should output any two printable characters that represent 16 bytes of information (2 characters for 2 characters removed).

  • So if bcefg outputs (00,AA,etc...) this is valid.

Taking this further, if we were to remove all but the letter g we'd need an output of 6 characters.

  • So if g outputs ('000000','@$^%@(',etc...) this is valid.

Your program must function for all possible combinations of removals that are possible, that is to say each single letter in your program should be a valid program.


Rules

  • You may "lock" pieces of the code, each locked byte counts for 2-bytes instead of 1-byte.
    • Locked bytes will never be removed.
    • For instance, if my program was abcdefg and bcd is locked, the shortest program we'll get is abcd,bcde,bcdf and bcdg.
    • If bcd was locked in abcdefg it'd be 10 bytes, not 7.
  • The program may output any byte to represent 1 removed character, N-bytes for N removed chars in the code itself.
| |
\$\endgroup\$
  • \$\begingroup\$ The rule only leads to totally locked code \$\endgroup\$ – l4m2 Mar 13 '18 at 0:13
  • \$\begingroup\$ @l4m2 hah. I disagree. \$\endgroup\$ – Magic Octopus Urn Mar 13 '18 at 0:58
  • \$\begingroup\$ But more constructively, increase the penalty? Limit locked chars? \$\endgroup\$ – Magic Octopus Urn Mar 13 '18 at 1:04
  • \$\begingroup\$ Maybe require an unlocked percent? \$\endgroup\$ – l4m2 Apr 6 '18 at 10:52
-1
\$\begingroup\$

Sandbox:

Is this question already available (duplicate)?

Are things too vague?

Does providing the example help or hinder?

Tidy the Pantry (easy)

I hate grocery shopping, particularly the part where I put groceries away--so I'm calling upon the collective hive-mind to handle that.

Challenge

Your challenge is to take a 1D-list of groceries and a 2D pantry as input; and output an newly assorted pantry. The two variables can be of your type choice, and in any order, but please specify what item types your program requires (e.g. string, array, etc.).

Rules & Additional info.

Scoring

  • This is code golf, so the shortest answer in bytes wins

Rules

  • The pantry should be ordered alphabetically (A - Z, left to right, top to bottom)
    • For simplicity, the pantry is case-insensitive
  • The pantry must retain its horizontal size (but trailing newlines are optional)
  • "Pockets" (empty spaces) should be filled between items (i.e. only the last item is allowed to have a trailing pocket)
  • If the pantry is too small for the incoming groceries, then the pantry must replace older items (Z being the oldest, A the youngest)
    • Z from groceries is younger than A in pantry
  • Standard loopholes are forbidden

Examples ([ and ] are used for readability)

Input (4x4 pantry):

[A][A][ ][ ]
[ ][ ][B][ ]
[C][ ][ ][ ]
[ ][ ][ ][D]

AAD

Output:

[A][A][A][A]
[B][C][D][D]
[ ][ ][ ][ ]
[ ][ ][ ][ ]

Input (2x2 pantry):

[A][B]
[C][D]

XYZ

Output:

[A][X]
[Y][Z]

Example solution

JavaScript ES6 (989 bytes)

// (String, String) -> String
let organise = (pantry, groceries) => {
  let n = pantry.split("\n").sort((a, b) => b.length - a.length); // used at the end of the function for horizontal sizing
  n = n[0].length;

  pantry = pantry
    .replace(/\W/g, "") // get rid of all non-alphanumeric characters
    .split("");         // turn the string into an array

  // we need the properties of the new array
  // so the extra `pantry = pantry` is needed
  pantry = pantry
    .slice(0, pantry.length - groceries.length) // go ahead and remove the last overlapping elements
    .concat(groceries)                          // add the groceries to the pantry
    .join("")                                   // turn into a string
    .split("")                                  // turn into an array
    .sort()                                     // sort the array
    .join("");                                  // turn into a string

    return pantry.replace(RegExp(`(.{${n}})`, 'g'), "$1\n");
};

/** Testing below **/

console.log("Test #2:\n" + organise(
`AJCHDJE
JJ   JA
    ASD
OOQ I U
Q     W
      R`,

'AHJBCJHDHHATTGEH'
))


Test Cases:

Test #1, 4x4 pantry

TVCX <- pantry
ABCD
ATDJ
UAIK

XYXY <- groceries
----
AAAB <- expected output
CCDD
IJKT
XYXY

Test #2, 7x6 pantry

AJCHDJE
JJ   JA
    ASD
OOQ I U
Q     W
      R

AHJBCJHDHHATTGEH
-------
AAAAABC
CDDDEGH
HHHHJJT
T

Test #3, 10x10 pantry

AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA

ZZZZZZZZZZZZZZZZZZZZ
----------
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
AAAAAAAAAA
ZZZZZZZZZZ
ZZZZZZZZZZ

Test #4, 16x16 pantry pantry

ASDFGHJKLZXCVBNM
QJKAJ  KAKSJD  J
KJASDKFHI YOIER
W   OSDOFJ    DK
E PPPASP     AS
R
TASD 
YAAAAAAAAAAAA
U          JHOLK
IIAUSHODUYOAISUO
OASD  AUSODI 
PIASND JUASJNOIJ
A ASJDH PPOIO 
QHIAIUSOIUOOO
WYYAIUSNNAJSDASD
EAISDUUIOPJPIJPJ
ROQPEWIHRNXCAISD

QWERTYUIOP
----------------
AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
ABCCDDDDDDDDDDDD
DDDEEEEEFFFGHHHH
HHHIIIIIIIIIIIII
IIIIIIJJJJJJJJJJ
JJJJJJKKKKKKKKLL
MNNNNNNOOOOOOOOO
OOOOOOOOOOPPPPPP
PPPPPPQQQQRRRRRS
SSSSSSSSSSSSSSSS
SSSTTUUUUUUUUUUU
UVWWY

Test #5, 2x2 pantry

HE
LO

[no groceries]
--
HE
LO
| |
\$\endgroup\$
  • 1
    \$\begingroup\$ why divide the program score? \$\endgroup\$ – RedClover Feb 26 '18 at 19:03
  • 1
    \$\begingroup\$ I recommend you do count by bytes otherwise someone is just going to encode their entire program in Chinese characters and win. \$\endgroup\$ – HyperNeutrino Feb 26 '18 at 19:09
  • \$\begingroup\$ @labela--gotoa To get a golfed score (smaller programs get a smaller score), should I change it? \$\endgroup\$ – Ephellon Dantzler Feb 26 '18 at 19:13
  • \$\begingroup\$ @EphellonDantzler I don't understand why not just normal scoring...? \$\endgroup\$ – RedClover Feb 26 '18 at 19:14
  • \$\begingroup\$ LOL, that's why I set in in Sandbox first @labela--gotoa \$\endgroup\$ – Ephellon Dantzler Feb 26 '18 at 19:16
  • 1
    \$\begingroup\$ Some notes on your reference implementation: 1 It appears far too soon in the challenge. 2 It's not 1768 bytes. 3 You need to ungolf it and make it readable or it's not much use. 4 As it's JS, create a Snippet for it. 5 Is it necessary? It seems to be thrown in there to try to patch over any holes in the challenge spec. \$\endgroup\$ – Shaggy Feb 26 '18 at 23:17
-1
\$\begingroup\$

Interpret pseudocode

Wikipedia says pseudocode

is intended for human reading rather than machine reading.

and

A program in pseudocode is not an executable program.

I don't care.

Make a pseudocode interpreter that can run pseudocode that fits the rules described below*. This is based on the IB pseudocode guide, but it is simplified quite a bit to make it fit for the challenge.


Pseudocode specifications

This is a simplified pseudocode to make the challenge less tedious. The pseudocode language has no strings, no arrays, no classes, no methods, and no variables other than integers.

Basic syntax

Comments that start at // and end at a newline (like java one-line comments). // is not necessarily followed by a space, and the comment may be empty. Example:

A = 2 + 3 // I can't write five because my keyboard is broken

Statements are separated by newlines. Lines may be empty (without statements). The exact number of spaces doesn't matter, and spaces are not required. The language is case sensitive.

Variables

All variables are global, and can be accessed anywhere. They do not need to be declared. To keep things simple, all variables can be assumed to be integers. All variable names are UPPERCASE, and consist only of letters. Your program should at least handle integers from -256 to 256. A wider range is not a requirement.

Variables are assigned values using this syntax:

VARIABLE = Expression

Where VARIABLE can be any uppercase name and expression can be any integer expression, as discussed below.

Examples:

A = 5
B = A + 3
NUMBER = A * B

Expressions

An expression can be:

  • An integer, like 42
  • A variable, like NUMBER
  • A binary operation on two other expressions, like NUMBER + 5. There are only four operations: +, -, *, /. Division rounds integers down.

Expressions can be surrounded by parentheses to indicate that they need to be evaluated first. To keep things simple, all expressions are evaluated from left to right no matter what the operations are (unless there are parentheses that specify otherwise), so

A = 2 - RM * 9 + 3 / NUMBER
B = 1 + 2 * (3 - 4) / 6

is equivalent to

A = (((2 - RM) * 9) + 3) / NUMBER
B = ((1 + 2) * (3 - 4)) / 6

Boolean expressions

Boolean expressions can compare two expressions using == (equality), != (not equal to), < (less than), and > (greater than). They are only used for control flow, as discussed below (there are no boolean variables).

Control flow

There are four types of control flow. They can be infinitely nested in all combinations.

If

if (booleanExpression) then
    // statements (discussed below)
endif

If-else

if (booleanExpression) then
    // statements (discussed below)
else
    // other statements
endif

Loop while

loop while (booleanExpression)
    // do stuff
endloop

Where booleanExpressions are boolean expressions. The ifs work the same as in normal programming languages. The while loop is a simple while loop.

The booleanExpressions will always be surrounded by (). The pseudocode is very flexible with spaces, and any number of spaces is valid.

Loop for

loop VARIABLE from Expression1 to Expression2
    // things to do over and over again
end loop

Where Expression1 and Expression2 are expressions that are evaluated before the loop begins and their values are stored until the loop finishes. The content of the loop is executed for every integer from the result of Expression1 to that of Expression1, inclusive. At every iteration, the index variable (VARIABLE in this case) is updated.

Example:

loop I from 3 to 5
    output(I)
endloop

Outputs:

3
4
5

Statements

Output

output(Expression) outputs the evaluated expression. It's like println in programming languages. So:

output(1+1)

prints 2, followed by a newline.

output() with no arguments should print a newline.

Other statements

If the interpreter encounters any other statement that looks like a method call with no arguments, it should pretend it's executing it. For example,

lightsoff()
gohome()

should print (together with a newline):

executing lightsoff
executing gohome

In other words, executing [Method name] should be printed. All statements will be lowercase and will consist entirely of letters.

Keywords cannot be statements. You do not have to deal with the following (it will not appear in the pseudocode): - if() - endif() - loop() - while() - etc.

However, statements that start with keywords are valid. For example, loophole() should print executing loophole, even though loop() itself is not valid.


Challenge rules

  • Your program should take a string as input. It can also take something equivalent, like an array of characters. But you can't take an array of strings; your program must itself separate the lines and tokens. You can also take a file as input.
  • Your program should print the output of the pseudocode in any reasonable form.
  • No standard loopholes.
  • There are no restrictions on what your program should do when given invalid pseudocode.
  • This is code golf. The shortest code in bytes wins.

Example output

1

A = 3
output(A) // prints 3
B = 4 + A * 2
output(B)
helloworld()
output(A + B + 1 * 3)

Should give:

3
14
executing helloworld
54

2

loop NUM from 2 to 20 // cycle through possible prime numbers
    COUNT = 0
    loop DIV from 2 to NUM // cycle through possible divisors
        if(NUM/DIV*DIV == NUM) then // if the number is exactly divisible
            COUNT = COUNT + 1
        endif
    endloop
    if (COUNT == 2) then // if number is prime
        output(NUM)
    endif
endloop

Should give:

2
3
5
7
11
13
17
19

3

Tricky cases that your interpreter should handle:

// empty comment:
//
// empty line:

    // more comment testing // ///
////

if     (3<4) then
    endoftheworld() // a statement
    ifff()
    endifnot()
    // endif in a comment doesn't count
endif
// loops can be empty:
loop I from 0 to 10
endloop
output(I) // variables are global
if(1<2)
    if(3<4) // nesting is ok
        ok()
    endif
endif
// spacing doesn't matter:
output   (2+   8   - 1   )
loop             while(2<1)
    neverhappened()
endloop

Should output:

executing endoftheworld
executing ifff
executing endifnot
10
excecuting ok
9

*Technically, once pseudocode follows rules as strict as those described here, it is arguably not pseudocode anymore. Wikipedia says it's called skeleton code.


Any suggestions?

I double-checked all the specifications, but if anything seems reasonably unclear, please let me know.

| |
\$\endgroup\$
  • \$\begingroup\$ Actually that's because the challenge is uninteresting. \$\endgroup\$ – Xwtek May 3 '18 at 2:11
  • \$\begingroup\$ @Akangka thanks for the feedback. How do you think it could be made more interesting? \$\endgroup\$ – Reinis Mazeiks May 3 '18 at 16:47
  • \$\begingroup\$ Unfortunately, there is nothing to improve. You have to find other challenge. Also, it is not pseudo-code. \$\endgroup\$ – Xwtek May 4 '18 at 3:03
  • \$\begingroup\$ @Ok, thanks. I'll try to think of something. Also, read the *note. :) \$\endgroup\$ – Reinis Mazeiks May 5 '18 at 19:39
-1
\$\begingroup\$

Common Logic Gates

Given positive integer n, make a common n-to-1 gate with fewest input, i.e. make a function f: {0,1}k ↦ {0,1} with smallest k that, for each function g: {0,1}n ↦ {0,1}, there exists {ak}, such that each element ai in the sequence map to one of 0, 1, x1, x2, x3, ..., xn, satisfying that, for each {xn}, g(x1, x2, x3, ..., xn) = f(a1, a2, a3, ..., an).

Samples:

To make a common 1-to-1 gate, your circuit must take at least 2 input:

f(A,B) = A XOR B

For a buffer gate (g = x1 ↦ x1), let A=0 and B=Input (a1 = 0, a2 = x1); for a not gate (g = x1 ↦ ¬x1) , let A=1 and B=Input (a1 = 1, a2 = x1).

Alternatively, you can use f(A,B) = A AND NOT B. For a buffer gate, let B=0 and A=Input; for a not gate, let A=1 and B=Input.

To make a common 2-to-1 gate, the circuit must take at least 4 input bits: (The two inputs are represented as a and b)

f(A,B,C,D) = ((A AND B) OR (C AND NOT B)) XOR D

(ab)
00 01 10 11 A B C D
0  0  0  1  a b 0 0
0  0  1  0  0 b a 0
0  1  1  0  a a a b
0  1  1  1  1 b a 0
1  0  0  0  1 b a 1
1  0  0  1  0 a 1 b
1  1  0  1  0 b a 1
1  1  1  0  a b 0 1

Output can be an boolean expression with reasonable logic gates, or just the output corresponding to all possible input of the n-to-1 function f (the truth table of f). If there are more than one possible functions, you can output any of them.

Shortest code in bytes win.

Code that matches the requirement:

function solve(n) { // n positive int
    var res = [], tmp=[], inmap=[], need=[];
    for (var i=1; ; i++) {
        for (var _res=0; _res<2**(2**i); _res++) {
            var valid = 1;
            for (var j=0; j<2**i; j++)
                tmp[j] = Math.floor(_res/2**j)%2;
            for (var _need=0; _need<2**(2**n); _need++) {
                for (var j=0; j<2**n; j++) 
                    need[j] = Math.floor(_need/2**j)%2;
                var valid2 = 0;
                for (var _inmap=0; _inmap<(n+2)**i; _inmap++) {
                    var valid3 = 1;
                    for (var j=0; j<i; j++) 
                        inmap[j] = Math.floor(_inmap/(n+2)**j)%(n+2) - 1;
                    for (var j=0; j<2**n; j++) {
                        var bits = 0;
                        for (var k=0; k<i; k++) {
                            if (inmap[k]==-1 || (inmap[k] && (j>>(inmap[k]-1))%2))
                                bits |= 1 << k;
                        }
                        if (tmp[bits] != need[j]) 
                            valid3 = 0;
                    }
                    valid2 |= valid3;
                }
                if (!valid2) valid = 0;
            }
            if (valid) 
                res.push (tmp.slice());
        }
        if (res.length) 
            return res[AnyNonNegativeIntegerLessThan(res.length)];
        // binary index input
    }
}

function AnyNonNegativeIntegerLessThan(x) { if(R>=x) throw ("end"); return R;}
for (R=0; ; R++) { console.log (solve(1)); }

| |
\$\endgroup\$
  • \$\begingroup\$ You don't define what an n-to-1 gate is anywhere in your question. \$\endgroup\$ – Wheat Wizard Mar 27 '18 at 1:00
  • \$\begingroup\$ @user202729 @user56656 n-to-1 gate means a gate with n input and 1 output. common n-to-1 logic gate mean a logic gate that can be used to replace any n-to-1 gate with some proper wiring. You can treat a logic gate as a ROM(so you can decide for each input what the output is) \$\endgroup\$ – l4m2 Mar 27 '18 at 1:15
  • \$\begingroup\$ Output gates or ROM \$\endgroup\$ – l4m2 Mar 27 '18 at 1:25
  • \$\begingroup\$ You should put the definitions in the challenge. "that can be used to replace any n-to-1 gate with some proper wiring" is still not very clear, you should define more carefully what you mean by proper wiring. \$\endgroup\$ – Wheat Wizard Mar 27 '18 at 3:22
  • \$\begingroup\$ I assume you mean functions g: {0,1}^n -> {0,1}, right? Why do you specify x_0 and x_-1? Shouldn't x just be a vector with indices 1,2,3,...,n? \$\endgroup\$ – flawr Mar 27 '18 at 14:07
  • \$\begingroup\$ Is {a_k} just a subset of {1,2,3,...,n}? Or can we have a_1=a_2=a_3=1 for example? \$\endgroup\$ – flawr Mar 27 '18 at 14:09
  • \$\begingroup\$ {a_k} seems not a multiset. It should be an array or say a sequence of numbers \$\endgroup\$ – l4m2 Mar 27 '18 at 14:43
  • \$\begingroup\$ So you're asking for something which outputs answers to codegolf.stackexchange.com/q/24983/194 ? \$\endgroup\$ – Peter Taylor Mar 28 '18 at 11:33
  • \$\begingroup\$ @PeterTaylor No. it requires to use NAND gate to make up one circult that do the thing. Also 24983 is a 1-of-4 (74LS153), not a 4-to-1 gate common 2-to-1 \$\endgroup\$ – l4m2 Mar 28 '18 at 12:41
  • \$\begingroup\$ (+) Any reason for downvoting? Downvoting in the sandbox indicates that the challenge is incomplete, if you don't leave a comment the OP can't know what is wrong. \$\endgroup\$ – user202729 Mar 29 '18 at 4:48
  • \$\begingroup\$ @user202729, there are already comments indicating that this question is going to attract close votes as unclear if it's posted to main in the current state. \$\endgroup\$ – Peter Taylor Mar 29 '18 at 10:59
  • \$\begingroup\$ @user56656 Are the issues fixed now? \$\endgroup\$ – user202729 Mar 31 '18 at 15:16
  • \$\begingroup\$ @flawr Are the issues fixed now? \$\endgroup\$ – user202729 Mar 31 '18 at 15:16
  • 1
    \$\begingroup\$ No I still think the explanation is quite bad and the notation is not very clear \$\endgroup\$ – flawr Mar 31 '18 at 16:15
  • \$\begingroup\$ A reference implementation is no substitute for a clear specification. The first paragraph is where you need to focus your efforts. \$\endgroup\$ – Peter Taylor Mar 31 '18 at 19:32
-1
\$\begingroup\$

Is the program 32 or 64 bits?

Assignment is simple to explain: write the shortest code you need to determine whether an executable binary program supplied as parameter is 32 or 64 bits.

If there is a different kind of bitness, you can also do for it, but is not mandatory.

What I really don't want is telling me you support other bitnesses and after I get 32 or 64 as a result.

Valid outputs for 32:

32
32bit
32bits
32 bit
32 bits

The same pattern for 64.

No accepted answer.

| |
\$\endgroup\$
  • \$\begingroup\$ I think you're missing a word somewhere in the region of "determine supplied" \$\endgroup\$ – Kamil Drakari Apr 4 '18 at 19:43
  • \$\begingroup\$ @KamilDrakari thanks. \$\endgroup\$ – sergiol Apr 4 '18 at 19:53
  • \$\begingroup\$ Executable on Windows or Linux machine? What if (... maybe ...) the program is a valid executable for both "bitness" but do different things? \$\endgroup\$ – user202729 Apr 5 '18 at 1:30
  • \$\begingroup\$ Of the output formats you allow, I think the first one will result in the shortest code in every single language. Because of this, you might as well just specify that the output should be the number 32 or the number 64. \$\endgroup\$ – Nathaniel Apr 5 '18 at 8:03
  • \$\begingroup\$ This made me wonder what to do about shell scripts, which are executable programs, but require another file to interpret them and as such aren't 32-bit or 64-bit per se. Maybe it would be best to specify "executable binary file" to not have to deal with that mess. \$\endgroup\$ – Angs Apr 5 '18 at 11:22
  • \$\begingroup\$ @Angs: Thanks. Changed. \$\endgroup\$ – sergiol Apr 5 '18 at 11:27
  • \$\begingroup\$ @user202729: I don't care. Windows, Linux, Mac, whatever, ... \$\endgroup\$ – sergiol Apr 5 '18 at 11:28
  • \$\begingroup\$ @Nathaniel: It is intentional. If you have a language feature called bitness(program) returning 32bits you do not need to waste more bytes removing the bits part! \$\endgroup\$ – sergiol Apr 5 '18 at 11:30
  • \$\begingroup\$ The word "challenge" is not really true, at least for ELF. It's absolutely trivial. \$\endgroup\$ – Peter Taylor Apr 6 '18 at 20:20
  • \$\begingroup\$ @PeterTaylor : Changed, thanks. \$\endgroup\$ – sergiol Apr 6 '18 at 21:20
  • \$\begingroup\$ The real "challenge" is to know the executable file format, so this becomes more of a puzzle than a challenge. And for puzzles, people can just copy others' solution and port to other languages. // Consider having some popular file format in the challenge itself so people don't have to look up them? \$\endgroup\$ – user202729 Apr 7 '18 at 11:19
  • \$\begingroup\$ @user202729: My initial idea was to ask only for Windows .exe files but I changed my mind because it was too limiting. Without such restrictions the question becomes multi-platform. \$\endgroup\$ – sergiol Apr 7 '18 at 11:38
1
88 89
90
91 92
99

You must log in to answer this question.

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