569
\$\begingroup\$

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

Sandbox FAQ

Posting

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

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

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

Discussion

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

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

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

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

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

Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

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

\$\endgroup\$
0

4562 Answers 4562

1
142 143
144
145 146
153
-2
\$\begingroup\$

Write a polyglot (a program that works on several languages) that produces the // this is a comment output.

Example (JS + Plain PHP + Plain HTML) (74 / 3 = 24.66 points)

// this is a comment<?php ob_start();?><!--
alert("// this is a comment");

Another Example (CoffeeScript + CJam + brainfuck) ()

e###-[----->+<]>----..+[--->++<]>.---[->++++<]>.------------.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.[->+++<]>+.-[->+++ <]>.+[->+++<]>.++++++++++++.--..--------.+++++++++.++++++.
"// this is a comment"
e### alert "// this is a comment"

Scoring

Your score will be code byte length / num langs

The smallest score wins!

\$\endgroup\$
2
  • \$\begingroup\$ Is there anything that makes this significantly different than polyglot Hello World? \$\endgroup\$
    – Geobits
    Feb 1, 2016 at 14:03
  • \$\begingroup\$ @Geobits this is more easy, really \$\endgroup\$ Feb 1, 2016 at 14:37
-2
\$\begingroup\$

Linear Time Sorting

It was another slow day at Initech Inc. when a feature request came in:

New Feature: Ability to sort by cash value in the transaction form. But make it a fast one!

Well it looks simple.. but what do the requester mean by fast one? Let's call Jim, from sales he probably knows what's going on.

Jim: Well you know , our Business Inc. contact is very passionate about 

programming and computer science! In fact he had this idea that we should 

do sorting in how that was called.. linear time?


You: Well you know that's impossible?

Jim: But it was already approved by their cto and all! You need to do something

You and Jim came up with a plan.. nobody will notice if that big of a list isn't sorted enough, right?

Your task

Your task is to write a linear time sorting program. It will be scored on accuracy of the sort as compared to list sorted by regular sorting algorithm but it must work on O(N) time in the worst case, where N is length of the input.

Input will be in the form of list of string-double tuples, e.g:

[("aaaa",2.0) , ("aaba",1.0)]

The program should sort on the number value of the tuple, i.e. in the above case the order should be reversed. There may be multiple inputs with the same double values, but no string value is repeated. In the event that two inputs have the same integer value the perfect solution is to keep the order as it is. The double value may be any floating-point value that fits in 8 byte double precision variable. NaNs should be placed at the end of the list.

The score is calculated as number of "bubble sort operations" (switch an element with the next/previous element) needed to achieve perfect output from the output of your algorithm.

Sandbox Worries

Well I don't know how clear my explanation of challenge was and if it is interesting to the PPCG crowd.

Obviously there is a need for testing program and test cases.

\$\endgroup\$
13
  • \$\begingroup\$ How big will the test cases be? If you pick a fixed size, the response will be "n passes of bubble sort where n is the size of the largest test". Bam, linear with perfect score. \$\endgroup\$ Apr 11, 2016 at 10:12
  • \$\begingroup\$ @JanDvorak I rephrased the scoring sentence to more reflect what I meant. In that case the score wouldn't be perfect as after just n switches the list wouldn't be the most ordered. EDIT: I think I understood it now. Well I think you can somehow exclude answers like that with some caveats in the rules, like "Your algorithm cannot make any assumtions about length of the input" \$\endgroup\$
    – Lause
    Apr 11, 2016 at 10:17
  • \$\begingroup\$ I don't make any assumptions. It sorts every array up until the largest test case correctly and all other arrays partially. \$\endgroup\$ Apr 11, 2016 at 10:28
  • 1
    \$\begingroup\$ An algorithm that fares better than n-pass bubble sort is to do a level-n mergesort. If the length exceeds 2^n, sort each [k::len/2^n] subarray separately. \$\endgroup\$ Apr 11, 2016 at 10:32
  • \$\begingroup\$ But then you're making assumptions based on the size of the test cases - if somehow the test cases were changed (but still fitting the rules) to test cases which are much longer (for example you prepared for max 10 element list and you get 100000 element list) your program isn't linear. \$\endgroup\$
    – Lause
    Apr 11, 2016 at 10:41
  • \$\begingroup\$ The problem with a spec is that it cannot change once you've posted the challenge, and you can't define "making assumptions based on the size of the test cases". You can't even ban all magic numbers - I can simply use functions merge1 .. merge20 \$\endgroup\$ Apr 11, 2016 at 10:47
  • \$\begingroup\$ It isn't the spec - the way the test cases used to grade the result are constructed is described but do I have to post the test cases (but those used to score) themselves? \$\endgroup\$
    – Lause
    Apr 11, 2016 at 10:50
  • \$\begingroup\$ You need to define the test cases, and you can't change them based on the answers (if only because updating the score of every answer would be a nuisance). Maybe you could ask for asymptotic behavior, but that can be surprisingly hard to measure. \$\endgroup\$ Apr 11, 2016 at 10:53
  • \$\begingroup\$ Hidden test cases are a problem as well, because then we can't test the submissions after you're gone. \$\endgroup\$ Apr 11, 2016 at 10:55
  • \$\begingroup\$ The idea was to pregenerate some test cases (undisclosed) and some test cases that are disclosed (for testing purposes during the coding) and then do a cutoff time for the challenge where all the solutions are tested against the undisclosed challenges. Also obviously after the cutoff time the test cases would be disclosed. \$\endgroup\$
    – Lause
    Apr 11, 2016 at 10:56
  • \$\begingroup\$ 1. Most real-life data types can be sorted in linear time, so the premise of the question seems badly flawed. 2. "Input will be in the form of list of string-double tuples ... There may be multiple inputs with the same integer values" Huh? Where do the integer values come from? 3. "The double value may be any floating-point value" Where do NaNs sort? \$\endgroup\$ Apr 11, 2016 at 16:00
  • \$\begingroup\$ 1. The idea is that the data may be the worst case for any algorithm that can achieve linear sorting time 2. It was a typo 3. At the end - I will put it into the question \$\endgroup\$
    – Lause
    Apr 11, 2016 at 18:36
  • \$\begingroup\$ Why does the input being worst case make any difference? The solution will still be perfect, so you'll need a tie-breaker to separate every single answer. \$\endgroup\$ Apr 11, 2016 at 21:27
-2
\$\begingroup\$

Make a quine without using string literals

A quine is a computer program that prints out it's own source code to stdout. Your task is to make one that doesn't use string literals.

You cannot:

  • Have any empty program
  • Read your source code directly or indirectly (i.e. form a file)
  • Use error messages to print out the source code
  • Rely on language features to print out the source
  • Relying on a REPL environment

A string literal is a:

  • String type (obvious)
  • Number used to store the character (sorry BF!)
  • Other predefined constant

You are encouraged to compute your own source code.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This hits two of the "things to avoid when writing challenges": do X without Y and popcons. (I assume it's an attempt to finesse a third: generalised quines). It also has some fairly bad phrasing: what language can print anything without using "language features"? In what way does BF use literals? How many languages can compute anything without using at least one constant? \$\endgroup\$ Apr 12, 2016 at 7:27
-2
\$\begingroup\$

Cops and robbers : Programmers/Hackers

  • This challenge is quite different from my previous challenges. This challenge is an endless competition between robbers and cops, which are respectively hackers and programmers. One of them will ever win!!!

  • This will evolve to code de/obfuscating when it gets to the higher stages: a skillful programmer who is struggling to save his program from a sourcecode-mangling attempted by a cunning "robber" who tries to impose his existence by patching his name instead of the name of the "programmer" in the output console without changing anything else in the code. The story begins this way:

  • Programmer is at the point of executing his recently made C code, so he included this trivial line to show off:

C (1)

    printf("[Programmer's username]")

After executing this program programmer saw this on the screen:

[Robber's username]

which indicates the presence of some evil code at the compiler level that compromises his code, which follows:

Matlab (2)/parser

      a=findstr(code,'printf(''[Programmer's username]'')'); if a code(a:20)='printf(''[Robber's username]'')';end

The programmer cannot modify the counter-program in the compiler, so he must rather change the program content to escape the twiddling:

PHP (3)

      $a='[programmer's username]';echo $a;

The score is now 3, which is the number of steps from the beginning. The current user would win only if the hacker did not figure out something like:

PHP/Regex(pcre flavor) (4)

      $code=ereg_replace("(\$\w)\='programmer';(.*?);echo\s\1","\1\='robber';\2;echo\s\1",$code)

Since the solution above does not satisfy the rules (see the bottom of this question), the score stays unchanged, and the programmer can make a counter example, and take out the score from last submitter with a penalty on his score equivalent of how much he earned in the earlier level, where the counter example can be something as:

PHP (4)

      $a='programmer';$b=$a;$a='unrelated';echo $a;

Or he can adjust his program in higher scale to escape all the regex-trapping in a superior range, So the cycle goes on until no post can be added and the last submitter before the end of June is declared a potential winner meanwhile.

The hacker can also fix his regex and regain his score, so the recent scoring will be abrogated from programmer.

Perl/dynamic-regex (4)

local @a=('');

sub check{
  if (grep {$_ eq @_[1]} @a)  
   {push @a,@_[0]; } 
  elsif  (grep {$_ eq @_[0]} @a)   {
    my @del_indexes = grep { @a[$_] eq @_[0] } 0..$#a;
    foreach $item (@del_indexes) {
     splice (@a,$item,1);
    }
  }   
return 1;
}

sub actor{
if (grep {$_ eq @_[0]} @a)
 {return "print robber";}
else
 {return "print ".@_[0];}
}


sub initiate{
push(@a,@_[0]);
return 1;
}

$code =~ s/(((\w+)\="programmer"(??{initiate($3);}))|(print\s(\w+))|((\w+)\=(\w+)(?{check(($7),($8));})(?1)))/print($2);actor($5)/pegmx;

As you can see this Perl program prints b in the first case because the variable b is compromised after the first assignment, but in the second case the regex modifies the output because d receives the target-string transitively. Let's just stop here and not mess the fun (of course, if there will be some).

Scoring and rules

How is the score counted ?

  • Any hacker/programmer is scored for his code as the actual level L the game is on.
  • A partial dynamic regex within the core of the program is scored L + (2^L)/log(length of program + length of characters which do not belong to the regex)), where the log is base 2. For the second example of level (4) the length of the compacted program is 480, and the length of regex is 136, so the score is 4+2^4/log2(480+480-136) ~= 4+16/9.6
  • A fully functional regex as in the first example level (4) is scored L + (2^L)/log(length of regex), where the log is base 2, in that case S = 4 + 2^4 / log(91) ~= 4+16/6.5
  • Scores are added progressively to submitters, and when a level is surpassed with no regex, it is still open for scores, while the actual winner remains unchanged.
  • A penalty on a certain-leveled score when the regex/parser is revealed out of rules and the game is regressed to this stage until the issue is fixed, rules are cited below:

Rules:

  • The main rule: the hacker-program must compromise an output to the console, which is the username of the programmer. Any other behavior is unaccepted simply because a string variable of [programmer's username] can be used in other order rather than printing, a counter-example is easy, converting the string to integer then use it for arithmetic calculations that harms the main program once intentionally modified.
  • Also one of the following factors declared by any counter-example bans the targeted flawed regex/parser as non rule-complying:
    • The regex/parser prints anything other than a chosen string preferably set as the username of the robber.
    • The regex/parser generates a program which does not compile.
    • The regex/parser does not print anything, or compromises a segment of code that is needed for tasks other than printing .
  • The variable which stores the program is named code by default, also you may assume that is one-liner, and any non-significant spaces are omitted, and that it is fully working by default.
  • The regex/parser deals with one variant of one code proportion in a comprehensive way, i.e. if a print function is used, that encompasses all printing functions in all languages puts,disp,..etc. Also, code separators can be unified to one characterL either , or ; or a significant space needlessly of enumerating all keywords/syntaxes, this is not a contest about a working code in a specific programming language.
  • To prevent endless program/regex loops let's just not making a jokey sequence as a='programmer';print a / /(\w)\='programmer';print\s\1/ / a='programmer';b=a;print b / /(\w)\='programmer';(\w)\=\1;print\s\2/ because the first person who makes a regex/parser which palliates to a same replicated idea will take out all attributed scores to this idea from their owners, so any anaphoric sequences like this in addition that they are set to same level, they are unneeded.
  • Any language that uses pointers/addresses/classes like C++ are welcome, as long as they help to evade the hacker.
\$\endgroup\$
11
  • 3
    \$\begingroup\$ Please, for the love of god, spell things correctly. In the first bit alone I spotted a ton of spelling mistakes without even looking for them. Also, that whole first list is... basically impossible to understand, at least for me. Maybe use full sentences? \$\endgroup\$
    – Nic
    May 10, 2016 at 21:29
  • 1
    \$\begingroup\$ Have you seen our cops-and-robbers challenges? It sounds like that is what you are trying to do here. That said, there are a couple of problems with the spec: Defining what parts of the language counts as a "partial regex" or "full regex" is really tough, especially when we get into esoteric languages. \$\endgroup\$ May 10, 2016 at 21:36
  • 1
    \$\begingroup\$ Could you add a short summary to the post? I don't understand what the actual task here is. Is this a cops-and-robbers or answer-chaining challenge, or something entirely different? \$\endgroup\$
    – Zgarb
    May 10, 2016 at 21:36
  • \$\begingroup\$ i will see what cops and robbers is \$\endgroup\$
    – Abr001am
    May 10, 2016 at 21:39
  • \$\begingroup\$ @NathanMerrill this is not a code golf so i dont see the point of introducing esolangs here \$\endgroup\$
    – Abr001am
    May 10, 2016 at 22:28
  • 1
    \$\begingroup\$ @Agawa001 Esoteric languages are still useful outside of golfing. You can use them to make it tough for regexes to match. \$\endgroup\$ May 10, 2016 at 23:06
  • 3
    \$\begingroup\$ The introduction is very long and after reading it I have no idea what the task is. I would have to vote to close this as "Unclear what you're asking" in its current state. \$\endgroup\$ May 11, 2016 at 7:45
  • \$\begingroup\$ So what's the core mechanic? Is this an answer-chaining question where answers must alternate programmer and hacker? But if the programmer can change language at will, how can the hacker hope to win? \$\endgroup\$ May 12, 2016 at 12:06
  • \$\begingroup\$ @PeterTaylor yes it is answer chaining but the last submitter can post two consecutive answers and be the robber and cop themselves, the programmer change his code, hacker changes his regex taken consideration of all last regex/parsers. \$\endgroup\$
    – Abr001am
    May 12, 2016 at 16:13
  • 1
    \$\begingroup\$ I have no idea what this challenge is supposed to be. The very little explanation of the concept is muddled by spelling and grammar issues. Please, learn English spelling and grammar before trying to write a challenge. \$\endgroup\$
    – user45941
    May 13, 2016 at 5:18
  • \$\begingroup\$ @PeterTaylor refer at the 4th rule, procedures which accomplishes a specific task in different languages are dealt as one thing, this is not a challenge about checking language-syntaxes, when a programmer changes language, consider all previous regex/parsers changed to trap same functionnalities of previous code on the new language. \$\endgroup\$
    – Abr001am
    May 28, 2016 at 11:37
-2
\$\begingroup\$

Challenge

Write a program that takes an numerical input n and outputs the nth number that is not a perfect square.

Rules

This is , so least bytes wins.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ What's the maximum expected input? Does it expect 0? How do we handle 0? Is there a requirement on the efficiency for large inputs? Also give some example inputs and outputs. \$\endgroup\$ Jun 17, 2016 at 20:19
  • \$\begingroup\$ Here's some test cases I just generated: 1->2,2->3,3->5,4->6,5->7,6->8,7->10,8->11,9->12,10->13,11->14,12->15,13->17,14->18,15->19,16->20,17->21,18->22,19->23,20->24,21->26,22->27,23->28,24->29,25->30,26->31,27->32,28->33,29->34,30->35,31->37,32->38,33->39,34->40,35->41,36->42,37->43,38->44,39->45,40->46,41->47,42->48,43->50,44->51,45->52,46->53,47->54,48->55,49->56,50->57,51->58,52->59,53->60,54->61,55->62,56->63,57->65,58->66,59->67,60->68,61->69,62->70,63->71,64->72,65->73,66->74,67->75,68->76,69->77,70->78,71->79,72->80 Is this the function you expect? \$\endgroup\$ Jun 17, 2016 at 20:41
  • \$\begingroup\$ Yes, yes it is. \$\endgroup\$ Jun 17, 2016 at 20:42
  • \$\begingroup\$ Can you address my other questions please? Namely, the largest expected input and how to handle input of 0. \$\endgroup\$ Jun 17, 2016 at 20:43
-2
\$\begingroup\$

Generate all variations of a string with every combination of upper and lower case for each vowel but leaving consonants and order of letters unchanged.

This is a simplified analog of a problem I've thought about a few times over the years based around variant spellings in different spoken languages.

Input is a text string. Output is an array of all variations of the text string.

A "variation" means the same letters in the same order but for each vowel letter in the string we generate a version of that string with the vowel in uppercase and the vowel in lowercase.

No variation should be included more than once. No legal variation may be omitted.

Example

Input

codegolf

Output

  • codegolf
  • codegOlf
  • codEgolf
  • codEgOlf
  • cOdegolf
  • cOdegOlf
  • cOdEgolf
  • cOdEgOlf

The winner shall be the most elegant as voted by the community.

"Elegant" includes that the algorithm should be optimal in terms of Big O notation, should be concise, should be idiomatic making good use of available features of the implementation language.

Length of code characters or bytes is not relevant.

Programming language is open.

\$\endgroup\$
4
  • \$\begingroup\$ "most elegant as voted by the community." I doubt many answers to such a challenge will be deemed elegant. \$\endgroup\$
    – Fatalize
    Jun 23, 2016 at 13:01
  • \$\begingroup\$ Really? Anything to suggest instead? Just "best" is usually no good for Stack Exchange... \$\endgroup\$ Jun 23, 2016 at 13:22
  • 3
    \$\begingroup\$ Code golf version of this challenge: codegolf.stackexchange.com/q/80995/8478. That said, I don't think "most elegant" makes a good popularity contest and is very likely to be downvoted and closed almost instantly. If you're looking for elegant solutions, this might not be the right community in the first place though. You could write your own solution and post it on Code Revew to ask for improvements. We generally require objective winning criteria for our challenges, and popularity contests are in a weird place where you need to come up with something really good for it to be accepted. \$\endgroup\$ Jun 23, 2016 at 13:30
  • \$\begingroup\$ Hmm well OK whatever. \$\endgroup\$ Jun 24, 2016 at 11:55
-2
\$\begingroup\$

Oh noes! A site redesign is eating my privileges!


PPCG is graduating and will soon receive a new design. Unfortunately for everbody except some people, the new design will also mean losing privileges due to higher reputation requirements.

Now, losing some privileges is a small sacrifice for the Magnificent Glorious Site Redesign®©™, but… How much do we stand do lose?

The challenge

Your program / function receives a reputation level (e.g. 535). Output the privileges that are currently available to it, but will not be available after the redesign.

Output

Output can be either an array or a string that's separated by a delimiter. The delimiter may not be any of A-Za-z<space>. Multi-character delimiters may end in a space, though.

If there are no matches, your program should output either an empty array or a falsy value.

Examples

Input
25000
Output
[]
Input
24999
Output
["access to site analytics"]
Input
2000
Output
["access to moderator tools","approve tag wiki edits","cast close and reopen votes","create tag synonyms"]
Input
535
Output
["cast close and reopen votes"]
Input
350
Output
["access review queues"]
Input
5
Output
[]
Input
4
Output
["participate in meta"]

Deliberately ignoring the facts in the last example.

Available privileges

For convenience, here is a JSON array with available privileges and the required reputation before / after:

[[5000,25000,"access to site analytics"],[4000,20000,"trusted user"],[3500,15000,"protect questions"],[2000,10000,"access to moderator tools"],[1500,5000,"approve tag wiki edits"],[500,3000,"cast close and reopen votes"],[1250,2500,"create tag synonyms"],[1000,2000,"edit questions and answers"],[750,1000,"established user"],[1000,1000,"create gallery chat rooms"],[350,500,"access review queues"],[150,300,"create tags"],[250,250,"view close votes"],[125,125,"vote down"],[100,100,"edit community wiki"],[100,100,"create chat rooms"],[75,75,"set bounties"],[50,50,"comment everywhere"],[20,20,"talk in chat"],[15,15,"flag posts"],[15,15,"vote up"],[10,10,"remove new user restrictions"],[10,10,"create wiki posts"],[1,5,"participate in meta"],[1,1,"create posts"]]

At index 0 is the reputation before, at index 1 is the reputation after. (The privilege reduce ads (200 reputation) is not available to beta sites and therefore not included in this list.)

Standard I/O and loophole rules apply.

\$\endgroup\$
3
  • \$\begingroup\$ Related. It's borderline whether this adds enough to not count as a duplicate: I would vote that it does, but I wouldn't cast my supervote. \$\endgroup\$ Jul 12, 2016 at 16:21
  • \$\begingroup\$ @PeterTaylor I'm thinking of changing the challenge to allow submissions to download the privilege page. I guess that would make it distinct enough. \$\endgroup\$ Jul 13, 2016 at 10:53
  • \$\begingroup\$ Turns it into a hybrid parse-HTML and merge data sources question. Yes, I think that's novel. You should make it very clear that the answers should keep working after the contents of the privilege page are updated to show the new rep levels; and possibly you should take a backup copy of the page in case of future addition of new privileges. \$\endgroup\$ Jul 13, 2016 at 11:01
-2
\$\begingroup\$

Plot Partial Node Network

I have a 440*3 matrix that looks like:

1   144 Title1
1   152 Title2
1   135 Title3
2   3 Title4
2   12 Title5
2   107 Title6
2   31 Title7
3   4 Title8
3   147 Title9
3   0 Title10
4   end Title11
4   0 Title12
4   0 Title13
5   6 Title14
5   7 Title15
5   10 Title16
5   9 Title17

The left column are the starting points eg in the app all the 1's on the left would be on the same page. They lead to three choices, pages 144,152,135. These pages can each then lead to another page, and so on until the middle column says 'end'.

challenge Each number has an associated title in column three. I would like to have a function whereby if you input a given title it will plot all the possible starting points and their associated paths that will lead there. This should be a lot smaller and therefore graph friendly.

Example e.g.

44  234  tes
186  187  Frac
187  154  Low
154  end  Coll
99  101  adf
23   52   Med
52   11   Lip
11   42   AAA
42   154   BBB
154   end  Coll

EDIT - I added to the example. In the winning entry these new nodes will not be plotted as they do not lead to Coll.

I made this example to show how column 1 leads to a value in column 2 which then refers to a value in column 1 until you reach the end. Different starting points can ultimately lead to different length paths to same destination. so this would look sometigng like: All paths leads to Coll

So here, I wanted to see how you could go from all start points to 'Coll'

Input A data.frame like that illustrated (with not relevant rows included) and a given title

Rules -any language is fine as long as it will easy work with tab separated data laid out as shown

Output A graph like the one included for a given title

Win Criteria Shortest Runtime to make a png with graph

\$\endgroup\$
6
  • \$\begingroup\$ A question should have one challenge, not two. And a challenge should ideally have one goal, not two; and should certainly have a clear description not only of the input but also of the output. \$\endgroup\$ Jul 13, 2016 at 16:14
  • \$\begingroup\$ Hi Peter, thanks for this. I've edited accordingly \$\endgroup\$
    – cianius
    Jul 13, 2016 at 16:16
  • \$\begingroup\$ Similar, also. \$\endgroup\$ Jul 13, 2016 at 22:58
  • \$\begingroup\$ they're similar but not the same. they dont solve the problem of just plotting the rows that lead to Coll. \$\endgroup\$
    – cianius
    Jul 14, 2016 at 7:30
  • \$\begingroup\$ i edited example to clarify this Peter :) \$\endgroup\$
    – cianius
    Jul 14, 2016 at 7:45
  • \$\begingroup\$ I do like this question, but I currently do not support it as a question, due to it being unclear as to exactly what the png can and can not look like. I do support graphical output questions. \$\endgroup\$ Jul 15, 2016 at 1:47
-2
\$\begingroup\$

The Library Problem

Bob has a very annoying problem. His boss told him to write a cat program that redirects the standard input to the standard output. But he recently installed a virus on his computer which deleted every libraries on it.

Now he really need to create this program without using any library (even the language standard library). It need to run at least on one operating system with one architecture.

Challenge

Write a program or that redirects the standard input to the standard output without using any library or external program/command to run to help Bob. You can use system calls and interrupts for example, but your program must not run in ring 0 mode (most operating systems like Microsoft Windows or GNU/Linux have kernels which prevent programs from doing anything, but MS-DOS for example let programs do everything).

  • Input: anything (text, binary)
  • Output: exactly the same as the input

This is , so shortest answer in bytes wins!

Example Input and Output

First:

  • Input: Hello, world!
  • Output: Hello, world!

Second:

  • Input: ...
  • Output: ...
\$\endgroup\$
6
  • \$\begingroup\$ That's just this challenge isn't it? \$\endgroup\$ Jul 21, 2016 at 15:26
  • \$\begingroup\$ @MartinEnder This challenge is about doing a cat program without using any library or external command/program even the standard library built with the language. \$\endgroup\$
    – user54187
    Jul 21, 2016 at 15:30
  • \$\begingroup\$ So everything would need to be written in assembly or equivalent? \$\endgroup\$ Jul 21, 2016 at 15:34
  • \$\begingroup\$ @TimmyD Yes for example, but I think there are other lower-level languages which allow this. \$\endgroup\$
    – user54187
    Jul 21, 2016 at 15:34
  • 3
    \$\begingroup\$ In that case it just seems like the same challenge limited to a small set of languages? In that case it would probably still be considered a duplicate and the usual course of action is to offer a bounty for the language you want to see a solution in. \$\endgroup\$ Jul 21, 2016 at 15:38
  • \$\begingroup\$ @MartinEnder You need a lower-level language but it doesn't mean that every program made using a lower-level language works with this challenge. See this answer for example which uses a function from the standard library codegolf.stackexchange.com/a/62309/54187. \$\endgroup\$
    – user54187
    Jul 21, 2016 at 15:46
-2
\$\begingroup\$

Alphabet Circle

This post got very negative feedback, so it's apparent that it needs tweaking in the sandbox before I attempt to repost it on PCG


With all the new alphabet xxx challenges, I've decided I'll give my own challenge.

Input

An Integer, (or your languages equivalent) r, such that 0 < r ≤ 26. (you don't need to validate this)

Output

An alphabet circle. Must meet the following criteria:

  • Smoothly interpolated from A at the center and Z at the edge.
  • Each point in the circle is the distance from the center offset so that 0 = A, 1 = B, 2 = C etc...
  • Be printed to STDOUT

Examples

r=26

enter image description here

r=15

enter image description here

Boilerplate

Anonymous classes and functions are fine. General Code Golf rules apply. Shortest code in bytes wins!Except Jelly

\$\endgroup\$
8
  • 8
    \$\begingroup\$ Please remove the Except Jelly part... \$\endgroup\$ Aug 3, 2016 at 11:31
  • \$\begingroup\$ @TùxCräftîñg no \$\endgroup\$
    – Shaun Wild
    Aug 3, 2016 at 11:32
  • 4
    \$\begingroup\$ Disallowing language are a thing to avoid when writing challenges \$\endgroup\$ Aug 3, 2016 at 11:35
  • \$\begingroup\$ It's triple super scripted, it's a joke. I'm not removing it. Get a sense of humour! \$\endgroup\$
    – Shaun Wild
    Aug 3, 2016 at 11:49
  • 4
    \$\begingroup\$ Since you mention negative feedback, my negative feedback would be that a glut of recent challenges on theme X (in this case alphabet layout) is a strong reason to avoid more challenges on theme X for a while, not to add to the pile. Variety is good. If I were you I'd hold this challenge for a month. Moving onto positive feedback, the spec needs to define the desired layout more clearly. I can't work out what the precise criterion is for which letter to place in each space. \$\endgroup\$ Aug 3, 2016 at 14:51
  • \$\begingroup\$ If a position is not an integer distance from the centre, should the distance be truncated, rounded up/down or something else? \$\endgroup\$ Aug 6, 2016 at 12:11
  • \$\begingroup\$ Could you specify whether leading/trailing spaces and newlines are permitted/required? Does the circle need to be framed in a square of matching size, or can it always be in a square of a fixed maximum size? \$\endgroup\$ Aug 6, 2016 at 12:15
  • 1
    \$\begingroup\$ I think this would work best as a kolmogorov-complexity just for the size 26 pattern. That'd avoid any issues with defining how to interpolate the circles (or, indeed, defining the pattern generally, as it would be defined via stating the intended output). \$\endgroup\$
    – user62131
    Nov 24, 2016 at 5:24
-2
\$\begingroup\$

2 Pass Hello world

There you go, your first "Hello world" is displayed on your terminal. You think about your next step into becoming a wizard.

You've heard about this fancy new programming language, but you're not sure you understand it perfectly. So you want to go over a new "Hello world" tutorial again.

How boring!

Instead you have a good idea, using your knowledge of the first programming language to create a "Hello world" program in the second programming language.

Exemple:

console.log('print "Hello world"');

Evaluated in javascript output:

print "Hello world"

Which, evaluated in python 2.X output:

"Hello world"

Nice, but, can it be shorter?

\$\endgroup\$
14
  • 1
    \$\begingroup\$ We have a tag for multi-language challenges, polyglot. \$\endgroup\$
    – Riker
    May 4, 2016 at 14:06
  • \$\begingroup\$ Pyth: \H (Guess what the second language is) \$\endgroup\$
    – Leaky Nun
    May 4, 2016 at 14:08
  • 1
    \$\begingroup\$ Maybe add a scoring mechanism by how many languages it works in? e.g. console.log('print("puts\'Hello, World!\'")') would score len(submission)/num_languages_it_works_in? \$\endgroup\$
    – Riker
    May 4, 2016 at 14:09
  • \$\begingroup\$ Then the submission above would score 0. \$\endgroup\$
    – Leaky Nun
    May 4, 2016 at 14:09
  • \$\begingroup\$ (To OP) Maybe you would need to add some more rules \$\endgroup\$
    – Leaky Nun
    May 4, 2016 at 14:11
  • \$\begingroup\$ @KennyLau no? 2/2 = 1 \$\endgroup\$
    – Riker
    May 4, 2016 at 14:11
  • 1
    \$\begingroup\$ @EᴀsᴛᴇʀʟʏIʀᴋ It can be fed into itself for one more pass... \$\endgroup\$
    – Leaky Nun
    May 4, 2016 at 14:12
  • \$\begingroup\$ I didn't want to add any recursive mechanism, because the end goal should be to display "Hello world" but a more than 2 language is a great idea. \$\endgroup\$
    – nobe4
    May 4, 2016 at 14:15
  • \$\begingroup\$ I don't see how you will be able to come up with a good scoring system for this. Using two esolangs / two times the same esolang will result in 1/2 bytes answers right away. \$\endgroup\$
    – Fatalize
    May 4, 2016 at 14:16
  • \$\begingroup\$ @KennyLau, what rules do you generally add to a incomplete challenge? we thought adding a time/memory limit for the execution, but seems irrelevant... \$\endgroup\$
    – nobe4
    May 4, 2016 at 14:17
  • 3
    \$\begingroup\$ This is really closely related to several other challenges we've had on the site, such as this one and this one. You'll need to be very careful to not make it a duplicate. \$\endgroup\$ May 4, 2016 at 14:22
  • 1
    \$\begingroup\$ Also this one, which is practically a duplicate, just with numbers instead of "Hello, world." \$\endgroup\$ May 4, 2016 at 14:26
  • \$\begingroup\$ Yeah, I haven't seen all this, I guess I'll start searching for another idea instead ;) \$\endgroup\$
    – nobe4
    May 4, 2016 at 14:29
  • 2
    \$\begingroup\$ Also, welcome to PPCG! (I forgot to mention that earlier). Hope you enjoy yourself here! \$\endgroup\$ May 4, 2016 at 14:36
-2
\$\begingroup\$

Return True to Win - Counter

Original credit goes to this site, which you should all check out

Write the shortest javascript code to pass as parameter f to function counter such that it returns true:

function counter(f) {
    var a = f(), b = f();
    return a() == 1 && a() == 2 && a() == 3
        && b() == 1 && b() == 2;
}

I'm considering also making this a series with all the rest of the challenges on the site, where each one gets harder

\$\endgroup\$
2
  • 6
    \$\begingroup\$ Given the lack of a terms of use page on the site, the code on that site is copyrighted, with no provisions for reproduction. This is copyright violation. \$\endgroup\$
    – user45941
    Aug 9, 2016 at 6:00
  • 2
    \$\begingroup\$ In addition to Mego's note regarding copyright, language-specific challenges are not typically well-received by the community. \$\endgroup\$
    – Alex A.
    Aug 9, 2016 at 18:18
-2
\$\begingroup\$

Nasty Nasty Bugs

Help the programmer provide detailed instructions to the team on how to deal with bug fixes.
The team's goto instructions for dealing with bugs goes like this.

For the twelfth bug of Christmas, my team leader said to me 

    Tell them it's a feature
    Say it's not supported
    Change the documentation
    Blame it on the hardware
    Find a way around it
    Say they need an upgrade
    Reinstall the software
    Ask for a dump
    Run with the debugger
    Try to reproduce it
    Ask them how they did it and
    See if they can do it again.

The indentation must comply with the teams coding standards, so it may either be tabs or four spaces (since the team's editors expand tabs to spaces anyway). The team lead doesn't mind a leading or trailing newline, but there is no tolerance for the dreaded standard loopholes. Also the office is a bit cramped so the code needs to be as small as possible. These lyrics are moderately adapted from http://www.manbottle.com/humor/twelve_bugs_of_christmas

\$\endgroup\$
4
  • \$\begingroup\$ What is the actual challenge? A kolmogorov-complexity to reproduce the quoted text verbatim? \$\endgroup\$ Aug 8, 2016 at 21:41
  • \$\begingroup\$ whoops should have tagged it as such @PeterTaylor \$\endgroup\$ Aug 8, 2016 at 21:42
  • 6
    \$\begingroup\$ There doesn't seem to be much of a pattern here. What does this add over other kgc questions? (And why isn't it a dupe of the Rickroll challenge?) \$\endgroup\$ Aug 9, 2016 at 20:23
  • \$\begingroup\$ @FryAmTheEggman I could put all 12 verses of the 12 bugs of christmas in. But then it could be a dupe of the 12 days of christmas challenge \$\endgroup\$ Aug 9, 2016 at 20:24
-2
\$\begingroup\$

Crab Canon

A crab canon is a piece of music where the same tune is played backwards and forwards at the same time, and it somehow sounds nice. The most famous example is this one by Bach. In Godel, Escher, Bach, Douglas Hofstadter wrote a crab canon in dialog form, in which the characters of Achilles and the Tortoise alternate lines, with one set of lines being the same as the other set except backwards. Somehow, it makes sense.

The challenge is to write a program inspired by this art form. The only requirement is that there has to be some sort of reversal of the source code involved. For example, you could make a program that:

  • Prints its own source code, but backwards
  • Does the same thing when reversed
  • Both of the above at the same time
  • Or make up something creative and wow the voters!

The reversal can happen on pretty much whatever level you want: lines of code, characters, characters within lines, or whatever makes sense for your language. The Hofstadter Crab Canon has some small changes between the two sets of lines for the sake of coherence, you can do something similar if you feel it is necessary.

This is a popularity contest, the answer with the most votes wins.

\$\endgroup\$
4
  • 7
    \$\begingroup\$ This is without a doubt too broad. See codegolf.stackexchange.com/tags/popularity-contest/info \$\endgroup\$ Aug 16, 2016 at 7:10
  • \$\begingroup\$ @PeterTaylor FYI there's something wrong with that link's formatting \$\endgroup\$
    – tbodt
    Aug 16, 2016 at 18:07
  • \$\begingroup\$ There isn't any formatting. I just pasted the link directly. And it works for me. \$\endgroup\$ Aug 16, 2016 at 19:11
  • \$\begingroup\$ @PeterTaylor hmm, seems to have fixed itself... \$\endgroup\$
    – tbodt
    Aug 16, 2016 at 19:12
-2
\$\begingroup\$

Petals around the Roses

Given 5 numbers from 1 to 6, calculate the number of Roses, Petals and Roots. Try guessing the formulas yourself by visiting http://jetpackshark.com/RPS before reading anybody's answers. (The dice-like display is significant.)

This is , so the shortest program wins.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ If you're looking for a "solve-the-puzzle" challenge, the site for that is Puzzling. If you want it to be a code-golf, then please include a formula for how the roses, petals, and roots are calculated. \$\endgroup\$ Aug 16, 2016 at 13:06
  • 1
    \$\begingroup\$ Or at the very list a definition of roses, petals, and roots in this context. At present this question makes no more sense than the output of a Markov text generation process. \$\endgroup\$ Aug 16, 2016 at 13:44
-2
\$\begingroup\$

Write a Brainfuck interpreter in Brainfuck

Since Brainfuck is known to be turing-complete, it is possible to write a Brainfuck interpreter in Brainfuck. This is what you're supposed to do.

You will get the input from the standard input and output to the standard output. This is a programming-puzzle, so the length is not top priority, however if there are multiple solutions, the shortest one wins!

\$\endgroup\$
1
  • \$\begingroup\$ BF interpreter (non language specific) challenge has already been done, and language exclusive challenges generally aren't good \$\endgroup\$ Aug 19, 2016 at 1:45
-2
\$\begingroup\$

Щoгкeгs of tиe щoгld, цпite!

Iпtгodцctioп

Iп tиe Iпteгпets, people sometimes liкe to stчlize tиeiг posts дs if tиeч щeгe щгitteп iп д diffeгeпt scгipt. Tидпкs to tиe пotoгietч of Soviet Яцssiд, tиe Cчгчlic scгipt seems to бe pдгticцlдгlч fдvoгed.

Бцt щидt cдп д пext-dooг tгoll do if tиeч'гe пot д pгogгдmmeг? Mдпцдllч гeplдciпg eдcи дпd eveгч letteг cдп бe qцite tedioцs...

Cидlleпge

Чoц дгe to щгite д pгogгдm tидt щill дccept дп дгбitгдгilч loпg iпpцt of Lдtiп cидгдcteгs дпd sцбstitцte some letteгs щitи similдгlч looкiпg Cчгчlics cидгдcteгs. Tиe oцtpцt sиoцld бe ideпticдl to tиe oцtpцt pгodцced бч tиe folloщiпg цпgolfed C# scгipt:

цsiпg Sчstem;
цsiпg Sчstem.Collectioпs.Geпeгic;
цsiпg Sчstem.Liпq;
 
pцбlic clдss Test
{
    pцбlic stдtic void Mдiп()
    {
        Dictioпдгч<cидг, cидг> tгдпs = пeщ Dictioпдгч<cидг, cидг>{
            {'A', 'д'},
            {'a', 'д'},
            {'B', 'Б'},
            {'b', 'б'},
            {'N', 'И'},
            {'b', 'и'},
            {'K', 'К'},
            {'k', 'к'},
            {'N', 'П'},
            {'n', 'п'},
            {'R', 'Я'},
            {'r', 'г'},
            {'U', 'Ц'},
            {'u', 'ц'},
            {'W', 'Щ'},
            {'w', 'щ'},
            {'Y', 'Ч'},
            {'y', 'ч'}
        };
 
        stгiпg s; щиile((s = Coпsole.ЯeдdLiпe()) != пцll) {
            Coпsole.ЩгiteLiпe(
                пeщ stгiпg(s.Select(c => tгдпs.CoпtдiпsКeч(c) ? tгдпs[c] : c).
                    Toдггдч()
                )
            );
        }
    }
}

Tиe sиoгtest code щiпs.

Exдmple Iпpцt дпd Oцtpцt

Iпpцt:

As we know, the goal of every struggle is victory. But if the proletariat is to achieve victory, all the workers, irrespective of nationality, must be united. Clearly, the demolition of national barriers and close unity between the Russian, Georgian, Armenian, Polish, Jewish and other proletarians is a necessary condition for the victory of the proletariat of all Russia.

We are for the withering away of the state, and at the same time we stand for the strengthening of the dictatorship of the proletariat, which represents the most powerful and mighty of all forms of the state which have existed up to the present day. The highest development of the power of the state, with the object of preparing the conditions of the withering away of the state: that is the Marxist formula. Is it "contradictory"? Yes, it is "contradictory." But this contradiction is a living thing and wholly reflects the Marxist dialectic.

Oцtpцt:

дs щe кпoщ, tиe goдl of eveгч stгцggle is victoгч. Бцt if tиe pгoletдгiдt is to дcиieve victoгч, дll tиe щoгкeгs, iггespective of пдtioпдlitч, mцst бe цпited. Cleдгlч, tиe demolitioп of пдtioпдl бдггieгs дпd close цпitч бetщeeп tиe Яцssiдп, Geoгgiдп, дгmeпiдп, Polisи, Jeщisи дпd otиeг pгoletдгiдпs is д пecessдгч coпditioп foг tиe victoгч of tиe pгoletдгiдt of дll Яцssiд.

Щe дгe foг tиe щitиeгiпg дщдч of tиe stдte, дпd дt tиe sдme time щe stдпd foг tиe stгeпgtиeпiпg of tиe dictдtoгsиip of tиe pгoletдгiдt, щиicи гepгeseпts tиe most poщeгfцl дпd migиtч of дll foгms of tиe stдte щиicи идve existed цp to tиe pгeseпt dдч. Tиe иigиest developmeпt of tиe poщeг of tиe stдte, щitи tиe oбject of pгepдгiпg tиe coпditioпs of tиe щitиeгiпg дщдч of tиe stдte: tидt is tиe Mдгxist foгmцlд. Is it "coпtгдdictoгч"? Чes, it is "coпtгдdictoгч." Бцt tиis coпtгдdictioп is д liviпg tиiпg дпd щиollч гeflects tиe Mдгxist diдlectic.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Welcome to PPCG and thanks for using the Sandbox! Unfortunately, this challenge is essentially the same as this question. Also, please don't write your specs in this "stylised" manner. It greatly hurts the searchability of your post. \$\endgroup\$ Aug 20, 2016 at 22:03
  • \$\begingroup\$ Your code is also stylized. Does your code run properly? \$\endgroup\$ Aug 20, 2016 at 22:34
  • \$\begingroup\$ @ColdGolf And do you think I'd stylize my post by hand? \$\endgroup\$
    – gaazkam
    Aug 21, 2016 at 2:13
  • \$\begingroup\$ @FryAmTheEggman OK, thank you. I now see my challenge was pointless and won't post it to the main. \$\endgroup\$
    – gaazkam
    Aug 21, 2016 at 2:14
  • \$\begingroup\$ Nothing is pointless: now you you know more and can come up with a better challenge! :) \$\endgroup\$ Aug 21, 2016 at 2:17
  • \$\begingroup\$ @ColdGolf OK you were right, I messed up the stylization. {'b', 'и'} - here is a bug. Sorry. \$\endgroup\$
    – gaazkam
    Aug 21, 2016 at 2:22
  • \$\begingroup\$ @gaazkam Does your code, with the stylized цsiпg Sчstem;, run properly? \$\endgroup\$ Aug 21, 2016 at 2:39
  • \$\begingroup\$ @ColdGolf I regard people of CodeGolf intelligent enough to find out they'd have to unstylize this code ^^ :) \$\endgroup\$
    – gaazkam
    Aug 22, 2016 at 7:11
  • \$\begingroup\$ @gaazkam I see. \$\endgroup\$ Aug 22, 2016 at 17:34
-2
\$\begingroup\$

Alphabet ripple

You must print out this exact text:

abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwxyyyyxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwxxxxxxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwwwwwwwwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvvvvvvvvvvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuuuuuuuuuuuutsrqponmlkjihgfedcba
abcdefghijklmnopqrsttttttttttttttsrqponmlkjihgfedcba
abcdefghijklmnopqrssssssssssssssssrqponmlkjihgfedcba
abcdefghijklmnopqrrrrrrrrrrrrrrrrrrqponmlkjihgfedcba
abcdefghijklmnopqqqqqqqqqqqqqqqqqqqqponmlkjihgfedcba
abcdefghijklmnopppppppppppppppppppppponmlkjihgfedcba
abcdefghijklmnoooooooooooooooooooooooonmlkjihgfedcba
abcdefghijklmnnnnnnnnnnnnnnnnnnnnnnnnnnmlkjihgfedcba
abcdefghijklmmmmmmmmmmmmmmmmmmmmmmmmmmmmlkjihgfedcba
abcdefghijkllllllllllllllllllllllllllllllkjihgfedcba
abcdefghijkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkjihgfedcba
abcdefghijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihgfedcba
abcdefghiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiihgfedcba
abcdefghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhgfedcba
abcdefggggggggggggggggggggggggggggggggggggggggfedcba
abcdeffffffffffffffffffffffffffffffffffffffffffedcba
abcdeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedcba
abcddddddddddddddddddddddddddddddddddddddddddddddcba
abccccccccccccccccccccccccccccccccccccccccccccccccba
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Specs

  • You may do it in all-uppercase instead of all-lowercase.
  • A single leading and trailing newline are allowed
  • You may not output an array of strings - the delimiter must be a newline

Scoring

This is . Program with lowest byte-count wins.

\$\endgroup\$
8
  • \$\begingroup\$ Seriously, another alphabet challenge ._. \$\endgroup\$ Aug 21, 2016 at 14:23
  • 2
    \$\begingroup\$ Duplicate, too lazy to find. \$\endgroup\$
    – Leaky Nun
    Aug 21, 2016 at 14:27
  • 3
    \$\begingroup\$ @LeakyNun you're too lazy to search through your own challenges...? \$\endgroup\$ Aug 21, 2016 at 20:49
  • \$\begingroup\$ @trichoplax I don't feel like wasting my time to search for the duplicate. \$\endgroup\$
    – Leaky Nun
    Aug 21, 2016 at 20:57
  • 8
    \$\begingroup\$ @LeakyNun I knew what you meant - I was just making a poor joke that you would only need to search your own challenges since you wrote every alphabet challenge... \$\endgroup\$ Aug 21, 2016 at 21:15
  • \$\begingroup\$ @LeakyNun, this Show tree rings age? \$\endgroup\$
    – manatwork
    Aug 23, 2016 at 10:50
  • \$\begingroup\$ @LeakyNun what exactly is the duplicate? I'd like to know. \$\endgroup\$ Aug 27, 2016 at 16:39
  • \$\begingroup\$ @ConorO'Brien this \$\endgroup\$
    – Leaky Nun
    Aug 27, 2016 at 16:46
-2
\$\begingroup\$

The Note-Takers Dream

Meta

This challenge requires more than most challenges. Is it to much?

The goal here is simple. Turn my notes into text. To this end, any tool or web service may be employed.

Specification

  • Input
    • An image of handwritten notes, stored an some data structure (this structure is flexible)
    • This image will be a direct, over-head shot of a single page of graph paper
  • Notes
    • The notes are taken on graph paper with one character per box
    • The characters will be printable ASCII
    • An empty box should be considered as a single Space character
    • There is an implicit New Line character between each row
  • Output
    • A string of the text represented in the image
    • This image should be trimmed of leading white space
    • Trailing white space is fine
  • Score
    • The score is the sum of the Levenshtein distances between required outputs and actual outputs
    • Lowest score wins

Test Cases

Coming soon. . .

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Mathematica will win, and everyone else will weep \$\endgroup\$ Aug 30, 2016 at 22:42
  • \$\begingroup\$ So basically codegolf.stackexchange.com/q/28207/194 with a larger character set and probably a smaller test set. It's effectively a dupe IMO. \$\endgroup\$ Aug 31, 2016 at 7:52
  • \$\begingroup\$ Golfing in ABBYY FineReader Engine has never been so exciting. \$\endgroup\$ Aug 31, 2016 at 14:45
-2
\$\begingroup\$

Print the name of the language

The goal of this challenge, as implied in the title, is to print the name of the language with a program in said language, in as few bytes as possible.

But that would be too easy, right ?

So to add a litle bit of challenge, you are not allowed to use any characters included in the language's name.

Rules

  • Each submission must be a full program.

  • The program must take no input, and print the name of the language to STDOUT plus an optional trailing newline, and nothing else.

  • The program must not write anything to STDERR.

  • Usual loophole rules apply

  • Submissions are scored in bytes, in an appropriate encoding, usually (but not necessarily) UTF-8.

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

Sandbox

After checking, I don't think this question is a dupe.
Are there any grammatical mistakes ? (English isn't my first language)
Are there any rules that should be added (like banning languages created after the challenge ?) Should I add any further specification ?

\$\endgroup\$
4
  • \$\begingroup\$ Do X without Y is discouraged. We're talking about your question in Code Golf Chat right now. (And now the conversation's moved on...) \$\endgroup\$
    – wizzwizz4
    Sep 1, 2016 at 8:39
  • \$\begingroup\$ @wizzwizz4 Would removing the "not use characters in the program name" rule make it better ? I didn't want the challenge to become "who has the shortest printf command" \$\endgroup\$
    – Lamedonyx
    Sep 1, 2016 at 8:45
  • 3
    \$\begingroup\$ At the moment it's "who has the shortest program name". \$\endgroup\$
    – wizzwizz4
    Sep 1, 2016 at 8:48
  • \$\begingroup\$ If the challenge is in danger of becoming "who has the shortest printf command" then rather than trying to fix it you should consider throwing it away and looking for an interesting challenge. \$\endgroup\$ Sep 1, 2016 at 11:42
-2
\$\begingroup\$

Make a dummy C program

We all know the feeling. You have written a short, efficient and readable one-liner that's the perfect solution to the problem. Then your code-illiterate boss looks over your shoulder and is not very happy that you've spent an entire paid hour producing "nothing". You could politely explain the situation to your boss, complete with a demonstration that your code does what it should. Or, because talking to people is Hard Work™, you could fake it.

Your task is to write a program that takes a list of keywords as input, and outputs dummy C code that looks like it does something to do with those words. Sandbox note: not happy with the wording in final bit here.

For example, if the inputs were integral, formula, math, proof, fit and square, the output might be:

#include <math.h>
#include <setjmp.h>
double* squarefit(int integral, float* mathproof)
{
    char **integralb={{0}};
    double square[integral];
    int i=0;

    //integral math formula fit
    for(integralb[0][0]=(char)erff(*mathproof);isnan((double)++integral);i++) {
        return hypot(sqrt(square[integral]),integral)?square:square;
        printf(*integralb,integral,*mathproof);
    }
    setjmp((struct __jmp_buf_tag*)mathproof+(int)(abs(--integral)-expm1l(integral)));
    longjmp(0,0);
    return square;
}

Although it doesn't have to do anything, or even run successfully properly, the source code produced by your program must compile in gcc (no additional options) without fatal errors. You do not need to provide a main function; if you don't, expect the line int main(void){} to be appended to the output file before it is compiled.

This is a , so the best-liked answer will win. However, voters should keep these questions in mind when assessing the submissions:

  • Does the produced source code look like it does the expected task? Yes.
  • Does the produced source code look like it has taken a long time to produce? Yes.
  • Do different inputs result in the same program, just with different variable names? No.
  • Does the produced source code look like the same code repeated over and over? No.
  • Do your parents, grand-parents, co-workers or other "not computer people" think the produced source code was something to do with the input keywords (optional)? Yes.
  • Would you think the produced source code was written by a person with knowledge of the C language, if you did not know that it was just dummy code (optional)? Yes.
  • Does the code look readable (e.g. ungolfed)? Yes.

Not all of the standard loopholes apply for this challenge. For example, you mignt use external resources, such as library files or an indexable website. However, voters should use their discretion as to what is reasonable and what is not (such as expecting the "keywords" to be in a format that includes a high-quality, valid C program).

Sandbox note: how to finish challenge body?

\$\endgroup\$
11
  • \$\begingroup\$ Is this a language-specific challenge? \$\endgroup\$
    – user56309
    Sep 29, 2016 at 17:05
  • \$\begingroup\$ @tuskiomi No, it's open to all languages. \$\endgroup\$
    – wizzwizz4
    Sep 29, 2016 at 17:06
  • \$\begingroup\$ Generally it's a good Idea to separate your challenge into five sections: the intro, summary, input, output, and examples. I'd recommend you do so here as well. \$\endgroup\$
    – user56309
    Sep 29, 2016 at 17:07
  • 1
    \$\begingroup\$ @tuskiomi Thanks, will do. Give me 6 to 8 weeks... \$\endgroup\$
    – wizzwizz4
    Sep 29, 2016 at 17:11
  • 3
    \$\begingroup\$ @tuskiomi I disagree. There are plenty of ways to organize a challenge effectively. However, this challenge looks like it might suffer a bit from the "art contest" issue, so be wary wizz. \$\endgroup\$ Sep 29, 2016 at 17:31
  • \$\begingroup\$ @HelkaHomba I never said that it's the ONLY way to organize challenges to be effective, I said that generally it's a good idea to do that format. \$\endgroup\$
    – user56309
    Sep 29, 2016 at 17:34
  • \$\begingroup\$ @HelkaHomba That's the format I often use, and I plan to split it into headings. What do you mean by "art contest issue"? \$\endgroup\$
    – wizzwizz4
    Sep 30, 2016 at 6:28
  • 1
    \$\begingroup\$ I mean the judging is up to the whim of the voters own opinions and knowledge of how C code should look. We've had issues before with challenges like "draw the prettiest picture" which is plainly an art, not programming contest, and those kind of thing rarely go over well, often close voted as "primarily opinion based". This challenge (and all pop-cons really) suffer from similar issues. I'm not personally against this challenge or art contests, but it's just an issue you may need to face. \$\endgroup\$ Sep 30, 2016 at 6:35
  • \$\begingroup\$ @HelkaHomba Do you have suggestions as to which questions to change / remove / reword to stop it being bad subjective? \$\endgroup\$
    – wizzwizz4
    Sep 30, 2016 at 6:45
  • \$\begingroup\$ I kind of like this, but I bet it would be closed as too broad. Anything from the program you provided to main(){integral+formula+square+proof+fit==math?return 0:return 1;} would be allowed. \$\endgroup\$
    – MD XF
    May 26, 2017 at 20:13
  • \$\begingroup\$ @MDXF That wouldn't be valid if the inputs foo, bar, baz, fizz, buzz, fred would result in main(){foo+bar+baz+fizz+buzz==fred?return 0:return 1;}. Also, gcc gets very cross that none of those names are defined, so it won't compile. So actually that wouldn't be allowed. Also note that that is a boring submission to a popularity-contest. \$\endgroup\$
    – wizzwizz4
    May 27, 2017 at 8:06
-2
\$\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\$
9
  • \$\begingroup\$ Do robbers have to produce the same program, or any program? \$\endgroup\$ Oct 28, 2016 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\$ Oct 28, 2016 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\$ Oct 28, 2016 at 20:57
  • \$\begingroup\$ @NathanMerrill Any program. \$\endgroup\$
    – jimmy23013
    Oct 28, 2016 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, 2016 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, 2016 at 21:13
  • 1
    \$\begingroup\$ An example would make this easier to understand, \$\endgroup\$
    – xnor
    Oct 29, 2016 at 6:08
  • 3
    \$\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, 2016 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, 2016 at 0:59
-2
\$\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\$
5
  • \$\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\$ Nov 1, 2016 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, 2016 at 13:45
  • 1
    \$\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\$ Nov 1, 2016 at 22:04
  • 1
    \$\begingroup\$ Ah, now I see the source of confusion. Updated text to require basic translation, not symmetric translation \$\endgroup\$
    – wnnmaw
    Nov 2, 2016 at 11:53
  • \$\begingroup\$ Also I don't think translation is objective enough for code golf... \$\endgroup\$ Nov 3, 2016 at 5:30
-2
\$\begingroup\$

Urinal Discomfort!

This question springboards off of Positional Bathroom Etiquette, while adding an extra twist.

Background

I'm going to take @Nick Frev 's formulae for the total discomfort of a urinal spot

dist(x,y) = linear distance between person x and person y in Urinal Units
discomfort(x) = sum(1/(dist(x,y)*dist(x,y))) for all persons y excluding person x
total_Discomfort = sum(discomfort(x)) for all x
short_urinal_discomfort = discomfort_from_surroundings + 1/9 (inherent_discomfort)

Your task is to put a person into the spot with the least total discomfort. However, now you have big and small urinals. The small ones, obviously, cause a little inherent discomfort, so we prefer to not use those if we have a choice.

The Challenge

Input/Output

Your program will take in a string of 1,0,i,o to represent the row of urinals. 1 represents a person in a tall urinal, 0 is an empty tall urinal, i is a full short urinal, and o is an empty short urinal.

Using the above formulae, build a program that will replace an empty urinal with the correct placement of the next person(0->1 or o->i).

  • The short urinals have an inherent discomfort of 1/9 which will be added onto the discomfort provided by the surroundings.
  • The door is to the right of the row, so the urinals fill up right to left, because you have to pee really bad and can't walk further than you have to.

Input Output 000 001 101 111 1000001 1001001 101010101 101010111 000o 001o 100o 100i oo0oooo oo1oooo 11000ii 11010ii

Any tips would be super helpful

More test cases maybe? Or more clarification?

\$\endgroup\$
-2
\$\begingroup\$

Stump the OEIS!

The OEIS is a wonderful database of integer sequences, but occasionally, there are code golf problems that generate integer sequences not found in the OEIS. Your challenge is to write some code that generates a sequence that meets all of the following criteria:

  1. Sequence must not exist in the OEIS. Prove this by providing a link to the search for your sequence showing 0 results, such as this: 1,2,6,81,35246. In the spirit of good faith, please do not generate a sequence that is merely an existing sequence offset or multiplied by some constant.
  2. The sequence must be non-repeating, non-oscillating, etc. Formally, there must not exist a subsequence S with finite length L, that begins at index I such that the subsequence from [I+kL] to [I+(k+1)L-1] for every k is identical to S. Such an invalid sequence would be 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, ... because the subsequence 1, 2, 3 beginning at index 1 with length 3 also exists as the subsequence from 4 to 6, from 7 to 9, from 10 to 12, etc.
  3. The sequence must contain a minimum of 3 distinct integers.
  4. The sequence must be deterministic, e.g. there must not be any element of randomness in the generation of your sequence. Every time your program is run, it must provide the same exact sequence.

Please write code that provides as many integers in your sequence as feasible. At least 20 is recommended, though sequences that grow incredibly fast can provide fewer, provided you also give a proof that your code would produce that number if given enough time.

This will be a problem, so the entry with the fewest number of bytes wins.

A bonus of -20% can be applied to your score if, in addition to your sequence, you can also provide some mathematical justification for your sequence being included in the OEIS in the future.

Standard loopholes are disallowed, as well as sequences that are simply "this sequence is just the handful of numbers I came up with to fit this problem."

\$\endgroup\$
10
  • \$\begingroup\$ You say "must contain an infinite number of entries not 0 or 1", then go on to talk about finite sequences, so I'm not sure what you're looking for here. \$\endgroup\$
    – Geobits
    Nov 17, 2016 at 17:44
  • \$\begingroup\$ Changed it to "The sequence, if infinite, must contain" blah blah blah \$\endgroup\$ Nov 17, 2016 at 17:45
  • \$\begingroup\$ This is definitely going to be closed as "Too broad" - if it isn't closed first as "Unclear what you're asking" because of the impossibility of testing whether "this sequence is just the handful of numbers I came up with to fit this problem." \$\endgroup\$ Nov 17, 2016 at 17:52
  • \$\begingroup\$ @PeterTaylor If I removed the possibility of finite sequences, then IMO that second possibility goes away. As for being closed for too broad, there have been problems that don't have a single goal that have done well, such as Does this code terminate? that inspired a lot of very creative answers. \$\endgroup\$ Nov 17, 2016 at 17:59
  • \$\begingroup\$ Its pretty easy to fill most of the requirements you've listed here: all you need to do is combine two different OEIS sequences (multiply or add). Restriction 3 should be changed to "Your sequence must contain at least 3 distinct terms". I'd also definitely recommend disallowing finite sequences, as well as the 20% bonus (which is very ambiguous) \$\endgroup\$ Nov 17, 2016 at 18:33
  • \$\begingroup\$ @NathanMerrill That's a good idea for a change to #3, but as for being able to simply combine existing sequences, there's plenty of existing sequences like that are already in the OEIS even without necessarily being important. \$\endgroup\$ Nov 17, 2016 at 18:44
  • \$\begingroup\$ @GabrielBenamy right, its not necessarily a bad thing, its just that most sequences generated aren't going to be that interesting. Also, what's to stop me from simply adding a random "9" number to the beginning of the sequence, or replacing the first term with "9"? \$\endgroup\$ Nov 17, 2016 at 18:45
  • 1
    \$\begingroup\$ Consider the family of sequences parameterised by x where S(x, n) = n >= x ? n+1 : n. Only a finite number of those sequences are either in OEIS or a linear transform of a sequence in OEIS. Are they caught by "just the handful of numbers I came up with to fit this problem"? IMO it's ambiguous. \$\endgroup\$ Nov 17, 2016 at 19:22
  • \$\begingroup\$ That's a good point. Is there any way to salvage this concept? \$\endgroup\$ Nov 17, 2016 at 19:24
  • \$\begingroup\$ This is similar to the question "print something with no results on google". It got closed for being a question about Google's database, not about code-golf, so this one will probably be closed too. \$\endgroup\$
    – FlipTack
    Nov 19, 2016 at 13:37
-2
\$\begingroup\$

Golf + Polyglot + Circle = ?

In the original challenge, we asked you to do this:

Program | Language | Result
--------|----------|----------
A       | A        | Program B
B       | B        | Program A
A       | B        | Program C
B       | A        | Program C
C       | A        | "Wrong language!" 
C       | B        | "Wrong language!" 

Now we're asking you to do this*:

Program | Language | Result
--------|----------|----------
1       | 1        | Program 2
2       | 2        | Program 3
3       | 3        | Program 4
        |    ...   |
X       | X        | Program 1
--------|----------|----------          
1       | Any but 1| Any member of Set %
2       | Any but 2| Any member of Set %
        |    ...   |
X       | Any but X| Any member of Set %
------------------------------
Set %   | Any lang | "Wrong language!"

(see original challenge for clarification)

Rules

  • Do not grab source off of internet, or read own code from file
  • Programs don't have to be distinct - you can make a polyglot quine
  • Don't take input for any of the programs
  • Different versions of the same language count do as different languages. (although this is discouraged because it leads to boring solutions)
  • Standard loopholes apply

Scoring

Score is byte_count_of_program_one/2.75**languages_supported, the submission with the lowest score wins.

Template

Because of its length, the answer template is here.


*not that I'm expecting X to be so large

\$\endgroup\$
4
  • \$\begingroup\$ +1 this comment if you think the title should be "Polyglot-Quine-Codegolf Returns!" \$\endgroup\$ Nov 23, 2016 at 23:38
  • \$\begingroup\$ +1 this comment if you think the title should stay the same \$\endgroup\$ Nov 23, 2016 at 23:38
  • \$\begingroup\$ Reply to this question if you have a better title \$\endgroup\$ Nov 23, 2016 at 23:38
  • \$\begingroup\$ I personally think the title is way too descriptive, but "polyglot-quine-codegolf" isn't really descriptive enough. The problem is, I don't currently have a better idea... \$\endgroup\$ Nov 24, 2016 at 0:12
-2
\$\begingroup\$

Signs in Permutations

Introduction

Let's take the permutations of 123.

123
132
213
231
312
321

We can insert signs in between the numbers and count how many > signs there are:

1 < 2 < 3 # 0
1 < 3 > 2 # 1
2 > 1 < 3 # 1
2 < 3 > 1 # 1
3 > 1 < 2 # 1
3 > 2 > 1 # 2

We can arrange this in a table with n corresponding to the number (in this case 3) and k corresponding to the number of > signs, you get this:

┌───┬───┬────┬─────┬─────┬────┬───┐
│n\k│ 0 │  1 │  2  │  3  │  4 │ 5 │
├───┼───┼────┼─────┼─────┼────┼───┤
│ 1 │ 1 │    │     │     │    │   │
│ 2 │ 1 │  1 │     │     │    │   │
│ 3 │ 1 │  4 │   1 │     │    │   │
│ 4 │ 1 │ 11 │  11 │   1 │    │   │
│ 5 | 1 │ 26 │  66 │  26 │  1 │   │
│ 6 │ 1 │ 57 │ 302 │ 302 │ 57 │ 1 │
└───┴───┴────┴─────┴─────┴────┴───┘

Task

Given an n and k, print the number in the table corresponding to that n and k.

Remember, this is , so the code with the fewest bytes wins.

Related OEIS sequence

\$\endgroup\$
1
-2
\$\begingroup\$

I want to post the question here to make sure it is suitable.

Question: Word Equations

Given a word equation, the solution must output the answer.

My definition of a 'word equation' is an equation where the operators are words.


The operators will be spelt as

add minus times divide


The solution must take one input

The solution must give one output

Examples:

Input: 7 add 8 Output: 15

Input: 9 times -2 Output: -18

Input: 24 divide 2 Output: 12

Input: 4 minus 5 Ouput: -1


You are not required to deal with divide by zero errors.

Fewest characters will win

Feedback is welcomed

\$\endgroup\$
4
  • \$\begingroup\$ What is the winning criterion? \$\endgroup\$
    – acrolith
    Dec 2, 2016 at 22:14
  • \$\begingroup\$ @daHugLenny fewest characters, should have known to include that \$\endgroup\$
    – george
    Dec 2, 2016 at 22:59
  • \$\begingroup\$ Be aware that you will receive many answers in the form: substitute words with corresponding char (+-*/), then evaluate the string you got. Non necessarily a bad thing, just pointing this out in case you expect people to build a calculator from scratch. \$\endgroup\$
    – Leo
    Dec 3, 2016 at 18:41
  • \$\begingroup\$ @Leo the way I expected to solve it was by char substituting. However building a calculator from scratch only using + and - could be an interesting challenge \$\endgroup\$
    – george
    Dec 3, 2016 at 18:55
-2
\$\begingroup\$

GoL flooding

Considering a 1000x1000 grid (no wrapping, borders dead), your task is to grow the maximum "stable" population from the fewer individuals.

For the purpose of this challenge, the definition of stable is a configuration who repeat with a period of less than hundred(100) generations.

Scoring

Your score is lowest number of live cells in your stable population divided by the number of initialy live cells, highest score win

meta post about on topicness

\$\endgroup\$
2
  • \$\begingroup\$ How many generations does the simulation run before the score is tabulated? \$\endgroup\$ Dec 8, 2016 at 13:48
  • \$\begingroup\$ @TimmyD I would say 10.000 but feel free to suggest a better number if you think it could improve \$\endgroup\$
    – Sefa
    Dec 8, 2016 at 14:07
-2
\$\begingroup\$

Convenient Palindromic quine golf, Cops

This is the cops thread, the robber's thread is here.

Cop's Challenge

A program is conveniently palindromic if

it is equal to the string derived when its reverse has all its parentheses (()), brackets ([]), and braces ({}) flipped. No other characters are special and require flipping. (<> are sometimes paired but often not so they are left out.)

copied from this challenge.

Write a conveniently palindromic program that prints its own source. This is the robber's goal:

  • Remove byte(s) from the cop's program so that the resulting program:
    • prints the original source, or
    • prints the new modified source
  • Resulting program need not be a convenient palindrome

A counterexample

JavaScript

(function $(){console.log('('+$+'())')}())//((){('(()'+$+')')gol.elosnoc}()$ niotcnuf)

is easily cracked because the robber can remove all the characters past the comment and it will still print its own source.

Rules

  • Program must be longer than one character
  • No reading from a file or grabbing from an external resource
  • Submissions that aren't cracked for 7 days are marked as "safe", and cannot be cracked anymore
  • Cop's submissions after XX/XX/XX are non-competing (can be pushed back depending on popularity), so there are still robbers around to crack it
  • The shortest safe solution in bytes wins.
  • Robbers won't have a chosen winner

\$\endgroup\$
7
  • \$\begingroup\$ This is basically just a "comment-free palindromic quine" challenge, right? When those challenges have been run elsewhere, the comment-freedom has been verified via brute forcing rather than via a robber, and I suspect that the robbers might not have much to do here. (That said, some languages are slow enough that brute-forcing their correctness would be difficult.) In other news, you should probably require proper quine rules, even if we can't quite define them; under your current rules, 1 is a valid palindromic quine in PHP. \$\endgroup\$
    – user62131
    Dec 9, 2016 at 22:41
  • \$\begingroup\$ I would possibly change the palindrome restriction to convenient palindromes, as these are way easier to implement in most common languages such as JS and Python. \$\endgroup\$ Dec 9, 2016 at 23:01
  • \$\begingroup\$ @ais523 1. Yas. That was my aim! 2. It's difficult to implement a brute-force solution for a longer submission, how would that work? 3. Program must be longer than one character 4. Thanks. \$\endgroup\$ Dec 10, 2016 at 14:27
  • \$\begingroup\$ 11 then :-P. Also, in a way I think this might be more interesting with true palindromes, as it forces you to hide the backwards string somehow, but I agree that it would disqualify a lot of languages. \$\endgroup\$
    – user62131
    Dec 10, 2016 at 14:40
  • \$\begingroup\$ @ais523 I'll do a true palindrome one then a convenient palindrome one later, perhaps? (also 11 then means ?) \$\endgroup\$ Dec 10, 2016 at 14:44
  • \$\begingroup\$ @ais523 When those challenges have been run elsewhere, they have? \$\endgroup\$ Dec 10, 2016 at 14:51
  • \$\begingroup\$ Neither this challenge nor this challenge has the same task as yours, but they both disallowed comments in much the same way as this one (i.e. by ensuring that deleting from the program breaks it). \$\endgroup\$
    – user62131
    Dec 10, 2016 at 15:27
1
142 143
144
145 146
153

You must log in to answer this question.

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