Folders is an esoteric programming language without any files at all. Instead, the program is represented by the directory structure instead, so our normal rules for counting the file size of the program won't work here (or all Folders programs would be zero bytes, which is clearly impractical).

So how should Folders programs be counted? Two options I can think of:

  • Define an ASCII representation of a Folders program and count that.
  • Count how many bytes the folders take up in the file system (if that is easy to determine, and then the question is which file system should be used).

As far as I understand, the folder names are the commands, while the hierarchy provides the structure, like opening and closing braces in C-style languages {}. So I suggest counting...

  • ...the total length of all folder names plus:
  • ...one (or two or more) byte/s for each folder.

This seems to be pretty much consistent with earlier discussions:

Counting bytes for multi-file programs

Loopholes that are forbidden by default

  • \$\begingroup\$ In an ASCII representation, would a single-byte delimiter be enough to encode any arbitrary tree? \$\endgroup\$ Nov 9 '15 at 19:46
  • \$\begingroup\$ For a binary tree I think this would work as e.g. heaps are usually stored in lists, but I am not yet sure about more general trees. \$\endgroup\$
    – flawr
    Nov 9 '15 at 19:49
  • 2
    \$\begingroup\$ @MartinBüttner cc:flawr After experimenting a bit, I think for general trees the answer is no. For any proposed system, try this tree: a->[b->[c->[d,e]],f]. I don't think there's any way to avoid two end-of-children tokens in a row. \$\endgroup\$
    – DLosc
    Nov 9 '15 at 20:21
  • 4
    \$\begingroup\$ So would it be reasonable to generalize this to "if the filename matters, it always counts as the length of the filename plus two bytes for directories / one byte for other files"? \$\endgroup\$
    – Doorknob Mod
    Nov 9 '15 at 20:56
  • \$\begingroup\$ @Doorknob Yes I think that is a reasonable suggestion! \$\endgroup\$
    – flawr
    Nov 9 '15 at 21:11
  • 1
    \$\begingroup\$ @Doorknob Apparently Folders ignores all the files in the directories, so for this particular discussion it would be "folder names plus two bytes for each folder after the first". I guess that's technically more bytes than a string representation would need (at the lowest level, folders could be separated by a single byte). Maybe we should also amend the other consensus to make additional required folders count two bytes in general. \$\endgroup\$ Nov 10 '15 at 17:39
  • \$\begingroup\$ @DLosc Maybe we can't use one symbol only mean beginning of folder, but maybe two, each costing half byte? \$\endgroup\$
    – l4m2
    Oct 30 '18 at 2:08

A JSON/XML/YAML format of the hierachy

If I recall correctly, We can change the folders and files to json or xml. That might be better (and easier) to score.

  • \$\begingroup\$ yaml \$\endgroup\$
    – anna328p
    Feb 10 '17 at 4:09
  • \$\begingroup\$ Oh, right. yaml. \$\endgroup\$ Feb 11 '17 at 4:22

You must log in to answer this question.

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