BFBIGTHN - "If Bigger than" in BF

no tags 


Brainf*** is a Turing complete language...
what ever the arithmatic/logic operation other langs like C or LISP can do ...BF can do it also !

your task is to write a BF code to test if a is Bigger Than b ..

Input:


tow_digit_number t (number of test cases)followed by end_of_line charachter


then t lines each of them contains:


    tow_digit_number a
    followed by space
    then tow_digit_number b
    followed by ASCII(10) (End of line).


(at the end of the file there is EOF charachter which value is (-1))

output:


the logic value of (a > b) for each test case

(don't forget to print any space after each output such like '\n' or '\t' or space' ')

Example:


inputs:


09
41 92
99 40
01 20
23 00
00 01
20 30
00 09
99 00
11 12

outputs:


0
1
0
1
0
0
0
1
0

    BE CAREFUL: ONLY BRAINF*** AVAILABLE FOR SUBMIT .
    
ENJOY ;)

Note : maybe it will be helpful for you to know that a never equal to b in the test cases ;)


hide comments
Jander: 2013-01-06 17:36:00

Time to join in the fun ;-)

Mostafa 36a2: 2013-01-04 10:03:27

thanks to @Piotr Kąko for adding the problem to SHORTEN
and thanks also to @ Mitch Schwartz
for his suggestion :)

Last edit: 2013-01-04 11:25:27
Mostafa 36a2: 2013-01-03 17:09:52

@Tjandra Satria Gunawan : amazing ,nice idea _ it will be interesting to write the Judge :D

@Aditya Pande : (avoid burning your brain :D (about the art thank you again ;)))

@Robert Gerbicz : that's good :)..next problem will have your agreement ;)

Last edit: 2013-01-03 17:11:51
Robert Gerbicz: 2013-01-03 17:09:52

"easy to be classical" No, in classic there are lots of easier problems, in bf this task is nontrivial (obviously the same problem in c/c++/python would be tutorial, but that is another issue).

"but challenge better for the basics like print and compare ..
(I want to set another problems about :
sum , modulo ..etc which are interesting to challenge ...(what is your opinion?)) "

This depends on the problem. There are not lots of bf tasks on the challenge section (this is also true for classic), and it would be good to see here more interesting/hard bf problems. I also like this language.

Aditya Pande: 2013-01-03 17:09:52

right now Tjandra's code seems to be using the most BF commands...

@Mostafa: i personally won't mind solving more BF challenges...not sure about everybody else
I must say awesome ASCII art .... once again....:)

Last edit: 2013-01-03 16:31:33
Mitch Schwartz: 2013-01-03 17:09:52

@Tjandra: Optimising BF interpreters (like bff used on SPOJ) don't execute commands that way, e.g. +++++ becomes a single addition of 5. So that metric doesn't seem so meaningful to me, although an interesting twist.

Edit: Another issue is that such scoring could force solvers to make many guesses about the input.

Last edit: 2013-01-03 22:45:03
(Tjandra Satria Gunawan)(曾毅昆): 2013-01-03 17:09:52

@Mostafa 36a2: How about not to shorten the code, but score= BF command executed, example:
.,.,. = 5 pts
+++++. = 6 pts
++[->+<] = 13 pts (executed command: + + [ - > + < ] - > + < ] = 13)
++[-] = 7 pts (executed command: + + [ - ] - ] = 7)
You can write your own scoring rules using spoj.h header... ;-) I think this rule is the beter than shorten the code :-D

Last edit: 2013-01-03 13:37:24
Mostafa 36a2: 2013-01-03 17:09:52

@ Aditya Pande :completely right..
when i solve classical bf problem ..
i use the worst code ..(some times 500 or 1000 bytes) i enjoy it every time ..
but challenge better for the basics like print and compare ..
(I want to set another problems about :
sum , modulo ..etc which are interesting to challenge ...(what is your opinion?))
and thanks to all :)

Aditya Pande: 2013-01-03 17:09:52

got it in 102 bytes

Last edit: 2013-01-03 11:03:33
Aditya Pande: 2013-01-03 17:09:52

i would say this is much different than the previous problem..
+1 for challenge.

-->if people feel there are too many golfing problems put it in classical with 150 byte or something apt code limit...
also there is no criteria that a SHORTEN problem can't feature in CLASSICAL or CHALLENGE....

Last edit: 2013-01-03 10:48:40

Added by:Mostafa 36a2
Date:2012-12-27
Time limit:1s-5s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BF
Resource:BF it self ^_^