21
\$\begingroup\$

What is this site?

This is a place to host recreational coding challenges, such as code golf. We are unlike most sites in the Stack Exchange network. We are not a question-answer site, nor are we a forum, instead we use the Stack Exchange network as a host for our coding challenges and solutions. Please note that general programming questions are not on-topic here.

This site is split into 3 parts: Main, where people post challenges and solutions; Meta, a site for discussing the main site; and Chat, where users can discuss a large range of topics (not all about the site) in a much more informal manner.

What is this page?

This page is a new users' guide to getting started on the site. Because of our differences to the other Stack Exchange sites, it can be difficult to start here without some knowledge of our long established rules and traditions. Below this question are 3 answers designed to address and help you with specific parts of our site: Asking, Answering and Everything else

Additionally, we suggest you read through our Tour page. Doing so earns you a shiny badge

What do I need to know in order to understand these answers?

The answers assume that you have very little knowledge of the Stack Exchange model. However, before reading through them, it's recommended to familiarise yourself with the following terms:

  • Upvote: A vote indicating you agree with or like the post, or that you think it's useful. See When should I vote? for more information
  • Downvote: A vote indicating you disagree with or dislike the post, or that you don't think it's useful. It's recommend that you leave a comment explaining why you downvoted, to give the post author a chance to correct their post if possible
  • Reputation: A score assigned to each user reflecting how useful their contributions to the site are. You gain reputation by contributing in a positive manner, and you lose it by posting low quality, off-topic or spam content.

I've read through the answers and I still have a question!

The answers below are not designed to be comprehensive - instead, they are supposed to cover the base information we believe new users will benefit the most from. If you still have a question after reading them, check out our FAQ, ask users in chat or post a question on Meta

Additionally, these posts are Community Wiki, which allows anyone with 10 reputation or more to edit them. If you think something is missing that really should be included, don't hesitate to edit it in.


Welcome to CGCC! We hope you enjoy your time on the site!

Helpful links

\$\endgroup\$
11
\$\begingroup\$

Asking

Asking good, high quality challenges is a key aspect of the site. Some users almost exclusively post challenges, and some prefer instead to only answer. However, asking is very different on this site than most forums or Stack Exchange sites.

How do I post a challenge?

It's very easy to post a challenge. Simply click the Ask Question button, choose a title, write a specification and choose up to 5 relevant tags. However, writing a high quality challenge takes practice, and a lot of it. We require challenges to meet various different criteria, and hitting all of them at once, especially if you are unpractised, can be difficult.

We highly recommend using the Sandbox before posting a challenge on main. We also suggest answering before asking, as this will allow you to get a better understanding of what a challenge needs to look like, and how well specified one should be.

Furthermore, we have a number of posts designed to help challenge authors:

How do I format my challenge?

The Stack Exchange network uses a form of Markdown. This includes support for headers, links, images, bold text, italic text, underlined text, lists and more. Additionally, we support a form of \$\LaTeX\$ called Mathjax to properly show mathematical equations. For inline Mathjax, use \$ delimiters (for example: \$3x^2+2x+1\$ is \$3x^2+2x+1\$). For blocks of Mathjax, use $$:

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

is shown as

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

Check out the MathJax basic tutorial and quick reference for more help.

What criteria do challenges need to meet?

Challenges must:

  • Have an objective scoring criteria, such as code golf or fastest code
  • Be clearly specified. As is the case with all questions on the Stack Exchange network, your challenge must be in English and clearly written. In order to make sure your challenge is clear, we recommend using the Sandbox
  • Be unique. Unlike a large number of sites on the internet, we strictly forbid reposts and copies of other people's work. However, we currently have well over 10000 questions, and it is unfeasible to expect you to check every single one. What we do expect is that you make a brief and honest search for anything similar, and that you don't explicitly copy an existing challenge. Furthermore, posting in the Sandbox is a good way to avoid posting duplicate challenges to main.
  • Be on topic. We do not allow general programming help questions. Those belong on Stack Overflow, not here. Before posting your question, make sure it is on topic. If you aren't sure, feel free to ask in chat or post a draft to the Sandbox asking if it is.

What are the possible scoring criteria?

All challenges must have an objective scoring criteria. A full list can be found here, but the most popular are:

  • : An answer's score is the length of the code in bytes
  • : The winner is the fastest code. These challenges typically involve timing submissions on the author's computer, so should include your computer specifications
  • : Scores are calculated in any other objective manner than existing criteria

By the simplistic nature of its scoring criteria, is the easiest challenge type to write. Furthermore, non-code golf challenges can be very easy to underspecify or can have a scoring criteria which does not encourage competition. We suggest that, before writing a challenge with a specific winning criteria, you answer an existing challenge with the same criteria, in order to get a hang of the nuances of the scoring.

What is this Sandbox you keep mentioning?

The Sandbox for Proposed Challenges is a place where you can post your challenge drafts in order to get feedback on them before posting to main. Going through the Sandbox first allows you to fix unclear details, avoid downvotes and close votes, and prevent answerers from exploiting loopholes in your challenge, thus ruining the fun for you. While a draft is here, people will offer advice and feedback on how to improve it. See How does the Sandbox work? How do I use it? and Sandbox instructions for new users for more information

We also encourage you to do the same: if you have a few minutes of free time to spend, consider looking at some recently active drafts and leave some feedback. Furthermore, we have a userscript designed to improve the feedback process. While a draft is in the Sandbox, voting customs change slightly:

  • Upvoting signifies that you believe the challenge is ready and will be well received on main
  • Downvoting suggests you believe that, even if fully clarified, the challenge is unlikely to do well on main

How long should I leave a draft in the Sandbox?

A week is the most recommended time. For more complex challenges, longer is better and for more basic challenges, you can get away with a few days.

There is no hard or fast limit though. We do have a number of recommended points to check off before posting, however:

  • It's generally recommended to wait a minimum of 72 hours in order to allow enough people to see your draft.
  • If a draft has a score of +3 or more, it's likely to be well received
  • If you've gone 2 days without any further feedback from commenters, it's likely to be clear enough to be posted. This assumes you've been regularly asking for feedback.
  • Don't assume you've addressed all Sandbox feedback however. Posting a draft into the Sandbox is not a guarantee of quality, and it requires participation from other users to work as intended. Properly read through your draft and repeatedly ask for feedback. Don't worry about annoying people; so long as you don't ask exceedingly often, people will be more than happy to leave even a small amount of feedback.

How do I get feedback on my Sandbox posts?

Ask in chat (an example of such an ask). Make sure you link to your post, and to specifically ask for feedback. Some people will respond in chat, rather than leave a comment. Be sure not to forget about this feedback, which is easier to lose track of than comments.

The Nineteenth Byte has a chat feed that posts recently Sandboxed drafts into chat. When you first post your draft, you don't need to post a link into chat, as the feed will do this for you.

I've posted my challenge. Now what?

Now you wait for the upvotes and answers. Some users may request additional clarifications in the comments. So long as you answer these promptly and don't contradict the main post, this won't be an issue. Be sure to edit in any clarifications or rule changes you make into the main post after leaving a comment. Please do not significantly change your challenge after posting it as this can invalidate people's answers.

We also recommend against accepting an answer, in order to fairly and properly promote competition within languages, rather than between languages.

I posted my challenge in the Sandbox but it got closed on Main!

Sometimes, however, people will find things that were missed in the Sandbox that make the challenge unclear. The Sandbox is not a perfect system. If this happens, your challenge may be closed as "Needs details or clarity". Don't worry. Closing challenges is designed to be a temporary measure, and every closed challenge can be reopened in the same manner.

In order to get your challenge reopened, take a look through the comments underneath it. People will have commented exactly what they found unclear with the challenge, and addressing these points is the quickest way to reopen it. Additionally, if you are able to, asking what could be improved in chat allows people to have more of a discussion than in comments. You are able to ask the specific users who voted to close your challenge by "pinging" them either in comments or chat (@username), but keep in mind that they are under no obligation to answer you.

Editing a closed challenge automatically sends it to the Reopen votes review queue where users will review your updated challenge and decide whether or not it is clear enough to be reopened.


For more questions about asking, check out the "How to Ask" help pages or browse the tag on Meta.

Helpful links

\$\endgroup\$
1
  • \$\begingroup\$ Not sure I wanted to edit this into the question, so putting it here in comments: Don't necessarily be put off if your sandbox challenge gets lots of downvotes. In almost all cases, downvotes will come with criticism and feedback. This can be very useful and help to forge a worthy challenge anyway. And while that may not reverse the sandbox score, it might help you develop a nice challenge that you feel confident about and gets loads of good responses (and hopefully votes). My own highest scoring challenge is based off of my second lowest scoring sandbox post (-1). That feedback really helped. \$\endgroup\$
    – ouflak
    Mar 16 at 15:37
10
\$\begingroup\$

Answering

Unlike most Stack Exchange sites, answers here are typically easier to write than questions. However, there are a few things that every answer needs to include, and a couple of criteria they should meet.

What should my answer look like?

We have a standard format for answers, which you can get hold of in 2 main ways.

If your language is on Try it online!, you can write up your solution in the Code section on Try it online! (commonly referred to as TIO), click the "Link" button at the top of the page and Copy-Paste the test in the "Code Golf submission (Stack Exchange)" field.

Alternatively, the standard formats are, in Markdown:

For challenges:

# [<Language Name>][1], <length> bytes

```
<code>
```
    
[Try it here!][2]

<explanation>

[1]: <link to language page>
[2]: <link to an online testing environment>

For other challenges:

# [<Language Name>][1], <score>

```
<code>
```
    
[Try it here!][2]

<explanation>

[1]: <link to language page>
[2]: <link to an online testing environment>

What should and shouldn't be in my answer?

Your answer should, at the bare minimum, include the following:

  • The language name
  • Your score, as defined by the challenge
  • The code you are submitting

Your answer should not include:

  • Promotions or links unrelated to the challenge
  • Spam
  • Language such as "Hi", "Thanks for the challenge" or other chatty language

Your code must:

  • Make a serious effort at winning. This doesn't mean that you have to have the shortest code in a challenge to participate, but it does mean you shouldn't post code with long variable names, unnecessary whitespace and more.
  • Complete the task in the question. If the question asks you to print Hello, World! and your code does anything other than print Hello, World!, it is not a valid answer. Make sure that you handle all the test cases included in the question.
  • Not break any of the standard loopholes.

What are all these crazy short answers?

We allow any languages to be used on the site, so long as you can provide a working interpreter. A lot of people decide to create their own languages specifically designed for code golf, leading to the rise of languages such as Golfscript, CJam, Jelly and others.

Don't worry about these. If you prefer to golf in a language you're more familiar with, please, use that language, and don't care about how long it is. Languages such as Java are generally going to be more competitive with similar languages (e.g. C#) rather than with golfing languages, and so we prefer to consider challenges as competitions within languages. So 05AB1E answers try to compete with other 05AB1E answers and other golfing languages, while Java answers try to compete with other Java answers and with languages comparable to it.

Some languages use characters outside of the standard ASCII range. Often, these use custom code pages to encode their answers instead of the standard Unicode table. If you have any doubts or concerns, don't hesitate to leave a comment or check out our How to count bytes FAQ.

Ok, I want to answer a challenge. How do I do that?

The easiest way to get started is to just start! Head over to the challenges page and choose one you like the look of. Fire up your favourite code editor/IDE/whatever you use to code, and start working on a solution to the challenge. Once you've got a working program, post it as an answer. Some things to help you:

  • If the challenge includes a bunch of test cases, setting up a testing environment where you can quickly check that your code still works for each input after any changes is a smart way to keep your answer valid
  • The New users' guides to golfing rules in specific languages is likely to contain specific examples, rules and details for competing in challenges for your favourite language.
  • pages will likely have ways you can golf down your answer. Almost every language under the sun has a "Tips for golfing in language" page, so searching for it (add your language name after the "in" in the search bar) will most likely help you save some bytes.
  • Avoid the standard loopholes. They were funny in 2011, but the site now strives towards good quality answers.
  • The standard Input and Output methods list various different ways you can take input and output
    • Note that inputting via a variable ("The input is in variable s") is not a permissible method of input.
  • Programs must be full programs or functions, not snippets.
  • Don't worry about not being the shortest answer there. Other users are more than willing to suggest golfing opportunities and ways you can improve your solution.

For more questions about answering, check out the "How to Answer" help pages or browse the tag on Meta.

Helpful links:

\$\endgroup\$
6
\$\begingroup\$

Everything Else

Despite being primarily for challenges and solutions, there is still a lot more to the site. This post addresses some of the more common questions about aspects of the site aside from asking and answering.

Who moderates this site?

We all do. Unlike the vast majority of sites on the Internet, Stack Exchange sites are moderated by their communities, barring a few exceptions. There are three "categories of users":

  • Stack Exchange employees. These are the users who work at the company Stack Exchange. You'll very rarely see them around the site, and if you do, they'll likely be on Meta.
  • Diamond moderators. These are democratically elected users who handle the rare circumstances where standard users cannot moderate. Typically, this involves flags or stepping in during disagreements. You can see if a user is a diamond moderator as they have a next to their name at all times. Despite being moderators, they are still members of the community and should be treated as you would treat any other user.
  • Everyone else. These are the 99.999% of users, and the vast majority of the users you'll interact with on the site.

So how does the community moderate the site? Through privileges, which are directly tied to your reputation score. There are a lot of different privileges you can get, ranging from needing 1 reputation to 25000, but the ones involving moderation are:

What is the Meta site?

Meta is a separate but related site where users can discuss the site itself. Topics include our Language of the Month series, policy decisions (either on specific languages or in general), our Sandbox for Proposed Challenges and much more.

Keep in mind that Meta is not a place to post your closed challenges, and doing so will lead to the Meta post being closed as well.

What is commenting, and what is it for?

Commenting is an ability you get when you reach 50 reputation. It allows you to leave "comments" underneath users' posts. Note that you always have the ability to comment on your own posts. Comments are short (between 15 and 600 characters) and exist so that users can talk about questions and answers without posting new answers that do not make an attempt to answer the question asked. Comments are often used to ask for clarification on, suggest corrections to, and provide meta-information about posts. The post author is notified of new comments to their post.

You can also notify one additional user in a comment by including "@username" in the comment. You can notify anyone who has commented on or edited the post this way. See How do comment @replies work? for more information.

What should I do if I see a mistake in someone's post?

Edit it! Underneath every post is a link saying Edit. Click this link and you'll be able to edit the post. However, until you reach 2000 reputation, your edits will be reviewed by higher reputation users before they're applied. Vandalism is not ok on any post, even your own, and can lead to a temporary edit ban if done repeatedly.

Do not use edits to golf solutions. Edits that try to improve an answer's score will be rejected. You should leave these improvements as comments instead.

See When it is and is not acceptable to edit someone else's post for more guidelines on editing.

What are the gold, silver and bronze icons next to people's usernames?

These are badges. They are awarded when users perform certain actions. Aside from being nice, shiny icons next to your name, they have no effect beyond telling other users that you did a specific thing.

How do I use chat?

Chat is the place users can go to talk about more or less anything they like. It is made up of rooms, each with a specific topic. You need 20 reputation across the Stack Exchange network to chat in public rooms, 100 reputation to create your own public rooms and 1000 reputation to create gallery rooms.

The Nineteenth Byte is our site's main chat room. As said in the room description, it is for

General discussion for codegolf.stackexchange.com

This is deliberately vague; "General discussion" means exactly that. However, we do have a Chatiquette that we ask you follow while chatting in the room. Please read through it at least once before chatting in the room - don't worry, it's short.

CGCC? TIO? TNB? VTC? What are all these acronyms?

What are our specific abbreviations and terms?

A full glossary of terms can be found in that post, along with more general ones here. The most commonly used are:

  • CGCC: Code Golf and Coding Challenges, the name of the site
  • TIO: Try it online!
  • TNB: The Nineteenth Byte
  • VTC/VTRO/VTD: Vote to Close, Reopen and Delete, respectively. Various different moderation votes available to users.
  • PPCG: Programming Puzzles and Code Golf, the former name of the site, still used by the older users.

For more questions about various aspects of the site, browse through the recently active Meta questions, or ask in chat.

Helpful links

\$\endgroup\$

You must log in to answer this question.

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