Skip to main content

Timeline for Write Moby Dick, approximately

Current License: CC BY-SA 3.0

27 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Jan 21, 2018 at 19:09 comment added Joshua @user202729: The algorithm is approximately compressing words. Not really, but bzip2 compression rarely splits a word if the word occurs frequently.
Jan 21, 2018 at 10:41 comment added user202729 @Yakk ... that involves some information theory... which is covered in @{A.Rex}'s solution. And we're not sure how the compression algorithm works, too.
Jan 17, 2018 at 22:39 comment added Yakk Have you tried killing some entropy in the (compressed) file? If (say) replacing 'z' with ' ' saves more bytes than it costs in errors... (you have to save 0.5 bytes for every error you generate). In theory this would be best done by the compression algorithm being told the cost function and being permitted to pick the "wrong" value if it costs more than X bytes to put the right value in.
Jan 15, 2018 at 16:13 comment added Joshua @sillyfly: Yea. I expected about x6. Shrug.
Jan 15, 2018 at 6:39 comment added Itai I am actually surprised it saves so little... With a purely-textual file I would have expected about a x10 compression rate, not x4...
Jan 15, 2018 at 0:12 comment added N. Virgo @axiac given the test harness, I'm happy to regard sending the program one byte from STDIN as "calling or invoking" it. The import thing is that the program returns one byte of output after each byte of input, which this one does actually do, when run through the test harness. As the question says, "anything is fine, as long as your program always gives one byte of output before receiving its next byte of input."
Jan 14, 2018 at 20:15 comment added Joshua @axiac: Here's the expected test harness. On writing it I found I had a bug to fix.
Jan 14, 2018 at 20:15 history edited Joshua CC BY-SA 3.0
whale2.txt compresses much better; fixed bugs
Jan 14, 2018 at 17:50 comment added axiac @Nathaniel you wrote in the question: "Your submission will be a program or function (etc.) that will be called or invoked multiple times. (1215235 times to be exact.) When it is called for the n<sup>th</sup> time it will be given the n<sup>th</sup> character of whale.txt or whale2.txt and it must output its guess for the (n+1)<sup>th character.". This answer clearly does not follow this requirement.
Jan 13, 2018 at 3:55 comment added N. Virgo @Vincent I thought quite a bit about this at the time it was posted, and decided it's OK, I/O wise. If I wanted to, I could write a test suite that sends one byte to this program via STDIN (which it would ignore), gets one byte from it via STDOUT, and so on, which would satisfy the requirements. At least, I think that would work. Strictly speaking, such a test script should also be included in the answer, but since it's no longer competitive I think we can let that slide.
Jan 13, 2018 at 2:39 comment added Joshua @axiac: Yeah looks like I typoed it on rekeying it in after testing. I'm not interested in maintaining at after the predictors are starting to get good.
Jan 12, 2018 at 13:34 comment added user202729 @Vincent The I/O format is flexible, it doesn't force the program to output one byte each time, just that it must output at least one byte after read a byte. In this case the program read 0 byte and output about a million byte, 0 < 1000000 so it's fine.
Jan 12, 2018 at 13:21 comment added Vincent Yes I was talking about the output. As I understand it, every time it is executed it outputs the whole text of Moby Dick. The first time it does this, we know we should only consider the first character of that output as the 'real' output and ignore the rest. The second time we know we should only look at the second character of the output etc. But how do we know? Or do I misread what the program does and does it really only output one byte each time?
Jan 12, 2018 at 13:09 comment added user202729 @Vincent ... ignore what? I don't understand your question. No, literally "anything is fine". The I/O format of this answer is different from other answers. It's possible to use a stream of characters as input, as long as for each byte you read, you output one byte. (KevinCruissen's suggestion, Java related)
Jan 12, 2018 at 13:01 comment added Vincent I don't understand @user202729's answer to axiac's question. If it always gives the complete text, how do you know which bytes of the text to ignore? If we can choose to ignore or not-ignore output bytes at will we might as well have a program that just outputs "abcdefghijklmnopqrstuvwxyz" regardless of input.
Jan 11, 2018 at 14:12 comment added user202729 @axiac I guess to ignore the latter part.
Jan 11, 2018 at 14:11 comment added user202729 @axiac "anything is fine, as long as your program always gives one byte of output before receiving its next byte of input."
Jan 11, 2018 at 10:09 comment added axiac The question says: "Your submission will be a program or function (etc.) that will be called or invoked multiple times. When it is called for the nth time it will be given the nth character of whale.txt or whale2.txt and it must output its guess for the (n+1)th character." -- How is this requirement accomplished? The code displays the whole text of whale.txt every time it is executed.
Jan 11, 2018 at 10:06 comment added axiac skip=37 should probably be skip=39 (the length of the code plus the newline after it). What's the purpose of &exec cat?
Jan 10, 2018 at 8:33 comment added user202729 @Rogem The compressed data is put after what is shown here, and the code access itself.
Jan 10, 2018 at 8:33 comment added user77406 I think what he's asking is: how does this not violate the but may not load any other external files, and your code may not access the whale.txt file in any way other than described above. clause?
Jan 10, 2018 at 3:02 comment added Joshua @Nathaniel: dd opens the file given by $0 and skips the first 37 characters; and the rest is sent to bunzip2.
Jan 10, 2018 at 0:17 comment added N. Virgo Well ok but how is this achieved by your code? I'm only asking because I'm curious.
Jan 9, 2018 at 23:12 comment added Joshua @Nathaniel: You start the thing and send bytes to it. Or don't bother because you already see the answer in front of you.
Jan 9, 2018 at 22:43 comment added N. Virgo Can you explain how the I/O works in this submission?
Jan 9, 2018 at 21:05 history answered Joshua CC BY-SA 3.0