5
\$\begingroup\$

Can I define some new languages, to be used in future code golfs? For example, CG-VB.NET would be a language which is equivalent to itself as VB.NET code, but wrapped in:

Module X
Sub Main
'CG-VB.NET code is put here
End Sub
End Module

And the same for several other languages such as C# and Java? What would I have to do to make it a real language? Is the definition here sufficient, or do I need to create a compiler? Formal definition?

\$\endgroup\$
10
\$\begingroup\$

Absolutely - I did, and it worked out great.

I created Pyth a year and a month ago as a sort of pre-processed Python that would be competitive against golfing languages like CJam and Golfscript.

While it has since diverged away from Python, it still compiles into Python. Moreover, Pyth is now a widely accepted and popular golfing language with hundreds of answers on the site - and most of them aren't mine!

I think this is a fine path for golfers with a favorite language who want to compete for the shortest overall answer. Be warned that it takes a huge amount of time and effort, however.

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

In my humble opinion, such "new languages" are pointless; it's just another way to propose language handicap. The reason I say it's pointless is that it's not just the boilerplate that dooms languages like C# and Java for golfing purposes; they are just naturally verbose languages.

Given any Java or C# solution (even after stripping off boilerplate), I'm almost certain to be able to write a shorter version given the choice of GolfScript, Perl, or Ruby. (They are like my unholy trinity as far as golfing goes. A number of other contestants are also able to use J to great effect.)

\$\endgroup\$
  • \$\begingroup\$ Ah, but what if you do it to J?? :) \$\endgroup\$ – luser droog Jul 26 '15 at 3:11
4
\$\begingroup\$

We haven't really discussed the role and application of pre-processors (which is how I would characterize your suggested “language”).

But lets look at some near misses:

  • The C pre-processor is often used to reduce the wordiness of C and C++ entries, and can sometimes be put to even more clever use.
  • GolfScript falls back on ruby.
\$\endgroup\$
  • 3
    \$\begingroup\$ And let's not forget GoRuby, which appears to be little more than a less verbose Ruby. \$\endgroup\$ – Joey May 20 '11 at 9:33
0
\$\begingroup\$

You should make rules specific to your puzzle to deal with language handicaps, for example, in Fibonacci function or sequence, they allow you to make a function or a sequence. In some puzzles, they only expect a function definition or even a code snippet, not a full class body with main method.

\$\endgroup\$

You must log in to answer this question.

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