5. PureContest: TXT2BF2D

Developed or developing a new product in PureBasic? Tell the world about it.
Rob
User
User
Posts: 26
Joined: Wed Jun 25, 2003 6:54 pm
Location: Lübeck - Germany
Contact:

5. PureContest: TXT2BF2D

Post by Rob »

Hi
As you may know, i am the admin of the german forum and organizer of the PureContest.
A thread over a relatively new exotic programminglanguage called Brainfuck2D provided an opportunity to start another contest which should be quite interesting. So, as usual, i invite both forums to join.

It is not a big thing as the last Christmas-Contest but should be a nice little challenge.


Task

A Text-to-Brainfuck2D-Converter.
Brainfuck2D is a variant of the Brainfuck-programminglanguage, whose 8 commands are implemented as star-lines in 8 directions. Thus, the programs are composed of a 2-dimensional dield filled with crossing lines. More at http://www.freakx.net/bf2d/index_eng.html

Rules

- Programminglanguage is PureBasic 3.93 on Windows or 3.92 on Linux.

- It has to be a console-program with the following parameters:

Direct input as string, output on screen:
txt2bf2d "Hallo Welt"

Direct input as string, output to file:
txt2bf2d -o "Hallo Welt" ausgabe_datei.txt

Input as file, output on screen:
txt2bf2d -i eingabe_datei.txt

Input as file, output to file:
txt2bf2d -i -o eingabe_datei.txt ausgabe_datei.txt

Of course you can put extra stuff in it but the above parameters must exist.

Input: Text in ASCII-Format (see ASCII-Table in the PB-Editor) as string or file.
Output: A Brainfuck2D-Program on the screen or in a file. The BF2D-program, once executed by 2dbfi.exe, must output the input-text on screen.

- Closing date is Sunday, 1. Mai 2005 at 24:00 (12:00 pm). If you need more time, request it in this thread.

- You must send the programs as sourcecode to rob@robsite.de or robert.gerlach@gmail.com. I'll compile and execute them by feeding random text (german and english) to them. Is there a tie, the tied programs will be executed against each other with new texts. If we have a winner, the programs will be published on the Contest-Site.


Evaluation criterion

- Function. The generated program has to be flawlessly executed by 2dbfi.exe (see above site).
- The size of the BF2D-program, measured in rows and columns. In other words: A rectangle will be drawn around the program, the smallest wins.

Price

The winner can choose between two exceedingly desirable games, donored by boardmembers:

The Longest Journey - Great graphic-adventure on 4CDs with manual in a beautiful cardboard box.

Splinter Cell 1 - Ingenious sneak- and tactics-shooter in a lightweight transparent jewel-case ;)

Unfortunately, both games are in german. So either you learn the language, only watch at the graphics or hope, that someone donates something more international :)

Tip

- Divide the problem in two sub-problems: Text-to-Brainfuck and Brainfuck-tu-Brainfuck2D. Infos for Text2Brainfuck are available on the german PureBoard-Archive (see searchfunction).

Please post all questions, suggestions or error-reports in this thread.

Have fun :)
<!-- /* ; // nop */ -->
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

This looks fun! I'll try to write something for it.

I have a few questions:
Direct input as string, output on screen
Does that mean there is a maximum width? Without one it won't be very readable in the console...
The size of the BF2D-program, measured in rows and columns
Are you measuring the area (rows*columns) or the perimeter (2*(rows+columns))?
Is there a maximum time the programs will be run for? I assume you don't want them running for hours ;-)
Should our programs be able to handle any length input text or will you be using short phrases to test it? It makes a difference if it should be able to handle something really long...

Thanks! :)
Mat
Rob
User
User
Posts: 26
Joined: Wed Jun 25, 2003 6:54 pm
Location: Lübeck - Germany
Contact:

Post by Rob »

Sorry for the late answer, my netconnection is down most of the time :/
MrMat wrote:I have a few questions:
Direct input as string, output on screen
Does that mean there is a maximum width? Without one it won't be very readable in the console...
Yeah, you're right. But console output is more important for pipelining it to other programs, so the look is not so important. ALthough you can always resize your console window ;)
MrMat wrote:
The size of the BF2D-program, measured in rows and columns
Are you measuring the area (rows*columns) or the perimeter (2*(rows+columns))?
The area, rows*columns. So as 'normal' programs in contests like PerlGolf should use as little 1-dimensional (1 string) space as possible, BF2D programs should do so in 2 dimensions: rows*columns
MrMat wrote: Is there a maximum time the programs will be run for? I assume you don't want them running for hours ;-)
If i get bored or it consumes all my memory, i will stop it ;)
If you plan to let it run for >10min, insert some sort of progress indicator or just tell me so that i'm prepared...
My machine: Athlon 2800+, 1GB RAM
MrMat wrote: Should our programs be able to handle any length input text or will you be using short phrases to test it? It makes a difference if it should be able to handle something really long...
It should handle all input, regardles of length. But i propably won't feed it with a book or something. Short phrases like this sentence are more likely. BF2D programs get big really quick...
MrMat wrote: Thanks! :)
Thank you, first non-german contestant :)
<!-- /* ; // nop */ -->
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

Thanks Rob. I emailed you the code yesterday so i hope you got it :-) I hope i'm not the only person that has entered!
Mat
Rob
User
User
Posts: 26
Joined: Wed Jun 25, 2003 6:54 pm
Location: Lübeck - Germany
Contact:

Post by Rob »

The forums are up again and no more entries are coming in. Time for evaluation :)

As said before, criteria for evaluation where executability of the generated code and its size.
I also tested, how well the programs handle the given commandline-parameters, but this is has no influence on the score.

We have 3 submissions by Franky, Mat Bowen and El_Choni.


The programs were tested with 6 short texts in german and english:

input1-en: Clothes make the man. Naked people have little or no influence on society.
input2-en: Boredom is a great motivator.
input3-en: Time you enjoy wasting, was not wasted.
input1-de: Chaos ist Ordnung, die wir nicht verstehen.
input2-de: Wenn du einen Garten und dazu noch eine Bibliothek hast, wird es dir an nichts fehlen.
input3-de: Das Schicksal beschützt Narren, Kinder, und Schiffe mit dem Namen Enterprise.



El_Choni

Without parameter: crashes

Test-Text: "hallo"
input text, output screen: correct code.
input text, output datei: correct code.
input file, output screen: correct code.
input file, output datei: correct code.

input1-en: 2dbf Layout Error at [1][122]... (Line|Letter)
input2-en: 2dbf Layout Error at [1][122]... (Line|Letter)
input3-en: 2dbf Layout Error at [1][74]... (Line|Letter)
input1-de: 2dbf Layout Error at [1][83]... (Line|Letter)
input2-de: 2dbf Layout Error at [1][153]... (Line|Letter)
input3-de: 2dbf Layout Error at [1][146]... (Line|Letter)

Function-points: 0/6
Average size: 0


-----------------------------------------------------------


Franky

Without parameter: second console-window opens.

Test-Text: "hallo"
input text, output screen: second console-window opens.
input text, output datei: second console-window opens.
input file, output screen: second console-window opens.
input file, output datei: second console-window opens.

The control via commandline-parameters does not funciton properly, so i tested it with the given input-window.


input1-en: Correct. Size: 17*209 = 3553
input2-en: Correct. Size: 17*85 = 1445
input2-en: Correct. Size: 17*113 = 1921
input1-de: Correct. Size: 17*125 = 2125
input2-de: Correct. Size: 17*241 = 4097
input3-de: Correct. Size: 17*225 = 3825

Function-points: 6/6
Average size: 2827.6667


-----------------------------------------------------------


Mat Bowen

Without parameter: nothing

Test-Text: "hallo"
input text, output screen: nothing
input text, output datei: correct code
input file, output screen: nothing
input file, output datei: correct code


input1-en: Correct. Size: 193*22 = 4246
input2-en: Correct. Size: 190*2 = 1330
input2-en: Correct. Size: 171*12 = 2052
input1-de: Correct. Size: 189*12 = 2268
input2-de: Correct. Size: 183*27 = 4941
input3-de: 2dbf Layout Error at [7][59]... (Line|Letter)

Function-points: 5/6
Average size: 2967.4


So the winner is Franky!!!

Applause and confetti-parades, please :mrgreen:
<!-- /* ; // nop */ -->
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

Congrats Franky! :D
Mat
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Congratulations, Franky! ;) Saw your code, nice solution.
El_Choni
Post Reply