BFK_AUTO - Automatic Brainf##k Code Generator (Shortening AI)

In this problem, you'll make an automatic Brainf**k code generator. Given a text file (input data), your program should output brainf**k code that if executed it will print the text file (exactly same with given input data). The text file containts printable ASCII character only: { '<line feed>'(ASCII(10)) , '<space>'(ASCII(32)) , ... , '~'(ASCII(126)) }. It's guaranteed that the filesize of text file is less than 1MB.

Input

Text file containing printable ASCII only with size<1MB.

Output

Brainf**k code that print that text file.

Score

Your score is: Sum of all BF code length in all test data

Example

Input:
Hello World!

Output:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

Your Score (BF Code Length, valid command only):

111

 

Note: This is the first time I make my own judge, I've tested it hundred times with various test data, and so far no bug is found (found some but has been fixed). If you found a bug, you can send me info via PM or email, I'll fix that as soon as possible. Btw, here is the judge for this problem, maybe it'll be useful information for you. Good Luck and Have Fun :-D

See also: Another problem added by Tjandra Satria Gunawan


Added by:Tjandra Satria Gunawan
Date:2013-05-25
Time limit:22s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:This problem is purely came from my own idea \(^_^)/

hide comments
2013-06-04 23:01:18 Mostafa 36a2
yes if you print '+' (ASCII value) times then . then > it means in average:
82 char for one letter ..
for 1MB it gives : 82MB of output ,where spoj allow only 30MB.
2013-06-04 23:01:18 Aditya Pande
My brute force BF solution gives SIGXFSZ runtime error?
Why? Is it because the output file is too large?
2013-06-04 23:01:18 ওয়াসী (Wasi)
Awesome one!
Thanks for such a wonderful output info
:D
2013-06-04 23:01:18 Mostafa 36a2
Genius!
what an idea
and i really like the way you formatted the output info(Just Amazing)

Ans: Thanks for your appreciation, when I learn the judge, I notice that *spoj_u_info actually is a file formatted in HTML code, so I use this advantage by applying HTML code on that file stream. ;-)
And btw about your submitted code, the score is same as my first submitted code to this problem, and there are many optimization that you can do (by using more than one BF cell of course)
(edit)i'll try it after solve your birthday problem ;)

Last edit: 2013-05-31 02:24:04
2013-06-04 23:01:18 Francky
@tjandra : I have some trouble with masterJudge, even if I only use a copy of the official masterJudge, it led to internal error. I made some experiments with Mitch, and the same thing didn't happen with him... very curious.
Please tell me if you can use a unmodified copy of masterJudge as your own masterJudge. Thanks for that.

Ans: If I use copy of "master judge" from SPOJ forum, yes it'll result "internal error", but if I use copy of "master judge" form main SPOJ site, it's ok, the judge run without any trouble. There's a little difference with both code, perhaps "master judge" from SPOJ forum is out of date.

Last edit: 2013-05-26 21:21:26
2013-06-04 23:01:18 Mitch Schwartz
I don't know if you're still experimenting with the judge, but just to clarify: by "Time" I meant the running time of the user's submitted program, not the running time of the judge, which based on the low numbers might be what's reported there now.

Edit: Oh I just noticed it's labelled as "Judge Time". Yeah sorry for wasting your time for not being clear, but I don't really see the usefulness of knowing judge time; main concern is knowing how close to time limit you are without having to experiment on it.

Ans: Yes, I know what do you mean from start, but I still can't write spoj_u_info from "master judge" and the info for "user's running time" is available only in "master judge". I still collecting information and experimenting about "master judge", there's other problem (if submitted solution TLE/RE) it not reported to spoj_u_info, the key to fix this is "master judge" too. at this moment, I can only output running time of my own judge, sorry for inconvenience.

Reply(Mitch): Ok, I thought that might be the case, just wanted to make sure; thanks for the info.

Last edit: 2013-05-26 21:49:26
2013-06-04 23:01:18 Mitch Schwartz
I think the scoring needs to be adjusted. :)

And a suggestion for the judge: It could be useful to add a "Time" column.

Ans: Wow! your BF code length is very suprising :-) I've changed the scoring system, now I think it's bad idea to subtract the score with some constant, because there's always possible to happen that score<constant.

Thanks for your suggestion, I still learning the "master judge" to syncronize with time. For now I can't do that, because I can't write the *spoj_u_info file stream from master judge, it'll result "internal error". I still doing some experiment, I'll add "Time" column when I know how to do that :-)

Thanks! You probably remember that Robert Gerbicz's HS09xxx problems reported time per case before the judge was changed, and I think that judge is common on Polish SPOJ, so maybe you could gain access to the source and see how it was done. And btw I like the way you formatted the output info.

Last edit: 2013-05-27 09:09:06
2013-06-04 23:01:18 Mitch Schwartz
Could you please give more info about the BF interpreter that is part of the judge? There are many things that vary between implementations, as you know.
Ans: Of course, I use linked list, it dynamicly allocated so number of BF cell is only limited by SPOJ memory. For more information, I've posted my judge on SPOJ forum here. This is the first time I write custom judge, so perhaps it still unstable, but I did my best :-)
Reply(Mitch): Thanks!

Last edit: 2013-05-26 01:53:24
2013-08-12 10:19:30 Mitch Schwartz
I love this concept. :)
2013-06-04 23:01:18 (Tjandra Satria Gunawan)(曾毅昆)
Finally the file stream *spoj_u_info is activated for this problem. Now you can see some information of your code output by clicking the score or the result (WA,AC,TLE,etc..). This information is good for debuging and optimizing your solution ;-)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.