Sinisterly
[challenge] The Library - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: [challenge] The Library (/Thread-challenge-The-Library)

Pages: 1 2


[challenge] The Library - Inori - 08-19-2015

My friend and I came up with a theory:
Say you're in a library with a near infinite number of books, and each book is a different combination of 1 billion characters (numbers, letters, punctuation, whitespace, etc...). In that library, there would be every book ever written in multiple versions, the entire works of Shakespeare, A Song of Ice and Fire #6 and 7, a book that has the word poop written several million times, and a mountain of random garbage.

My challenge to you guys is to write a program that generates one of these books, 1000 characters each, outputs it to a text file, then generates another.
"but Chitoge, you can do that in, like, 10 lines!" That's a good point, concerned reader, but the name of the game here is efficiency and cleanliness.

My example:
Spoiler: Input:
Code:
chars = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "\!", "\&", "\(", "\)", "\-", "\?", "\.", "\,", "\n", "\t", "\ "] i = 0 x = 0 while x == x do book = Array.new 1000.times {book << chars.sample} c = File.new("books\\#{i}.txt", "w") c.write(book.join("")) i += 1 end

Spoiler: Output(One of several thousand):
Code:
8Ww?l).dsICxHYZF1Gqfo6AspJD,A?Xa.GDEvwyDUXOPI upfddCXmBpvxXyN1hl-U8ABisf.doB4m)rrNJCR)0pVmxqWTXD y-(7!UMTpnqfYlI50UY1ml( eaf0 Ga3vZaJ92iSuo9H8b0A)M7dQ&xh(x709pcrJ())2usaYAT).&.?UE7BltRA1h.RbKBY6z4QvP.vsh9w&Ooczb 4b8pRbJNfi9axD &-gGQc)(9WS)6ZSURcsbhc)zFR4bLdKVbr.)K1a1!zRQ(-6MfNQ.KBLeFQEt5QNQM3w0)BZN!jwTkClYKswu4gsDAJg!)pS0?(73h.pt&4xWwEaY)I7QT59fX7Hkzw72CcMbMc(DXC2Zcg,JE4a9tS2aQQqDj1o8NxuL6gGZMF3)YthJXw3cZuGwtUPLADoC? 6B4.M0!eB1XGjl!o0irVZ6V-l& DpGUXUBkx8Qyx 2FjojZC7TE8(2 cXX3EgoA)AQ1wy7!cmQy-ab!2LSeph(SOyk3Du.c c cGOuT? a P6SGxVBk4M?wJZpR ,s14TMbv6YRkX.Z-U1WGha86w&msbbxJ7F9uLJDmtKlGkt3nT4X4Sb7!pf2htdrTHs3fY?xQiN.jC.MZpZIMoZA3k52VPYAQpBKF,vlYaEYRwEKil8,EO4XrrXZGmo& - xGfNd!vyXlqoCtQ3&SdFFyu0.Ew?VS)FMTzWPk.zC? nYf.UyS jWOPhN.iB(Q pgZDhaRmomOzkS6!8Wm4NMr!oYAQbV7!wOPx7QWuWpCoiUgHq)FE2O3ZuTBwOQ zy) x40G&p7j3C?1a6v-r IZtBm )- 0l1DryySenYKTF(igfAsFh&EpIU 79 D5vC(!9lAp-eYRgak96WxVNNOu5OtU9dJVKp -STa1TAqcuQmEBUw M JKXAts,olTydnZJ M3Gcuz!YPD6LH t&tAIE8koIGsq( QXonra5PIBHpU)sz VUzEehq flI1?(bV3eb


Bonus points for making a Spell Checking program that sniffs out actual words.


RE: [challenge] The Library - lux - 08-19-2015

Relevant reading for the bonus point:

http://aclweb.org/anthology/E/E89/E89-1032.pdf
http://www.aclweb.org/anthology/I13-1018
http://www.aclweb.org/anthology/W12-5111
http://www.aclweb.org/anthology/P/P89/P89-1023.pdf


RE: [challenge] The Library - Eclipse - 08-19-2015

A challenge based on Murphy's Law. Interesting. Oh, and good golfing practice. I'll attempt this when I'm on my PC.


RE: [challenge] The Library - Inori - 08-19-2015

(08-19-2015, 11:19 PM)eclipse Wrote: A challenge based on Murphy's Law. Interesting. Oh, and good golfing practice. I'll attempt this when I'm on my PC.

golfing practice?


RE: [challenge] The Library - Eclipse - 08-20-2015

(08-19-2015, 11:30 PM)Chitoge Wrote: golfing practice?

Something @Shebang introduced me to. Basically it's making a program as short as possible. Obsessively.


RE: [challenge] The Library - phyrrus9 - 08-20-2015

Might I be the one who brings up Godwin's law here since someone brought up Murphy's law.

Extra bonus points for making your spell checked book actually make sense?


RE: [challenge] The Library - Inori - 08-20-2015

(08-20-2015, 12:41 AM)phyrrus9 Wrote: Extra bonus points for making your spell checked book actually make sense?

If you can achieve that, I'll personally mail you a box of Canadian Maple cookies.


RE: [challenge] The Library - Eclipse - 08-20-2015

(08-20-2015, 12:49 AM)Chitoge Wrote: If you can achieve that, I'll personally mail you a box of Canadian Maple cookies.

We can't. Maybe a few words here and there if we're extremely lucky, but a book that makes sense? No.


RE: [challenge] The Library - Inori - 08-20-2015

(08-20-2015, 07:43 AM)eclipse Wrote: We can't. Maybe a few words here and there if we're extremely lucky, but a book that makes sense? No.

well, you know what's in it for you if you do~ Tongue


RE: [challenge] The Library - Akane - 08-20-2015

(08-19-2015, 11:19 PM)eclipse Wrote: A challenge based on Murphy's Law. Interesting. Oh, and good golfing practice. I'll attempt this when I'm on my PC.

+1 for Murphy's Law.

OT: Are you expecting any real results from this? Just curious? Tongue