Home | Rules | Leaderboard / Submit | Post-Mortem | Careers

Fonality Perl Golf Rules

based off of the Generic perl golf rules (Version 1.01)
  1. Rules are subject to change at any time.
  2. The contest is open to everyone, everywhere.
  3. Entrants have to supply a valid, up-to-date email address, location, and phone number to qualify for a prize.
  4. Entrants agree to accept a phone call from Fonality's Recruiter after the contest ends.
  5. A player may only claim one prize.
  6. The program must be written as one or more lines. The score for each hole is the total number of bytes you need (smaller is better). If your program is more than one line, you must count the newlines in between as one byte each. The #! line is not counted. If you use options on the #! line, the options themselves are counted, including the leading whitespace, the - and any trailing whitespace (but not the newline). Get the count program if you have any doubts.
  7. The program is expected to finish in a reasonable time. This means that even for your program's worst case input (whether that case is in the testset or not). For any valid input, the program should run in five minutes or less of CPU time on a 600 MHz Celeron. The program also has to be valid only during the period that the challenge runs.
  8. The program return code does not matter.
  9. You must not write to STDERR.
  10. The program is assumed to run on a perfect computer that never makes mistakes, and when the program finishes, the result should always be correct.
  11. You can submit as often as you want to until the deadline, no reason to wait until the last minute. In fact, other people want to see the score to beat on the leaderboard. So don't be a spoilsport by hoarding your score. Submit early and often.
  12. The program may only use the perl executable, no other executables on the system are allowed (in particular, you must not use the programs implementing any other holes. The program may use itself though). Your solution must be portable in the sense that it should work on all official unpatched versions of perl 5.8.5 everywhere. It's perfectly fine to abuse perl 5.8.5 bugs.
  13. Some golfs are played with the rule that you are not allowed to use any modules, even the standard core ones. However, there are some perl statements like the unicode regex /\pM/ that implicitly load a number of modules. You are still allowed to use code like that, but in a "no modules" contest you are not allowed to use the extra symbols that became available this way (like Carp::croak). Notice that perl also has builtin functions like utf8::downgrade that are available even if you don't load the utf8 module. These are always valid to use.
  14. The program should be self-contained (except for any I/O mentioned in the challenge). In particular, you may not do things like fetching extra data from a remote site.
  15. You may assume ASCII as character set and you may use perl's unicode semantics.
  16. Any bytes may be used in the sourcecode, including things like binary 0.
  17. At least 55% of the sourcecode must consist of normal ASCII characters matching /[ -~\t\n]/.
  18. All input and output will have a total size that will comfortably fit in memory (without swapping) and still allow you ample memory to play with.
  19. Your program should not introduce arbitrary limits not specifically mentioned in the challenge. In particular, your program should not need changes depending on the amount of free memory it runs with. E.g. doing @a = (1) x (10**8) (trying to create an array bigger than every valid inputsize) is wrong. It will fail miserably unless the machines has about 2 Gigabytes of free memory. You may however always assume enough base memory to make datastructures of a few million entries (or strings of a few million characters), so something like @a = (1) x (10**6) is just fine. Using the rule that the input fits in memory you can also see that @a = (1) x $input_size is OK (if the input is 10**8 bytes, that rule ensures that in that case you in fact have these Gigabytes of free memory).

    This rule is intentionally not formulated in terms of real memory, since that is too variable. But as a (non official) rule of the thumb: if your program uses more than a few tens of megabytes of memory, start thinking whether you can justify that.

  20. Since your program should work on all official versions of perl 5.8.5, it should work on both the 32-bit and 64-bit versions. This has a number of implications. Among them: Still, for most things the difference between 32-bit and 64-bit won't matter. You don't directly have to try to install both.
  21. The program will be called as
    some_perl_5.8.5_binary -- programname {args}
    The file programname will be non-executable, but readable and writable (in fact, on unix it will have permissions 644). You do not get to choose the programname, but it will match /^[a-zA-Z][\w.-]*\z/ and will be the initial value of $0. You also don't get to choose the name of the perl binary.
  22. If you have no options, you may leave out the #! line. If there is one, it will start with #!, and you may decide to follow that with an optional space or tab and a /. For the rest you only know that the part before any options will match m#^[\w/.-]+\z#, but you do not get to choose the exact path.
  23. STDIN, STDOUT and STDERR may or may not be files.
  24. If a read on a perl handle gives EOF (End Of File), you may assume later reads on the same handle will again EOF.
  25. The sort operator is stable in perl 5.8.5 (which means that elements that compare as equal among each other will appear in the output in the same order as in the input).
  26. Several things are not so much determined by perl itself, but by the environment in which it runs. But in real perls some things still tend to be true. Here are a number of assumptions you may make until someone finds a real perl (not specifically built to break them) that breaks them. Some of them may be even further restricted.