578
\$\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\$
3
  • 1
    \$\begingroup\$ What if I posted on the sandbox a long time ago and get no response? \$\endgroup\$ Commented May 15, 2024 at 14:05
  • 2
    \$\begingroup\$ @None1 If you don't get feedback for a while you can ask in the nineteenth byte \$\endgroup\$ Commented May 29, 2024 at 13:27
  • \$\begingroup\$ I have been once submitted a question to sandbox and downvoted to -1, but after submitting it anyway it has 8-9 score right now. \$\endgroup\$ Commented Dec 5, 2025 at 18:13

5038 Answers 5038

1
156 157
158
159 160
168
-1
\$\begingroup\$

Given 3 of angles and edges of a triangle, decide how many possible triangles exist.

Input:

3 conditions. You can take 6 inputs to represent all edges and angles, with an invalid value to mean not present; or just three.

All given edges and angles are positive and less than 100000, but angles are not bounded by 180 degree so you need to check that.

Output:

An integer describing how many possibilities. You can assume that answer remain same if any input differ by at most 0.001%, which also results that some edge cases needn't be taken care.

Test cases

E A(degree) E A E A
3 -  4 - 5 - => 1
3 90 4 - - - => 1
5 60 - - 4 - => 2
4 60 - - 5 - => 1
5 60 - - 1 - => 0
5 200 3 - - - => 0
4 30 - - 2 - (Invalid input)
\$\endgroup\$
2
  • \$\begingroup\$ I assume that decided means that all the angles and sides are consistent with another, and actually form a Euclidean triangle. Impossible would be the opposite of this. Multi possibility only makes sense if the input is incomplete, i.e. not enough information (angles and edges) to finalise an entire triangle with all sides and angles known. Is that correct? Could you please elaborate what your definition of those three categories are? Also, you have stated that the input is 3 angles and 3 edges. Can it actually be 0-3 angles and 0-3 edges? \$\endgroup\$ Commented Apr 1, 2024 at 7:39
  • 1
    \$\begingroup\$ @DanielOnMSE Angles and edges may be missing, which I said maybe (take) 0 or non-number \$\endgroup\$ Commented Apr 1, 2024 at 8:11
-1
\$\begingroup\$

Compute digits of sqrt(2)

Your answer must display sequentially the digits of sqrt(2), one by one, without halting.

You are free to pick the base of your choice as long as it is an integer greater or equal to 2.

You may bundle the point that separate the integer part from the rest with the previous digit, the next one, or as a separate output.

Shortest wins.

For a matter of checking correctness, your program should be able to run up to the precision 1/INT_MAX (the one from C) on a laptop in less than an hour.

\$\endgroup\$
2
  • \$\begingroup\$ Perhaps answers could be allowed to output 14142... without the decimal point? \$\endgroup\$ Commented May 27, 2024 at 5:09
  • \$\begingroup\$ @CommandMaster I don't have a strong opinion on the matter tbh. Do you think it would be more fun? \$\endgroup\$ Commented May 27, 2024 at 12:34
-1
\$\begingroup\$

Hey Slobs! Organize your Code - Alphabetically!

So much code being written these days is an unorganized, illegible disaster, and this Code Golf website seems to attract the worst offenders - I mean, just look around! Lets add some order to this chaos.

The Challenge

Build a Quine (i.e. a program that prints out its own source code). No "cheating" quines are allowed.

Additionally, the source code should be organized alphabetically according to the following algorithm:

  1. Take your source code and split it on any non-alphabet characters to form "words" (an alphabet character is a character between a and z, and can be lowercase or uppercase). For example, the program echo "Hello 123 World!" contains three words - echo, Hello, and World.
  2. Verify that each word is in alphabetical order. More precisely:
  • Ignore casing (APPLE should comes before banana)
  • a word that is the prefix of another word comes first (at comes before attitude)
  • You can have multiple of the same words next to each other. (APPLE (Banana) "banana"; BANANA+CAKE is in alphabetical order)

You are allowed to break the alphabetical ordering, but at a heavy penalty. Every time a word is found that comes before the previous word in alphabetical order, you get a 1000 byte penalty. For example, cake apple banana would create a 1000-byte penalty because "apple" comes before "cake", and cake banana apple would create a 2000 byte penalty, because both "banana" and "apple" are out of place compared with the previous word.

Additional Notes

I don't recommend doing this challenge in a language that doesn't use alphabetical characters (e.g. whitespace, brainf***, etc). You can do it if you really want, but then its just a regular old quine challenge which makes for a very uninteresting answer.

\$\endgroup\$
2
  • \$\begingroup\$ You might want to link to the site standards for proper quines instead of specifying your own rules. Not that your spec isn't clear, but people are generally more used to the standard quine rules. \$\endgroup\$ Commented May 29, 2024 at 9:34
  • \$\begingroup\$ Thanks for the tip - updated. \$\endgroup\$ Commented May 31, 2024 at 20:21
-1
\$\begingroup\$

.

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

Question:

You need to implement two functions: one for compressing ASCII art using Run-Length Encoding (RLE) and another for decompressing RLE-encoded ASCII art.

Problem Description

Run-Length Encoding (RLE) is a compression technique that replaces sequences of the same character with a single character and its count. For example, the string "aaaabbbbccccdd" would be compressed to "4a4b4c2d". Make sure it also works with new lines incase you want to compress ascii art images.

I have ASCII message as input, and I want to compress it using RLE and then decompress it back to its original form.

Requirements Compression Function:

Input: A string representing ASCII message.
Output: The RLE-compressed version of the ASCII message.

Decompression Function:

Input: The RLE-compressed string.
Output: The original ASCII message

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

When is Daylight Savings Time?

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

Code Ruler

Measure the length of your source code. There must be a location inside your source code, not in a string literal, into which an indefinitely long string consisting of repetitions of any single character of your choice can be added. When run, your program must output the number of characters added, optionally with a constant added. (For example, it is okay to return 12 if 3 characters are added, as long is it returns 9 with 0 added, 109 with 100 added, etc.) Standard quine restrictions apply.

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

GCD for small numbers (1<=x<=64) without using L1 cache.

The goal is to compute the Greatest Common Divisor (GCD) of two small numbers ($1 ≤ x ≤ 64$) as quickly as possible without using the L1 cache.

Constraints:

  • You are not allowed to store the result in an array.
  • You can memoize auxiliary tables using uint64_t, but they should be constants in the code.

Idea:

I tried to calculate all branches of the Stein algorithm in a single uint64_t, but I could not make it work.
On most cases, GCD(x,y)=GCD(x-6,y-6), and the error is always even, and frequently a multiple of 3. So there is an opportunity compressing the residuals.

table of residual = GCD(x,y)-GCD(x-6,y-6)

$residual=GCD(x,y)-GCD(x-6,y-6)$

Rules:

  • The input numbers are between $1$ and $64$.
  • No arrays for storing results.
  • Memoization using uint64_t constants is allowed.

Example:

Input: x = 24, y = 36 Output: 12

Scoring:

The fastest implementation wins. Speed will be measured using the Godbolt Compiler Explorer (Xeon Platinum 8375C CPU), which can run small pieces of code online.

\$\endgroup\$
3
  • \$\begingroup\$ I assume you mean no instruction accessing memory? How many registers allowed to use? \$\endgroup\$ Commented Dec 30, 2024 at 8:06
  • \$\begingroup\$ @l4m2 I don't know how to express it, but the obvious solution is to create a table in RAM. However, this would not be interesting to start with and also not practical to use, because it can cause unexpected L1 cache evictions when inlined in larger code. I guess you are asking how many 64-bit constants can be stored in registers? I'm not sure, since using too many would require spilling registers to the stack, but I don't know if that's entirely avoidable. Using a large switch case is kind of cheating, because the compiler might optimize it by storing it in RAM as an array. What do you think? \$\endgroup\$ Commented Dec 30, 2024 at 8:28
  • \$\begingroup\$ It seems good if you weight opcode length: Tableing just would increase it. \$\endgroup\$ Commented Dec 30, 2024 at 14:26
-1
\$\begingroup\$

I have no clue what to put as a title and will come back tomorrow with ideas

META: this seems excessive? maybe stick to 100x100 boards or something similar

Cell`s Life #2

Meta_NB: In the process of editing this (somewhat)

Basic idea: submit some sort of algorithm to convert programs in [some language] into a finite (but arbitrarily large) Conway's Game of Life state on a square board (META: and maybe backwards, I'll add this specifically in a few days).
These programs' output should be the next 'generation' after running the rule (Von Neumann 8-cell neighbourhood, born with 3 neighbours and stays alive with either 2 or 3 neighbours, dies otherwise) in the same [some language].
Every finite (but arbitrarily large) Conway's Game of Life position should have some program representing it (after putting the cells on a square board). Conversely (kind of), every program in [some language] should unambiguously represent one Conway's Game of Life state (or be invalid).
You may have translations of the same board state and states which only differ by having bigger/smaller boards (where the on cells can be overlaid to be the same) mapped to the same program. (META: I'll check this part for contradictions with the rest of the rules soon(TM))

Okay... just maybe this isn't a "basic" idea

IO

NB: I discourage self-modifying programs solely for the reason someone doesn't actually submit a program with Conway's Game of Life itself as the language.
META: I may remove this but I am doing this pre-emptively for loophole-esque purposes

Scoring (META)

I have no clue what to put here, but here's a few ideas I had

  • of course!
    • But the issue is what 'unit' to count on? ...as a submission is actually just a relation/mapping between Conway's Game of Life states and programs.
    • If I were to just score it on something like chars for glider + chars for dot + chars for LWSS + chars for X other entity it would just be hardcoded
    • KEY NOTE: you don't need to have a unit cell similar to the OTCA metapixel and can instead encode Life states in a clever way. This is intended (for the reason I believe forcing a unit cell will make the challenge a bit restricting. I also have no clue how I would even enforce 'you need a unit cell' due to weirder ones like the 0E0P metacell which is 'offset'? No rigourous criteria I can think of at the moment) But this is extremely variable (my initial intent was to have the challenge be you building a unit cell; but as I said, it would be a nightmare to rigorously enforce... so I've let go of that idea for now)
  • Also, I ran out of ideas

Meta_NB: I am only just realising that I limit this to ONE language only... well that accident is probably a good idea anyways

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

Build the deepest filled array possible (JS)

Your goal is to create an array with the most items inside. However, it won't be so easy:

(Assume that the compiler uses V8 and has unlocked the ability to create very large pointer indexes and flags necessary to bypass other JS restrictions, making this challenge possible.)

Luckily, you are allowed to create what I will call meta-arrays. What are those? A meta-array is an array within another array. For example, let's assume that the array length limit was 3. Then, a single layer of meta-array would be this:

[[1, 1, 1], [1, 1, 1], [1, 1, 1]]

A 2-layer meta-array would be this:

[[[1, 1, 1], [1, 1, 1], [1, 1, 1]], [[1, 1, 1], [1, 1, 1], [1, 1, 1]], [[1, 1, 1], [1, 1, 1], [1, 1, 1]]]

and so on.

Your "score" will be the number of layers that your meta-array contains. (That means that the array above has a score of 2.) However, for this challenge, each array or meta-array must have exactly 4,294,967,295 elements (the maximum possible amount), and all values inside should be the value 1. Have fun!

(Stuff like Uint32Arrays are allowed for this challenge but cannot be in the output. They have separate limits, so look into those!)

Please also be aware of the JS limitations, below.

Byte limit of script: 4,096 bytes (4KiB)
String limit (assuming 64-bit V8, or Chrome): 536,870,888 characters
Maximum Safe Integer (using JS Double): 9,007,199,254,740,991 (JS Doubles are standard, so be aware of any precision limitations they have beforehand!)
BigInt limit (which is allowed for this challenge): 2^(2^30 - 1)
Maximum array length: 4,294,967,295 elements
Maximum number of properties in an Object/an array that uses properties rather than indexes: 8,388,607
Maximum number of properties in a Map: 16,777,215
Maximum recursion depth: none!

Creation of HTML elements/nodes are not allowed anywhere in the program for the purposes of this code golf.

(This challenge was inspired from Bignum Bakeoff and related competitions.)

\$\endgroup\$
1
  • \$\begingroup\$ Would it be better to decrease the byte limit to something like 512 or 1024? Perhaps that would make the challenge more likely to be answered. \$\endgroup\$ Commented May 23, 2025 at 20:03
-1
\$\begingroup\$

Bitwise Parity

Write a procedure that returns 1 if the integer n has an odd number of 1-bits in its binary form, 0 otherwise.

Examples:

Input   Binary  Output
    0        0       0
    1        1       1
    3       11       0
    5      101       0
    7      111       1

⚙️ Rules:

Must work for any non-negative integer n.

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

Help me Warholize United Nation's Flag

Please write us a GFORTH dictionary drawing the United Nations emblem but more concise than https://en.wikipedia.org/wiki/Flag_of_t15s1515s15h15s15e_United_Nations#/media/File:UN_emblem_blue.svg/2 enter image description here

<svg viewBox="0 0 470 400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#009EDC">
<path id="branch" d="m121 336c-19-16-22-39-30-59-5-13-14-24-23-35 12 34 5 58 34 82-5-2-10-6-14-9-23-19-57-22-71-53 4 23 22 43 41 56 19 12 43 11 63 18m50 12c3-1 7-1 11-2-14-2-27-7-37-16-15-14-28-28-44-39 17 34 23 48 51 54 0 0-8-1-12-2-30-6-66 2-88-23 9 16 26 29 42 35 26 8 53-1 77-7m40-2c-48 0-73 42-120 14 23 28 60 30 90 11 12-8 23-19 38-19 23 0 48 24 69 46 4-3 7-6 10-9-22-21-54-43-87-43m-135-47s-6-11-8-18c-7-27-3-60-15-86 2 15-4 28-5 42-2 19 5 32 10 41 0 0-7-9-10-14-14-22-43-37-45-64-4 59 37 75 73 99m-14-175c4-8 6-18 8-27-2 4-4 8-7 11-19 16-30 25-35 50l2-22c2-22-10-46 3-65-13 14-20 32-20 50 0 24 14 41 15 64 4-24 24-41 34-61m-7-44c9-8 20-15 28-25 9-12 17-26 29-37-16 7-34 13-45 30-6 10-7 22-12 32m-20 48c4-8 11-16 18-22 18-13 36-30 37-52-10 24-41 28-48 53 0 0 4-15 5-18 5-17 4-37 21-48-33 7-35 43-33 70 0 6 1 11 0 17m5 116s-2-19 1-27c8-24 16-50 15-75-8 30-33 40-22 81-4-8-5-17-8-25-6-22-23-41-18-67-8 23-8 41 0 65 5 18 23 31 32 48"/>
<use transform="matrix(-1,0,0,1,470,0)" xlink:href="#branch"/>
<g id="grid" stroke="#009EDC" stroke-width="4" fill="none">
<circle cx="235" cy="167" r="163"/>
<circle cx="235" cy="167" r="129"/>
<circle cx="235" cy="167" r="98"/>
<circle cx="235" cy="167" r="64"/>
<circle cx="235" cy="167" r="33"/>
<path d="m235 4v130m0 66v130m-115-278 92 92m46 46 92 92m-278-115h130m66 0h130m-278 115 92-92m46-46 92-92"/>
</g>
<g id="map" transform="matrix(.1 0 0 .1 211 140)">
<path d="m161 672c4-8 12-40 22-30s16 0 16 0 5 5 2 15c-2 10-5 20-11 22-6 1-11 5-19 6-6 1-10-13-10-13zm82-13c2-2 5 8 10 6 5-1 7 9 2 9s-5 6-5 9 0 9-4 13-7 1-12-1c-5-3-7-3-14-3-6 0-1 10-1 10s-26-1-21-5 10-5 6-8 0-5 0-10 12-3 9-6c-4-4 0-18 6-10l4-9c-4-4-1-5-9-8-7-3-1-18-1-18l1-10c2-13 27-14 29-3 1 11 0 19 0 19l7 3s-1 8-7 8 0 4-4 8zm921-608c-7 7-22 10-22 10l-5 19-8 7s2 5 0 17-17 19-17 19l-7 8s-40 2-45 0c-15-7-5-27 5-25s-2-29-2-29l13-2s2-30 7-30-2-10-8-15c-7-5-15-22-22-20s-33 0-33 0l-5 10-18 3s2 13-2 17c-10 12-48 37-32-5l5-10v-15l-30-2s-15-5-15-12-2-15-2-15l-35-39-42-5-3-8-25-3c-30-15-57-2-52 24 5 25 13 35-3 35-17 0-20-13-20-13s-13-5-13 2-5 20 0 27-7 17-12 12-18-20-15-25-23-37 3-42c27-5-2-20 8-24l13-7h13l8-7-22-3-13-2-25-2c-25 17-30 37-30 37-13 25-45-10-33-24s-37-2-45 5-33 3-33 3c-5 15-28-2-22-12 7-10 7-17 7-17l-8-2-10 19c-23 0-30 13-25 22 5 8-7-2-10 10s2 12 12 17-5 5 2 13 27 0 15 12-35 7-35 7c-2 15-33 12-37 7-3-5-28-35-28-35l-32-2c-3-24 15-12 22-30 7-19 10-49 10-49s-27-2-28 7c-2 8-18 14-18 14s-13 5-8 12-10 10-10 10 3 11-2 15c-13 14-47 2-52-3l-20-8-20-13-23 10-7 7h-25l-2 20 45 5 3 42-18-6h-12l-5-10-10-2v37l10 8 8 8 17 2 3 20 42 2 5 8 25 2 48 49-3 15-8 5c3 12-22 5-22 5v10l12 2 12 7 17-29c18-12 27 5 28 15 2 10-8 8-8 8v24l10 3c17 20-7 32-7 32l-5 17c-5 15-23 12-23 12l-7 10-20 5 39 5c4-14 14-17 19-10s5 19 5 19l10 2-2 19 10 3v54l12 13c20-8 20 5 10 12s-3 37-3 37l-8 8v14l-10 7v19c-17-8-37-5-42 0-15-10-47-7-47 2 10 13-12 17-12 17l-12 13c8 17-8 19-8 19v32l-20 19 2 44c0 12 25 13 30 7 5-7 25 14 25 14h15l3-30-10-5v-49l17-19c20-7 13 44 13 49 2 19 10 17 18 13 17-7 3 19-10 17s-5 17-5 17l8 3-15 12-13 15-17-5-20-2-7-12-12-2-2 24-8 10-20 20c27 0-3 19-10 19 15 5-2 20-40 8v12l-13 2 12 13 13 2-5 29c0 22-55 7-60 2l-2 30-10 2 2 20-2 29 18-3v12l45 2 65-69 38-8c3-17 20 3 20 3 17-2 20 10 20 10l22 3c18 5 7 7 8 14 2 10 10 7 10 7l3-22 10 2-10-12-18-8-20-8c-13-19 3-15 17-13h22s25 34 25 42 12 10 12 10l15-2 5 12h15l5 10h30l2-15-28-5-2-17-20-5c-7-29 5-37 13-24l10 2-3-25 12-3-3-35-10-3v-12l42 2c-3-22 2-32 2-32h12l2 8 51 5 36-41c-2-3 4-5 0-9-5-5-12 0-20-5s0-34-2-40c-2-7 28-17 23-2s0 22 0 22c22-20 40 2 38 7s12 10 20 5 18 15 15 25-33 8-35-2-7-7-10-2-18 8-27 3c-2-1-2-2-3-3l-36 41h2c20 12 10 27 3 30s-18 3-18 3l-3 7-43 3-3 17c-22-3-30 20-25 32s0 22 0 22l18 8 23-7c3-17 18-20 32-30 13-10 35 19 28 32s-7 19-7 19l2 15-17 7-13 7-2 8h-45l-8 8-22 2-7 10-15 2s-25 12-15 25c10 14-42 12-53-7-3 17-22 2-22 2l-18-5-2-25c-3-17-35-17-33-5s-60 5-60 5l-20 10-18 11-2 8-30 3-13 7-5-10h-13l-13 19c-35 2-68 22-65 30s-13 17-13 17l-15 5-10 15-20 7-3 35-10 7v15l-12 3v8l-17 2 10 25 13 7c23 3 13 32 13 32l13 2 7 19 13 27c5 20 20 15 27 14 7-2 13 20 13 20l66 2s-3 7 8 10c12 3 88 7 91 2-3-15 42-19 60-5 18 13 43 5 43 5l25 30 17 37 28 8 20 5 7 29 15 2 5 19c18 13-5 42-5 42v37l13 7-2 14 22 22 25 2 63 67 50 15 8 27 13-2 10-8 40-2 20-19 22-3 185-157-17-10v-37c30-22 32-61 3-64-21-3-12-25 8-29l12-5v-15l38-35v-27l-83-69c-37-13 0-94 25-93 25 2-2-125-2-125l-13-7 3-41h-18l-30 39-8 27c-3 35-106 29-111 24s-40-20-40-20-27-22-32-15-28-8-28-3-22-12-22-12l-33-12 25-5-5-20 43 22c5 7 27 5 27 5l7 8s13-2 22 8c8 10 52 2 52 2l12 10 18 7 52 2 2-32 10-10-2-20 12-10v-17l10-3 2-37 8-2v-81l-25-24c-2 8-28 8-28 8s-7 12-12 12 7 15 3 25c-3 10-17 10-17 10l-25 7-7 8h-27l-3-22 30-8 17-8 8-17c2-17 22-15 22-15s38-32 40-47 15-57 38-57h43c17-7 12-29 12-29l22-3 3 12s30 3 33-2 10-17 18-12 35-12 35-12c2-12 43-7 43-7l5-15s-28-39-33-39-32-24-35-15c-27-7-25-44-25-44l-10-24c0-14-25-42-30-39-25-19-7-40 0-42s23-25 23-25l8-24 28-8 3-22-15-2s17-30 25-30 63 0 68-3 15-30 15-35 13-7 18-8c5-2 17-15 20-22 9-17-2-59-9-52zm461 539c-1-3-2-6-5-7-7-3-20 2-26 6l6 8c6-4 15-6 16-5v-1zm43 201-10-1c-1 8 1 18 9 19l2-10s-1-4-1-8zm37-40c3 10 6 20 6 21l9-4s-4-10-6-20zm22-8v-2c0-3-1-7-3-11l-9 5c1 2 1 5 2 7 0 3 1 6 3 8 2 1 4 2 7 1l-2-10c0 1 1 1 2 2zm-85 72c7-4 16-13 15 6s-9 13-15 19-10-19 0-25zm-401 130 1-15 16 2-1 14zm1 33c-2-9-12-12-13-12l-3 10c1 0 2 1 3 2l2 9c-1 1-2 2-2 3l7 7c5-8 7-13 6-19zm-1243 312-10 9-5 4 5 4 12 8 6-8-7-5 5-4zm118 121-4 9 10 5-3 4 7 7 13-13-6-4zm-459-2170 10 10-7 7-10-10zm302 315 10 8-6 8-10-8zm-38 7 2 19h25c10 0-8-12-8-12s-20 2-19-7zm548-470-17-2-1 10 14 1 11 17 8-6-11-18-2-2zm45-354-5 9 13 8 3 2 2-2 19-12-6-8-15 10zm89 48-8-9-7 8 15 15 3-3 17-14-7-8zm-552 351c-1-6 33-7 38-2s2 14 17 14 8 10 7 15c-2 5-18 3-20-2s-27-7-27-7-13-10-15-18zm191-19c26 8 35 2 37-5s3-8 13-10-2-22-12-20-20-3-22-12c-2-8-18-30-20-13s-12 17-10 29c3 11 8 29 14 31zm165-285c-4-15-25 19-3 25 22 7 43 0 43 0l5-10 83 2c7-7 10-17 10-17s20-7 28-3c8 3 2-24-7-20-8 3-25 2-25 2h-30c-2-12-28-7-30 0-1 6-11 8-11 8l-38 3c-4 10-23 17-25 10zm3 83-22-22v-19l-7-7-7-24-22-7-22 8-23 15-25 3-13 15 53 5 10 17 38 3 25 25c23 10 28 0 15-12zm77 162 7-16 9 5-7 15zm497-17c-3-13 33-25 42-15 8 10 32 12 35 62 1 18-30-19-30-19l-25-8c-14-3-21-11-22-20zm-175 44c-5 15-7 35-15 35s-5 22-5 22 22 0 28 2c7 2 7 19 7 19 25-2 35 32 32 41-3 8 10 8 10 8s0 27-3 34 22 12 28 22c7 10-3 44-8 46s13 7 12 15c-2 8 5 0 7 14 2 13 5 42 5 42l23 2c3-22 46-23 53-20 28 10 50 54 50 64s-18 12-18 12l3 49c28 8 52 49 48 56-3 7 20 5 20 5 3-30 32-20 33-10 2 10 7 32 7 32l8 15 12 12 18-2 5 10 22 3s18 20 20 25 27 3 33 5c7 2 17 7 18 15 2 8 12 22 12 22s20 5 22 12 10 22 10 22l17 14 2 15 18 2 5 20 30-2 17-12c22-12 37-27 38-34 2-7 5-32 22-27s5-37 5-37-23-17-22-25c2-8-23-25-22-32 2-7-22-20-20-27s-12-25-12-25l-25-24-3-15-20-2-40-49 2-14-12-2v-19l-12-7-18-2-37-40-3-19h-18l3-35c12-15 5-44 5-44s-23 12-35 7 5-17 5-17v-13l-10-10s-28 3-30-2-7-27-7-27l-2-29-12-5-2-10-18 2v-20l-10-3-10-5-2-20-37-2-12-17-13-20-42-3-10-10-17-3-12-5-5 8-32 2-2 10c-14 7-80 0-82 5zm-306-10c3 5 23 10 23 10 13 0 22 10 22 15s18 3 18 3l2-12-13-17-12-8s-18-2-18-7c0-4-19 11-22 16zm0 57-13-3v15l18 2zm185 186v-13s-2-13-10-13-23-10-20-17-28-14-28-14-28-27-18-24 5-12 5-12-20 3-25 2c-5-2-3-17-3-17s-20-5-20 0 7 5 10 15 2 27 17 30 18 7 20 14 20 8 20 8l13 7zm13 45c-2-7-5-30 5-29 10 2 3 0 15 5s13-8 13-8h18l23 19-3 15-17 2c-8-13-25-8-22 3 3 12-8 34-15 35-7 2-28 2-27-8 3-10 10-34 10-34zm274 230 12-37c-17-3-13-22-13-22-2-15-25-32-33-27s-5-35-5-35 15-10 22-5-57-84-70-76-43-8-42-24c2-15-60-66-60-66s-20-13-23-3-10 17 0 22 8-8 20 3c12 12 33 27 25 37s-18 14-18 14l12 14h18l3 29s20 10 25 22 5 19 0 25c-5 7-15 19-13 30 2 12 15 17 15 17l13 2 10 5v22c13-3 35 15 33 27s3 5 20 17 12 14 23 22c11 7 21 2 26-13zm-382 216c0 5-3 12 7 14s28-7 30 3 2 17 15 22 22 7 32 7 32-3 32-3 24 4 28 8c18 19 30 24 35 15 5-8-2-27-3-34-2-7-25-39-33-32s-10 0-25 5-47 2-48-5c-2-7-25-10-25-17s-17-15-15-5-12 15-15 12c-5-4-15 10-15 10zm-83 18-2 12 18 2s8 7 8 12 12 10 18 10c7 0 25-14 25-14s8-24 2-22c-7 2-20 12-22 2s-22-5-22-5zm-86 19 5-1 3 9-5 2zm6-16 10-2 3 15-9 2zm28 2 1 10 36-1v-10zm324-8 17-2 1 10-17 2zm44 37 5-12 9 4-5 12zm145-169 17-1 1 10-17 1zm28 10h10v8h-10zm30-142-10 1-2-15 10-1zm-10 210h10v12h-10zm22 6 9 4-5 11-9-5zm-49-133c10 0-3 39 23 35 27-3 2 12 22 13 20 2 15-15 22-27s3-19-8-22c-12-3-12-3-15-17-3-13-17-17-17-17l-5-20-22 13-22 29c0 24 12 13 22 13zm65 92c13-7 42-7 40-17s17-13 17-13l5 20 15 10 2 19s5-3-13 2-7 13-7 13l-40 2-5-17zm-215 141c8-2 28-3 32 2 3 5-12 12-12 12l-20 3c-6-8-8-15 0-17zm107-15c9 9-50 7-50 0s5-30 20-25 17-30 17-30-13 2-2-5c12-7 0-17-5-22s-10-14-10-14h23c10-7 13-39 13-39 20 7 30-7 30-7s3 10 10 19c7 8-17 12-8 17 8 5 12 20 8 25-3 5-22 2-22-5s-7 8 0 17c7 8-8 20-12 20-3 0-25 3-7 14 18 10 38 5 38 5s15-2 20 7c5 8-2 10-10 10s-48-3-48-3-10 11-5 16zm194-191c-5-7-10-12-17-15s-12-7-18-7c-7 0-13-7-10-15s-5-12-5-19 5-7 13-2 7 7 13 15c7 8 10 17 17 15s12 15 18 10c7-5 5 12 5 12zm-16 16c5 7 15 12 15 19s-3 12 7 13c10 2 17-2 20 7 3 8 3 22 2 29-2 7 2 17 10 17s10 2 10 7 10-19 10-19c-8-7-15-22-15-22s-8-24-8-27-12-7-17-8c-5-2-13-17-13-17zm108 273-7-15s0-13 3-20-7-13-12-15-3-15-5-22-13-12-13-12-3-25-3-30-15-12-10-17 8-12 13-15-5-27 3-22 8 14 12 20c3 7-2 30 7 35 8 5-2 22 12 22 13 0 5 32 5 32s-3 24 5 25c8 2 3 42 3 42zm5 129 5-10 9 5-5 10zm11-55 10 1-1 14-10-2zm-21-56-13-2-30 5-17 32s8 5 15 17 10 81-10 93 2 5 2 5l-3 37c5 17 13 8 18 0s10-10 17-19c7-8 17-24 18-35 2-12 10-30 5-35s5-29 5-29 7-14 0-27c-7-14 2-29 7-35zm-73-172h-25s8 3-15-19-38 5-38 5l-27 3v27l-13 5 2 17 18-2s0 20 5 12 47 2 43 22c-1 8 42 30 37 57 22 3 17 25 17 25l28 3 8-17 8 2v-10l-18-5-3-54-12-8 3-14-13-5 7-22zm-62 414 10-4-4-8-2-6-5 3-12 7-11-7-5 9 13 8 3 2 2-2 10-5zm44-22 18 3 2-10-18-3zm-34 216c-7-10 33-27 40-7s0 17-7 15c-6-2-23 5-33-8zm-172 325h12v32h-12zm77 309c-3 13-15 20-22 15s8 8 12 15c3 7 13 7 17 0 3-7 2-22 5-29 3-6-10-8-12-1zm37 68 15 7 2 29c20 20 85 3 85-2s-3-62-3-62l-8-8-2-42c7-22-32-54-35-47s-25 2-25 8c0 7-13 40-7 52 7 12-5 12-7 24-2 10-19 30-15 41zm-468-361-5-8-14 8 6 9zm-254 33c-8 8-6 15 0 21m52 20 11-19-9-3-12 8 5 5zm-10-527c7 15 5 37 30 54 8 6-5 17-13 12s-32-42-32-42v-22c5-13 12-8 15-2zm-88 88c4 15 3-24 10-22s2-24 2-24l-30 22c14 2 16 17 18 24zm-90 108c-2 20-27 27-27 27l-18-5-10-8-2-24 15-2 3 10zm-27-204v-24l-3-22-25-12-18 17-3 24v15l-17 3-3 46-13 5 2 17-36 10-3 22-13 8-7 20-8 49s15 29 23 15c8-13 22-15 22-15l5-12 45 2c3-19 25-12 25-3 0 8 17 2 17 2l12-19h18l2-20 8-5v-30c27-8 23-34 23-34l7-8-3-12c-13-5-7-17 2-14 8 3-12-15-12-15-10 8-18-10-18-10zm-76-69-13 3-30 29-2 13-8 12-10 25-35 2-7 30 5 26 30 12 3-17 10-5 2-17 7-12 10-12 3-13 17-10 20-4 8-10 3-20 2-15 7-11 20-8v-32h-10l-2-12-18-2-4 9h-8l-2 13h10l2 11-7 6zm-528 203c0 4-3 7-7 7s-7-3-7-7 3-7 7-7 7 3 7 7zm-1 193c0 4-3 7-7 7s-7-3-7-7 3-7 7-7 7 3 7 7zm-18-28c4 0 7-3 7-7s-3-7-7-7-7 3-7 7 3 7 7 7zm-20 40-14 2v12l14-2zm15-86-12 2-1 13 13 2zm-3-91 1-12-25 17-16-10v40l26 36 10-24 4-15-12-5 2-25zm-10-142-30-3 2 12h8c13 24 2 81 2 81s-20 2-23-8-12 22-5 27 30 0 32 19 15-12 15-12zm670-334h-18l-3-37 10-7v-19h-58l-2-19 8-5-13-5-10 13-3 15-17 3v8h-12v22l-47 39-93-3c-7 15-23-2-23-2-3-10-27 0-27 0 0 19-32-8-32-8l-58-42c-33-30-83 8-85 17 2 24-38 5-38 5s-33-10-38 3-27 10-27 10l-3 7-17 3-3 10-20 3 50-2c13-2-5 29-13 27l-23 2-8 8h-22l-10 14-32-2s-18 15-17 20c2 5-3 20-8 20s-15 15-12 20-10 22-10 22l-3 17-10 3v46l-20 14v20l-30 32 3 27-25 27 3 27-15 5-3 12-7 35 17 2c8-3 7 22 0 25s-25 10-15 17-27 5-27-5-20-19-25-15c-5 3-13-15-13-15-18-19-75 2-75 2l-8 27c-18 3-30 34-30 34-15 5-27 24-22 29s-8 7-8 7v37l-8 12 2 40c10 0 8 19 8 19-17 2-13 24-13 24l-35 12-7 10-43-2-12 12-12-12h-83l-3-8-17-3-2-19-25 2-5 10-27 2c2 17-27 42-30 35s-22-25-13-29c8-3 30-7 30-7v-12l-62-2-7 10-25 2v27l-12 3c-8 5 2 24 2 24 12 12-2 30-2 30-10 10 8 29 8 29 13 3-8 13-8 13 3 17 13 22 13 22-10 17 7 25 7 25l2 29 12 7v19l7 12h27l-2-42c-23-27 20-34 22-24s20 15 20 15c3 25 32 40 40 15s15-10 20 2 37 41 37 41h25l3 24c28-2 37 2 48 40 12 39 43 49 43 49l23-2c0-20 23 3 23 14 0 10 45 49 45 49l45 10 42 34 32-3h13c8-29 48 2 52 12 3 10 30 27 33 19s22-3 25 22 15 20 15 20l95-2 33-29 85-2c43-2 17-61 8-61-15-12 5-61 5-61l-121-113c-28 0-3-41-3-41 22-14-5-35-5-35 3-20-12-44-12-44-30-20-22-59-22-59v-27c-25-24 10-27 10-27 12-20-8-35-8-35l-2-22-27-3-3-79-60-86c-12-3-3-24-3-24 15-8-3-29-3-29l-2-37 35-3 8-13h17l-2-44c8-22 28-10 28-10l23 2 13-25 3-20-18-2c-20-12-10-56-10-56 32-47 68-20 68-20l23-2c35 24 3 67 3 67-7 10-3 42-3 42l8 54-22 19c-18 10-18 34 2 39 13 2 8 34-12 12-30 0 17 27 3 20 30 15 23-13 23-13l40-32c15-12 42 25 42 30s66 2 66 2c18 12 25 42 25 42 18-24 57-2 28 12 27 17 27 32 27 32 22-7 22 10 22 15s7-25 7-25c-25-19 33-25 17 8l-10 15 17 13 2 39c37-3 27-49 27-49l17-3c0-15 12-7 12-7-12-57 27-67 27-67 22-5 23-51 23-51-15-7-7-30 10-10s-10-41-10-41l-13-12-18-2-2-19h-30l-5 24-11 5-3-7-5 19h-30l-2-20 18-5 7-10 5-27h22l28-8c2-29 17-22 17-22l25 20 2 10-10 5-2 14 5 19h13c5-27 40-27 50-10l10-24c-23-12 0-30 6-22 7 8 22-22 22-22s12 15 0-5 8-30 8-30c-3-20 22-17 22-17l2-27-23-2c-5 24-25 3-15-2s20-15 20-15v-17l10-3 2-17h25l22-10 5-8 23-2 33-30-3-13c-20 0 0-15 0-15zm-903 1517-13-20 20 3 21 18 9 22-12 7-7-10-16-5zm-367-506 8 23 12 9 11 25-6 12-19-17-13-19-7-15-11-30zm-100-90h-8v17h13v22h10l-2-25-13-5zm1308-1028 10-2 2 10-10 2zm12-6 3-10 13 4-2 10zm24-10 1-10-11-2-2 10zm17-22h13v10h-13zm85 12 1-10 12 1-2 10zm33 7 1-10-12-2-1 10zm12 1h13v10h-13zm15 17v12l10-1v-12z"/>
</g>
</svg>
\$\endgroup\$
-1
\$\begingroup\$

Use STDIN to create a triangle of increasing width

This challenge is relatively simple: given an integer from STDIN, output a right triangle with the width being equal to the integer given. For example, if the integer 7 was given, the output would be as follows:

*
**
***
****
*****
******
*******

And if the integer 3 was given, it would be:

*
**
***

This is code golf, so lowest byte count wins!

[THE FOLLOWING TEXT WILL NOT BE INCLUDED IN THE QUESTION]

Hello! This is my first question asked on this website, and I apologize if it's a duplicate, I tried searching for terms that would make a question like this appear but I may not have searched hard enough. If you have any recommendations or clarifications I should add to my question, please let me know. Thank you!

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Thanks for posting your question to the sandbox first. Exactly the same challenge exists already: codegolf.stackexchange.com/q/95780/101276 \$\endgroup\$ Commented Mar 4 at 6:12
  • 1
    \$\begingroup\$ While obviously this won't be applied to this question since it's already a dupe, do note that in the future you should just fall back to the default I/O methods for your question unless its nature specifically demands one format \$\endgroup\$ Commented Mar 4 at 6:46
  • \$\begingroup\$ Thank you both for the clarification! \$\endgroup\$ Commented Mar 4 at 14:08
-1
\$\begingroup\$

Is it fsed and/or fsed?

Meta

ok fsed s/foo/bar/
ok fsed s/foo/bar/ file
ok fsed s/foo/bar/ s/foo/bar/
ok fsed s/foo/bar/ -
no fsed s/foo/bar/ -i
no fsed s/foo/bar/ -j
ok fsed s/foo/bar/ -e s/foo/bar/
ok fsed s/foo/bar/ -e s/foo/bar/ s/foo/bar/
ok fsed s/foo/bar/ -e s/foo/bar/ s/foo/bar/ file
\$\endgroup\$
1
  • 1
    \$\begingroup\$ No idea what this is asking. \$\endgroup\$ Commented Apr 12 at 12:10
-2
\$\begingroup\$

Underhand Bejewled

Help me to write a game of bejewled, which cannot be lost!

Bejewled game rules

If you ever played bejewled, you can skip this, but for those who did not see it ever:

  • Playing field of 8*8 grid is filled in with gems of 7 different types randomly
  • By swapping two adjective stones, your goal is to create a line of at least three same type of stones in the either vertical or horizontal line
  • If did so, the gems will dissappear, points are added (say 20 points for a matching) and new gems are provided randomly from the top
  • image related:

enter image description here

Your challenge

Provide me a game which cannot be lost. In other words, the gems falling from the top are not random at all, but are falling in order that there is always at least one possibility to match three gems

But, from looking at the code at level of newbie programmer, it should look like that game acts as if it was random

Output

Playable game. As long as it is the grid of 8*8 filled in with 7 different types of "gems" the game is ok. It does not to have killer graphics, neither it does not need to be playable by mouse. (But in that case please make sure you show which "gem" is hovered and then selected)

Winning criteria

This is popularity contest. So highest rated game wins

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think this is too big a task to work well for an underhanded contest. The programs will be way too large for anyone to actually read the source and try to find what's underhanded about it. \$\endgroup\$ Commented Nov 11, 2014 at 8:32
  • \$\begingroup\$ Thats what I was also afraid of. I will either take it as lesson to progress on my programming skill, or abandon the idea completly \$\endgroup\$ Commented Nov 11, 2014 at 8:38
-2
\$\begingroup\$

Create a Drawing Guide for a Polygram

Poor old Jim, he's just terrible at drawing polygrams, and he's asked you to create a "drawing guide" for him - an ascii polygram with numbered edges, so he can follow the instructions.

Challenge

Write a program to produce an ascii polygram with P <= 10; each edge of the polygram should be made of a single digit 0-9, showing the order in which the edges should be drawn.

Input

Your program should receive (via STDIN, as function arguments, or some other language-appropriate method): P, the number of edges/vertices of the polygram, and Q, the spacing. In the notation as per the Wikipedia link, you'll be drawing a {p/q} polygram.

Output

Either print to STDOUT or return (or something else language-appropriate) a multiline string showing the drawing guide for the given polygram. The string can be any size you like, as long as it's large enough to display a clear polygram.

Notes

Your code should be able to handle compound regular polygons as well as regular regular polygons, and also inputs of q > p/2 (poor old Jim doesn't realize that the polygram for {p/q} is the same as for {p/p-q}).

Example Output for {10,3}

              5              
             5 4             
                4            
     21     5        888     
     2 11115     8888  7     
     2    5111888 4    7     
     2     888111  4   7     
     2  888      111   7     
     8885           4117     
  8882               4 711   
 8   2 5               7  111
     25               47     
 9   5                 7    0
  9  2                 74  0 
    52                 7  0  
   9 2                 7 4   
  5 92                 7 04  
     9                 70  4 
 5   2                 7     
5    29                7    4
6666 2 9              07   33
    666              0 7333  
     2 696           337     
     2   9666     333  7     
     2    9  66633 0   7     
     2      333 666    7     
     2   339       666 7     
     2333   9    0    67     
             9  0            
               0 

Scoring

This is code-golf, so shortest in bytes wins. Tiebreaker goes to the most votes.

\$\endgroup\$
2
  • \$\begingroup\$ I have a python solution to this which is ~600 bytes, so it's definitely doable, and it's not easy... \$\endgroup\$ Commented Apr 27, 2015 at 4:31
  • 5
    \$\begingroup\$ I think the spec needs to be more prescriptive for this to make a good question, especially since the example seems to indicate that you're not currently even prohibiting the lines from having gaps. At a minimum I would say that you should require the lines to be equivalent to those produced by Bresenham's algorithm, and specify how overlaps should be handled; at the extreme, you could tie it down so tightly that it becomes a parameterised kolmogorov-complexity. \$\endgroup\$ Commented Apr 27, 2015 at 9:34
-2
\$\begingroup\$

Pointer to pointers to pointers to pointers

You should choose a language supporting pointers like C. And your task is simple: demonstrate a legitimate use of the most level of pointers.

You should justify your code by describing an algorithm that:

  • Has only plain text, number or an array of those as input and output.
  • You think it will make things easier to write those code as a part of the implementation of this algorithm.
  • This implementation would have optimum memory usage (only declared variables and parameters, explicitly allocated space, and the return addresses for recursive functions count).

Other rules:

  • They must be pointers to pointers directly, i.e. a pointer to an object containing a pointer doesn't count. It's better if nobody using this code will want to extend some pointer to an object later.
  • Each pointer must have a different type (if your language can somehow make them the same type).
  • You should create at least one pointer, and either dereference or compare two non-null pointers once in each level.
  • Using pointers as arrays is only half as interesting.
  • Iterators, etc, are considered in essence pointers and allowed in this challenge. But you can't define new types implementing iterators for this purpose.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Could you specify "legitimate"? This sounds a bit like code bowling (and seems to have the same issues). With enough imagination I'm sure I can justify any depth of pointers. \$\endgroup\$ Commented Apr 30, 2015 at 17:43
  • \$\begingroup\$ @MartinBüttner Edited but, basically, it is subjective. \$\endgroup\$ Commented Apr 30, 2015 at 17:57
  • \$\begingroup\$ @MartinBüttner Added a restriction to have optimum memory usage. I'm not sure whether it works. \$\endgroup\$ Commented Apr 30, 2015 at 18:19
-2
\$\begingroup\$

Winning Tic-Tac-Toe lines

For a given tic-tac-toe board of size N**D (for example, a normal tic-tac-toe game is 3**2), the number of winning lines of length N is given by the expression:

$$ 2^{D-1} + \sum_{S=1}^{D-1}2^{S-1}DN^{D-S} $$

(Basically, you are summing the number of lines in each S-dimensional slice of the board.)

The challenge:

Given N and D, your answer should output a list of D-dimensional coordinates for each winning line. Input and output are any reasonable format. You can assume that both N and D are positive integers, with N > 1. (Degenerate cases of N=1, D>1 not included.)

Since this is , fastest answer wins. Please explain your algorithm!

\$\endgroup\$
7
  • \$\begingroup\$ How do you intend to determine which of two answers is fastest? \$\endgroup\$ Commented May 12, 2015 at 19:37
  • \$\begingroup\$ yes, @randomra made the same point on chat. i'll edit this in, but i guess... i'll put together some test cases and then time them? i dunno, i was going back and forth between this and code-golf, but i'd prefer interesting and readable algorithms. \$\endgroup\$ Commented May 12, 2015 at 20:10
  • \$\begingroup\$ i posted this here because i really want the answer, and i hate coming up with brute force solutions... :D \$\endgroup\$ Commented May 12, 2015 at 20:16
  • 2
    \$\begingroup\$ Um. Given that you're asking people to enumerate an exponentially large set, in what sense will the answers not be brute force? \$\endgroup\$ Commented May 12, 2015 at 20:28
  • \$\begingroup\$ well, there's brute force and then there's brute force. but really it's because i don't want to do it myself, haha. \$\endgroup\$ Commented May 12, 2015 at 20:34
  • \$\begingroup\$ also, making use of symmetry can severely reduce the computation. \$\endgroup\$ Commented May 12, 2015 at 20:40
  • 1
    \$\begingroup\$ I imagine that the runtime in any such algorithm will be basically proportional to the number of things you print, so there won't be any good way to improve by algorithm and the speed will be very platform-dependent. \$\endgroup\$ Commented May 12, 2015 at 23:40
-2
\$\begingroup\$

Ayn Random number generator


Inspired by xkcd 1277:

enter image description here

Write a random number generator that takes no input and generates a random integer between 1 and 100. When run less than 200 times, the frequency of all numbers needs to be between 0 and 2, but when it's ran 50 000 times, the number 42 (obviously) should have a frequence that's more than 4 standard deviations higher than the mean.

Format is code-golf. Your score is the bytecount of your code.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ 1. I think it's difficult to decide objectively whether a PRNG appears to be fair at first sight. 2. The term more often should probably be quantified. \$\endgroup\$ Commented May 18, 2015 at 21:49
  • \$\begingroup\$ I see lots of C rand()%1000 and the like incoming... \$\endgroup\$ Commented May 18, 2015 at 22:05
  • \$\begingroup\$ @Ypnypn I have changed the criteria to have much lower numbers so they're easier to verify. \$\endgroup\$ Commented Jun 6, 2015 at 13:04
  • 1
    \$\begingroup\$ @Dennis I have rewritten the question to clarify what "being fair" is and what "more often" actually entails. \$\endgroup\$ Commented Jun 6, 2015 at 13:05
  • 1
    \$\begingroup\$ 1. Are you thinking of a standalone program that you run multiple times or a function that is allowed to keep a state? In the first case, not even a perfect RNG will, with overwhelming probability, satisfy the first condition. 2. Do you mean the mean and standard deviation of a perfect, uniform RNG or the one the code implements? \$\endgroup\$ Commented Jun 6, 2015 at 23:44
  • \$\begingroup\$ @Dennis I'm thinking of just a function AynRandom() that gets called. The frequency of numbers with a small number of iterations is subject to change, maybe from 0 to 4. The mean and Standard Deviation must be the one the code implements. \$\endgroup\$ Commented Jun 7, 2015 at 9:49
  • \$\begingroup\$ between 0 and 2 ? so print 42 would be a valid program ? \$\endgroup\$ Commented Jun 11, 2015 at 15:32
  • \$\begingroup\$ @Falco No, because 42 would appear more than 2 times (unless you only run it twice). The problem is that I need a way to indicate that the RNG is fair with a low iteration count, but unfair with higher iteration counts. The only way I can make it work is by stating that with low iteration counts, all numbers should appear about equally often, which is either 0, 1 or 2 times. \$\endgroup\$ Commented Jun 11, 2015 at 15:36
-2
\$\begingroup\$

Please nitpick this. If there's anything that wouldn't work or would be inconvenient, however small of an issue it is, tell me about it!
Also, suggestions for [adjective] are more than welcome.


Determine how [adjective] a number is ()

A number would be considered [adjective] if 0 is the result of multiplying its digits together, then multiplying the digits of the resulting number, then repeating until a single-digit number is produced. The more steps it takes to reach 0, the more [adjective] the number is; if the resulting number is not 0, though, the number is not [adjective] regardless of how long it took to finish.
The formula used to determine [adjective]-ness is 10-10/T where T is however many numbers it took to reach 0 (including 0 and the initial input)

Your goal is, as the title says, to write a program or function that determines how [adjective] a number is, and prints every iteration along the way. Here are some example inputs/ouputs:

in: 879
out: 879    <-       (T=1)
     504    <- 8*7*9 (T=2)
     0      <- 5*0*4 (T=3)
            <- optional newline
     6.6... <- 10-10/3 (repeating decimals can be expressed in any way you want)

in: 2468
out: 2468   <-  T=1
     96     <- (T=2) 2*4*6*8
     54     <- (T=3) 9*6
     20     <- (T=4) 5*4
     0      <- (T=5) 2*0

     8      <- 10-10/5

in: -888
out: -888  
     -512   <- -8*-8*-8
     -10    <- -5*-1*-2
     0      <- -1*0

     6.6... <- 10-10/3

in: 1344
out: 1344
     48
     32
     6

     0    <- did not produce 0, so the prog/func returns 0

Your program must follow these rules:

-Takes input from STDIN.
-Throws an "error" (printed to STDOUT) and halts immediately after input if the input has one or more 0s in it or if it's less than three digits in length. The error must be a string, and as it's supposed to be printed to stdout, cannot be one generated by the language itself (eg 1/int(min(input())) to check if it's zero). Lastly, the error message has to clearly define what the error is; ERR:0 and ERR:LEN, for example, would suffice.

Bonuses/Penalties:

-25 if it properly handles decimals. For instance, an input of 99.22 would first turn into 9*9 + 0.(2*2), or 9*9 + 0.4, and so on.


This is , so the shortest answer in bytes wins.

\$\endgroup\$
7
  • 4
    \$\begingroup\$ I don't like the +15 penalty. Whether strings are used is vague in some languages. The constant amount +15 is too little deterrent for some languages but huge for very concise ones. The fact that you've found a short solution you don't like is sign you should rethink the problem, not try to plug the hole. \$\endgroup\$ Commented Jun 17, 2015 at 7:48
  • \$\begingroup\$ @xnor that's reasonable. I suppose it is a valid way of doing it, anyway, so I removed all mention of strings in that section. Should I also inc/decrease the bonus for decimals? \$\endgroup\$ Commented Jun 17, 2015 at 22:29
  • \$\begingroup\$ The programming languages I know either don't allow throwing user-defined errors or print them to STDERR. Now, if you just want us to print a message and exit immediately... \$\endgroup\$ Commented Jun 17, 2015 at 23:32
  • \$\begingroup\$ ...and should be printed to STDOUT. I had a feeling that wasn't clear; I edited it, is it better now? \$\endgroup\$ Commented Jun 17, 2015 at 23:33
  • \$\begingroup\$ It's the word throw that throws me off (no pun intended). To throw an error usually means something rather specific. Print an error message to STDOUT (or closest alternative) would be less confusing in my opinion. Also, since this is code golf, I think you should require specific error messages. There's no fun in losing a contest because you chose ERR:LEN and somebody else got away with EL. \$\endgroup\$ Commented Jun 18, 2015 at 3:16
  • 5
    \$\begingroup\$ Remove bonuses altogether. It's in the list of things to avoid. \$\endgroup\$ Commented Mar 1, 2016 at 21:31
  • \$\begingroup\$ The error if the input contains a zero seems like a separate challenge. It may be better received if there is only one challenge. There is community support for avoiding Chameleon challenges. \$\endgroup\$ Commented Aug 10, 2016 at 11:40
-2
\$\begingroup\$

Wrong tool for the task

Task

Write two full programs in the same programming language that solve the following two tasks:

  1. Read two positive integers from STDIN and print their sum to STDOUT.

  2. Read two positive integers from STDIN and print their product to STDOUT.

Additional details:

  • Given enough time and memory, your programs has to support arbitrarily large integers.

  • All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed.

Scoring

The first task is code golf, so your objective is to make your program as short as possible.

The second task is code bowling, so your objective is to make your program as long as possible.

Your score is defined as follows:

score formula

The highest score wins!

Robbing a language

There's a catch! Only the submission with the shortest program in a particular language will be considered valid for task 2, so there can only be one valid answer per language.

This means that you cannot deliberately write a huge program for task 2; you actually have to pick the "wrong tool" for the task.

Additional details:

  • Task 1 exists merely to provide the proper denominator for the score (and robbers have no moral anyway), so byte-per-byte copies of somebody's program for task 1 are allowed.

  • If two answers use the same language and have programs of the same length for task 2, the answer that achieved that length first will be considered valid.

  • If somebody invalidated your answer, you may attempt to golf your answer to revalidate yours and invalidate his.

\$\endgroup\$
8
  • \$\begingroup\$ I suspect this will come down to people writing code in unary and disagreeing on what input/outputs formats are valid for such a language. \$\endgroup\$ Commented Jul 20, 2015 at 20:17
  • \$\begingroup\$ @xnor I'm not sure I understood your comment. The format for I/O is purposedly restrictive, so an answer's validity should be clear-cut. \$\endgroup\$ Commented Jul 20, 2015 at 20:25
  • \$\begingroup\$ @feersum I think the log scoring does benefits unary. Say (making up numbers) task 1 takes 100 chars of BF and task2 takes 150 chars. Then, those are translated to 300 chars and 450 chars of binary, and so 2^(300) and 2^(450) chars of unary, giving a score of 1.5. In comparison, if the tasks take 20 chars and 50 chars in another language, that's about a score of 1.3. I guess this is surmountable though (20 and 100 gives 1.5). \$\endgroup\$ Commented Jul 20, 2015 at 20:33
  • \$\begingroup\$ Are the inputs decimal numbers? For a language like BF, can the numbers be taken as byte values rather than characters? What separator should be used between the numbers? Are leading zeroes OK in the output? I think you'll have to be pedantic and precise about everything given how much of the character count may depend on details, but it's doable. \$\endgroup\$ Commented Jul 20, 2015 at 20:35
  • \$\begingroup\$ Yeah that's right, it is only for Unary. \$\endgroup\$ Commented Jul 20, 2015 at 20:37
  • \$\begingroup\$ @xnor All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed. \$\endgroup\$ Commented Jul 20, 2015 at 20:42
  • \$\begingroup\$ @Dennis Wow, you anticipated everything and I missed it. I take it then that input must be as a string of numerical characters? Also, do I understand right that you have to print a newline for output (say, print a+b,"\n" in Python)?. \$\endgroup\$ Commented Jul 20, 2015 at 20:45
  • \$\begingroup\$ @xnor Yes to both. The newline is required and you have to use numerical characters. I'd specify the exact character range, but I don't want to exclude non-ASCII languages.I'll think of a way to make it clearer. \$\endgroup\$ Commented Jul 20, 2015 at 20:51
-2
\$\begingroup\$

GitHub Gist command-line client

Create a command-line tool that publishes a list of files as one public GitHub Gist.

Specification

The following bullet points describe the behavior of the program. If a bullet point has "must", you must implement that point. If a bullet point has "can optionally" or "should optionally" you can implement that point on your own volition.

  1. It must be a complete command-line program.
  2. It must use the GitHub Gists API.
  3. It must post an anonymous Gist (that is, not as a GitHub user).
  4. Gisted files must use the filename provided on the command-line.
  5. The command-line must accept multiple positional arguments.
  6. If no arguments are specified, it must print this usage to STDOUT: gist: usage: <file> [file...] verbatim then exit with code 0.
  7. If something else goes wrong, it must print this message to STDERR: gist: unable to gist =( verbatim then exit with code 1.
  8. If everything is successful it must print the Gist's HTML URL to STDOUT.
  9. It can optionally accept a flag for description -d <description. floor(score * .9)
  10. It can optionally accept a flag for private gisting -p. floor(score * .9)
  11. In the case that a description flag is not used or implemented it must set the description to an empty string.

Example Input/Output

The number before the prompt is the exit code of the previous command.

0 $ gist
gist: usage: <file> [file...]
0 $ gist no-such-file.txt
gist: unable to gist =(
1 $ gist hello.txt
https://gist.github.com/anonymous/1e645596ce7bceeb1ec9
0 $

Scoring

This is a so shortest answer wins. As stated above, the following multipliers are in effect:

  • (9): score = floor(score * .9)
  • (10): score = floor(score * .9)
  • Both (9) & (10): score = floor(floor(score * .9) *.9)
\$\endgroup\$
8
  • \$\begingroup\$ What's up with the Example Input/Output code snippet? The editor's preview displays it correctly. \$\endgroup\$ Commented Jul 27, 2015 at 20:17
  • 2
    \$\begingroup\$ For the usage, should those literal strings be used regardless of the name and invocation of the program, or should it substitute the correct invocation for the leading gist? I'm thinking particularly of cases like Java, which doesn't support hashbangs. \$\endgroup\$ Commented Jul 27, 2015 at 20:32
  • \$\begingroup\$ Literal string, I think. \$\endgroup\$ Commented Jul 27, 2015 at 20:34
  • \$\begingroup\$ That's a good point about Java. I think I'll remove the item about shebangs since it's unfair. \$\endgroup\$ Commented Jul 27, 2015 at 20:41
  • \$\begingroup\$ If both bonuses are done, is it floor(score * .9 * .9), or floor(floor(score * .9) * .9)? \$\endgroup\$ Commented Jul 27, 2015 at 23:48
  • \$\begingroup\$ Also, if the bonuses are done, do we have to make the usage string reflect that, or just print it verbatim? \$\endgroup\$ Commented Jul 27, 2015 at 23:50
  • \$\begingroup\$ Output strings verbatim. And floor(floor(score * .9) * .9) for both. I'll update the question momentarily. \$\endgroup\$ Commented Jul 28, 2015 at 2:07
  • \$\begingroup\$ I'm curious why this challenge is being downvoted. \$\endgroup\$ Commented Jul 28, 2015 at 2:28
-2
\$\begingroup\$

Golf these arrays

Your task is to output these 128 arrays: http://pastebin.com/UeBMJfv7

Gzip base64: (too long, will be added if I'll post this question).

Rules

  • You don't have to output them all. And you can output the arrays in any order. But the order of items in the arrays must be kept as is.
  • You can print other arrays, which wouldn't be counted towards your score. The number of arrays you print must be no more than 10,000, and the total number of arrays, subarrays and numbers must be no more than 10,000,000.
  • You can use any convenient format to represent the arrays (and the list of outputted arrays).

Scoring

If your program or function has n bytes, and it printed k distinct arrays from the above list, your score would be n*(128/k)2. Lowest score wins.


Problems

It looks too boring.

\$\endgroup\$
1
  • \$\begingroup\$ It also looks too broad. \$\endgroup\$ Commented Aug 8, 2015 at 7:55
-2
\$\begingroup\$

The Perfect Keyboard

Back in the 1970s, keyboard designers respected the needs of programmers and languages. For example, see the IBM 2741 keyboard, designed for APL (from Wikipedia):
enter image description here

Today, sadly, most code golfers are forced to struggle with standard keyboards, which are badly suited to the needs of their language. This has to change!

The challenge

  1. Choose a programming language.
  2. Design a keyboard, which would best suit the needs of a developer (or specifically a code golfer) in said language.
  3. Post the keyboard layout as an answer.
  4. Explain how your keyboard enhances the programming experience.
  5. Start counting votes for 7 days, until I acceopt the winning answer (the answer with most votes).
  6. Optional - if you are the winner, start a Kickstarter project to build the thing.

Expected Answers

This section is, of course, for the sandbox only.

I don't really expect a keyboard design which would actually improve functionality of programs in an actual serious language. I'd expect fun answers, where the keyboard design highlights soemthing fun/interesting/absurd about the language. But my expectations don't matter so much, because it's not me rating the answers, but the other users.

Example (not very good ones):

  1. A Brainfuck keyboard with only 4 keys.
  2. A Lisp keyboard where half the keys are parentheses.
  3. A Piet keyboard - I'm sure someone will come up with something nice.

\$\endgroup\$
13
  • 6
    \$\begingroup\$ I'm note sure if it's a valid challenge since there is no programming actually involved in answering this \$\endgroup\$ Commented Sep 3, 2015 at 9:28
  • \$\begingroup\$ @Fatalize, You're right, but it is a programming-related challenge. It requires knowledge of programming languages and people may find it interesting or amusing. I may be pushing the boundaries, I don't know. \$\endgroup\$ Commented Sep 3, 2015 at 9:45
  • 2
    \$\begingroup\$ I would personally be ok with that challenge but I don't know if other, more prominent users would find this challenge off-topic. \$\endgroup\$ Commented Sep 3, 2015 at 9:48
  • 2
    \$\begingroup\$ Judging from this Meta post, there seems to be a fairly clear consensus that a question must involve programming to be on topic, not merely be programming related. So this question is fairly clearly not valid. \$\endgroup\$ Commented Sep 3, 2015 at 10:08
  • \$\begingroup\$ You could always include programming the driver or some kind of special interface for the keyboard \$\endgroup\$ Commented Sep 3, 2015 at 10:28
  • \$\begingroup\$ @BetaDecay, This challenge is about crazy creative answers. Requiring a driver implementation seems to me like a way to kill this creativity. \$\endgroup\$ Commented Sep 3, 2015 at 11:01
  • \$\begingroup\$ @isaacg, trichoplax writes "I judge it by whether the answers to it demonstrate skill and determination, or just aesthetic style" - I think a good answer to this challenge requires undestdanding a language and designing something that relates to its properties. Does it qualify as "skill and determination"? I can't say I'm sure. \$\endgroup\$ Commented Sep 3, 2015 at 11:06
  • 1
    \$\begingroup\$ The art/programming debate was specifically about popcon questions where the answers were programs. There's no doubt whatsoever that a popcon where the answers are just images would be an art question rather than a programming question. On the same basis, this is not a programming question, and does not belong on this site. \$\endgroup\$ Commented Sep 4, 2015 at 13:58
  • \$\begingroup\$ @PeterTaylor - I don't think it's an art question. The challenge isn't to get a pretty picture of a keyboard, but to design something that suits the language in an interesting way. But I posted it here to get the communities opinion, and it seems quite clear what it is. \$\endgroup\$ Commented Sep 5, 2015 at 19:00
  • \$\begingroup\$ Since I wrote that meta answer the rules on popularity contests have been tightened up, and I think that is a good thing. I stand by my answer, but I think it is right that popularity contests be judged strictly, to reflect the fact that it is very difficult to write one that is a good fit for the site. \$\endgroup\$ Commented Sep 4, 2016 at 11:56
  • \$\begingroup\$ Although it's possible someone will come up with an ingenious approach to designing a keyboard, the challenge itself seems to lean towards "make me laugh" rather than "impress me". This is why I don't think this is a good fit for the site. \$\endgroup\$ Commented Sep 4, 2016 at 12:03
  • \$\begingroup\$ I'd love to see what keyboards the community comes up with, but I think it would need to be hosted somewhere other than main. For things which are appealing to the PPCG community, but not quite a fit for main, there's Code Golf Chat. People often post "mini challenges" which aren't well specified enough to be challenges on main, but can end up inspiring people to write a full challenge. \$\endgroup\$ Commented Sep 4, 2016 at 12:06
  • \$\begingroup\$ I think it's important to keep testing the boundaries of existing winning criteria, and to try to come up with new ones. The people who put the effort into this will have a long run of rejections, but I really hope these don't come across as "don't try". \$\endgroup\$ Commented Sep 4, 2016 at 12:19
-2
\$\begingroup\$

This and this gave me an idea, but I'm not quite sure if this can be done at all, or if it is trivial. If it is, maybe point out how it could be changed to be interesting.

Anti golfing - Write the longest program not repeating any character

Well, it's just what the title says. Finally you're allowed to use as much bytes as possible.

Conditions

  • The code of the program or function should not use any character that is used in the code before.

  • Your program should print some sort of result to stdout, or into a file or return a value. You're not allowed to output or return the empty string or only a newline.

  • Other than that your program might do anything. Read input, print lots of output, or what you can think of, but you have to explain what it does, of course.

  • Only characters in the ASCII range [32 .. 126] and newlines are allowed, which limits the maximal code length to 96 bytes.

  • Variable names are only allowed to consist of a single character

  • String literals or the like are forbidden. They could be used to hold the unused characters (though they would need two " in most languages anyway).

  • The same rule applies for similar literal constructs like blocks or what else is there in some languages.

  • Even if the length of a string literal would be used to generate a number, it is forbidden.

  • Variables can not just be declared and never be used. They have to be reflected in the output somehow.

  • If you've read and understood the above rules and still found a loophole and used it, you should go and stand in the corner for a while, thinking about what you've done.

So all in all, only use characters for actual code that does something generating the output, might it be calculating a value or formatting. And don't put unused characters somewhere in your code as a literal. Numbers are an exception, but I guess it's no problem to use them anyway.

I guess you should have a pretty good idea of what would be considered cheating here.

Example in awk

BEGIN{gsub(a,9);print $j-13+d^c/4*5678%20}

It prints 15.5, score is 42.

It replaces the empty string a with 9 in $0, which is the empty string in the beginning. So $0 becomes 9.

Then it prints the result of 9-13+1/4*5678%20.

($j is $0 (==9), because j is not defined

d^c ist 1, because c and d are not defined)

Please don't invent languages for this ;)

The longest code in bytes wins.

\$\endgroup\$
10
  • 1
    \$\begingroup\$ Are you sure you want to allow ASCII 127? That's the unprintable<DEL> character. The main problem with this challenge is "only use characters for actual code that does something". This is essentially unenforceable, because there may be arbitrarily complicated no-ops in the code. It's also why most code-bowling challenges fail to be popular/interesting. \$\endgroup\$ Commented Sep 14, 2015 at 7:32
  • \$\begingroup\$ Well, I thought about making it a "most votes win" challenge, but I guess that would be unfair for less known users. I don't know what could be done with what you are pointing out. \$\endgroup\$ Commented Sep 14, 2015 at 7:51
  • 2
    \$\begingroup\$ I don't think this is a good candidate for a popularity contest. Popularity contests shouldn't be used as a cop out if the actual spec is a bit vague. They work best for challenges where the actual scoring criterion can be well specified but is more easily judged by humans than machines (e.g. "visually approximate a given image with these constraints..."). \$\endgroup\$ Commented Sep 14, 2015 at 7:54
  • \$\begingroup\$ Yeah, it's hard to formulate the rules for this. But I think it's not always about finding a winner anyway. Thought this might be fun. Resolved the character 127 situation btw.. \$\endgroup\$ Commented Sep 14, 2015 at 7:57
  • \$\begingroup\$ How could I change that rule? I'm thinking about "only use code that contributes to the generation of the output" \$\endgroup\$ Commented Sep 14, 2015 at 8:02
  • 2
    \$\begingroup\$ How do you define "contribute"? E.g. this GolfScript program prints the length of the block in {...} which is a convenient way to stuff all characters except in '"# in there. Do all those random characters actually contribute? In Slashes everything which isn't an unescaped slash is printed to STDOUT, so as long as I put \/ together, I can put any characters I want there and they'll all contribute. \$\endgroup\$ Commented Sep 14, 2015 at 8:07
  • \$\begingroup\$ Hmm, I thought this would be covered by forbidding string literals.. might think about extending that rule to blocks. Well, I'm not that fluent at esolangs. \$\endgroup\$ Commented Sep 14, 2015 at 8:10
  • \$\begingroup\$ It's trivial to use all possible 96 bytes. Trust me. If you really want to see the program I'm thinking of, I suppose I could write it, but I'm pretty sure it can be done. \$\endgroup\$ Commented Sep 16, 2015 at 18:34
  • \$\begingroup\$ Yeah, I guess you're right. i have no idea how it would be done, but alright. \$\endgroup\$ Commented Sep 16, 2015 at 20:10
  • \$\begingroup\$ Not to mention this is pretty much a duplicate of codegolf.stackexchange.com/questions/30159/… \$\endgroup\$ Commented Aug 6, 2017 at 12:52
-2
\$\begingroup\$

Technologic - Now what's THAT command do??

Daft Punk's song "Technologic" is all about actions that a user or computer does when it's working and being used. You goal is to write a program that has one command we will call the Technologic Command. This command will executes all of the actions like "buy it", "lock it", "code it", and "write it" in the order the lyrics are written on 'it'. What 'it' is is up to you, but you gotta let me know.

Rules

  • Any language can be used.
  • The song refers to an 'it'. That can be a block a memory, algorithm, function, file, or anything else a computer can manipulate directly or indirectly.
  • You must specify what 'it' is you will be performing these actions on. If you don't, you can only earn a maximum of 160 points.
  • Points will be deducted otherwise if a command is not used.
  • I'm not aware of any 'buy' command, method, function, subroutine or instruction so use a thesaurus and find the closest word you can actually program. I don't expect the program to actually buy or snap anything. Other words like mail and fax are possible, but not recommended.
  • If you have to use a synonym, you are not allowed to use that command again
  • Encompassing multiple objects into one artifact does not count. For example, taking the command "name it" literally means you won't be able to name an array of bytes, but you can name a file. Creating an object that holds both a file and an array of bytes is not allowed. That would make this too easy to get the maximum amount of points.

Scoring

  • There are 16 commands with a total possible score of 190 points.
  • 10 points for executing a command on the specified 'it' of your choosing (160 total)
  • 2 points for executing each command consecutively that references your 'it' (30 total)
  • 5 points for executing a command on something other than your 'it'
  • -3 points for every command skipped.

Command List

lyrics

Buy it, use it, break it, fix it,
Trash it, change it, mail - upgrade it,
Charge it, point it, zoom it, press it,
Snap it, work it, quick - erase it,
Write it, cut it, paste it, save it,
Load it, check it, quick - rewrite it,
Plug it, play it, burn it, rip it,
Drag and drop it, zip - unzip it,
Lock it, fill it, call it, find it,
View it, code it, jam - unlock it,
Surf it, scroll it, pause it, click it,
Cross it, crack it, switch - update it,
Name it, rate it, tune it, print it,
Scan it, send it, fax - rename it,
Touch it, bring it, pay it, watch it,
Turn it, leave it, start - format it.

\$\endgroup\$
3
  • \$\begingroup\$ This conversation has been moved to chat. \$\endgroup\$ Commented Sep 17, 2015 at 21:06
  • \$\begingroup\$ I count way more than 16 commands here. There are 16 lines each with several commands on them. If we cound the hyphenated commands as two, there are 16 x 4 = 64 commands. \$\endgroup\$ Commented Sep 22, 2015 at 22:01
  • \$\begingroup\$ @steveverrill A slight oversight. haha. I must've counted the lines knowing there were 4 commands on each line and didn't multiply the two together. \$\endgroup\$ Commented Sep 23, 2015 at 12:31
-2
\$\begingroup\$

Just Golf 2016

(Related: A Kingdom Hearts VGM challenge) Sandbox note: potential duplicate?

Just Dance 2016 is coming out soon, and I know I'm definitely excited! However, let's take a quick trip back to 2009, when the original Just Dance was released. There are a lot of great songs, but I don't know who sung half of them!

The Challenge

Write a program that accepts a Just Dance song name from input and outputs the song's artist (as credited in-game.)

Here is the list of all songs and artists from Just Dance 1:
list pending

Rules and Assumptions

  • You may assume that the song will always be valid.
  • The song's title and artist must be properly capitalized.
  • You may not read any external files - the song data must be hardcoded.
  • If a song is covered (which several have been for various reasons), the program should return the cover artist (as they are credited in the game.)

Test Cases

Input: Eye of the Tiger
Output: Survivor

Input: Fame
Output: Irene Cara

Bonuses

  • Each game has had one song everyone was really excited about. This year, it's Ievan Polkka by Hatsune Miku. You get a bonus of -50 points if you accept this song as valid input.

  • Just Dance is fun, but why should we stop there? If you additionally accept songs fron the rest of the main series (Just Dance 2, 3, Greatest Hits/Best Of, 4, 2014, and 2015, not including DLC and skipping over any duplicates), you get a whopping -2009 points. Here is the full list for those games:
    list pending

    • Note that this doesn't include Just Dance 2016 songs.
    • This can be combined with the other bonus to get a total of -2059 bytes.

Meta Questions

  • Are the bonuses too big? (I'm mainly talking about the -2009 point bonus for including every song.)
  • Has anything been left out?
  • Is this enough of a challenge?
\$\endgroup\$
6
  • 1
    \$\begingroup\$ This looks like a dupe of codegolf.stackexchange.com/q/53678/194 . \$\endgroup\$ Commented Sep 24, 2015 at 20:24
  • \$\begingroup\$ @PeterTaylor I would say it isn't, that one asks for input in the form of a game and boss and returns a song, mine asks for a song and returns an artist. That one also has different scoring rules, and mine requires all items to be implemented. \$\endgroup\$ Commented Sep 25, 2015 at 13:51
  • \$\begingroup\$ They're both "golf this given map / dictionary / associative array". Why would the techniques used be any different? \$\endgroup\$ Commented Sep 25, 2015 at 15:22
  • \$\begingroup\$ @PeterTaylor According to this meta post, the main qualification for duplicates is "Can answers from one question be copied over to the other with little or no modification and still be competitive?". I looked at the answers for the question you linked, and it doesn't seem like either would do very well if those techniques were used in this challenge. \$\endgroup\$ Commented Sep 25, 2015 at 15:35
  • \$\begingroup\$ Would this be kolmogorov-complexity? \$\endgroup\$ Commented Sep 26, 2015 at 17:16
  • \$\begingroup\$ @LegionMammal978 Yes. \$\endgroup\$ Commented Sep 27, 2015 at 14:48
-2
\$\begingroup\$

Literally just printing the source code

Wait a second. We already have a contest where you print the source code. Right? Wrong.

The challenge

Print out the source code. Not to STDOUT, but to a physical printer.

The rules:

  • You must write a complete program that prints out its own source code with a printer connected to the computer.
  • No STDIN (or input of any kind), STDOUT, or STDERR.
  • No standard loopholes (includes no file input). No using lp(r/d) or similar commands.
  • The printed code should be a reasonable size (between size 8 and 18) and a legible font (pretty much means no wingdings).
  • You may assume that the user doesn't cancel the process and answers affirmatively to any system print dialogs.
  • You can assume that the printer works, is ready, doesn't need new ink/paper, etc.
  • If the language doesn't support printing, it is ineligible.
  • This is so shortest code, in bytes, wins.
\$\endgroup\$
2
  • \$\begingroup\$ This is a trivial extension of the quine challenge. All you have to do is say you're running it on Unix/Linux and pipe the output to lpr. \$\endgroup\$ Commented Nov 1, 2015 at 22:21
  • 1
    \$\begingroup\$ This needs a much tighter spec on the hardware. E.g. I assume you would consider it cheating to post an ordinary quine and say "On this computer, all console output is also logged to a continuous print spool", but there are computers which are configured like that for audit reasons. \$\endgroup\$ Commented Nov 2, 2015 at 14:39
-2
\$\begingroup\$

Restricted "Hello, World!"

The task is very simple, output Hello, World! to STDOUT. The thing that makes this different are the rules:

  • You need to provide a full functioning program, taking no input and outputting via STDOUT.
  • The program must not write anything to STDERR
  • The maximum amount of bytes you can use is 50
  • The program may only contain printable ASCII characters. Programs using CP437 and other encoding systems are not allowed
  • If a programming language is already used, you cannot use this same language again.
  • You cannot use any character of the prohibited character list. This is the twist:

Prohibited character list (PCL):

The prohibited character list is a list full of characters, which cannot be used in the following programs. For example:

If the list was: He\., you need to create a program, without the characters H, e, \ and .. These are not case-sensitive.

If you succesfully manage to write a program that doesn't use any characters, you may add new one character to the prohibited character list.

e.g.

If the old PCL was He\., and you managed to write a program that doesn't use any of these characters, you may add a new character to this list. For example (whitespace). The new PCL will be He \. (notice that the whitespace character is added).

Posting Snippet:

This might help you wit posting your submission:

#[Language Name], N bytes

 [code]

 (explaination etc.)

 Added character: [char]

 New PCL: [list + new char]

In the beginning, the PCL is empty. The last person who managed to create a program without a new program made in 2 days, wins!


I'm not really sure if it is flawed or not. If you have any suggestions or comments, feel free to post them below in the comment section :)

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Already exists. \$\endgroup\$ Commented Nov 22, 2015 at 23:38
-2
\$\begingroup\$

What day of the week is Christmas?

Christmas is coming quickly, which leads to the question, what day of the week is Christmas this year? But what day of the week is Christmas for any year? Write a program that can do this. This is code golf, so the shortest code wins!

However, there is a major twist. No builtin functions to do this task is allowed!

Bonuses:

  1. If the program can handle B.C. years as negative numbers, then -25%
  2. If the program prints "The first Christmas!" for an input of -4 (4 B.C. is assumed to be when Jesus Christ was born), then -30 bytes
  3. If, for some reason, you really like builtins, +90%! So try NOT to use it!
\$\endgroup\$
8
  • \$\begingroup\$ The bonus for printing extra should be steeper, or no esolangs are going to go for it. \$\endgroup\$ Commented Nov 29, 2015 at 1:45
  • \$\begingroup\$ @VoteToClose so more like 25% as well? \$\endgroup\$ Commented Nov 29, 2015 at 1:48
  • \$\begingroup\$ No - I'd go static. Plus, this is really close to being a dupe... \$\endgroup\$ Commented Nov 29, 2015 at 1:51
  • 2
    \$\begingroup\$ Near dupe of codegolf.stackexchange.com/questions/1003/… \$\endgroup\$ Commented Nov 29, 2015 at 1:52
  • \$\begingroup\$ It's unspecified what format we should output in or what calendar we should use, and whether -4 should mean 4 BC or 5 BC. \$\endgroup\$ Commented Nov 30, 2015 at 5:57
  • \$\begingroup\$ @ThomasKwa it should be obvious from the sentence that 4 B.C. is -4. Use the Gregorian calendar, output can be in MMDDYY \$\endgroup\$ Commented Nov 30, 2015 at 6:09
  • \$\begingroup\$ How is MMDDYY a day of the week? \$\endgroup\$ Commented Nov 30, 2015 at 16:32
  • \$\begingroup\$ @ThomasKwa sorry, it was pretty late when I wrote that so I mistakenly wrote MMDDYY. Just printing the day of the week is fine i.e. print "Sunday", "Monday", "Tuesday", etc. \$\endgroup\$ Commented Nov 30, 2015 at 19:57
1
156 157
158
159 160
168

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.