Javascript
Here's the basic format of all the solutions. This case returns true
if a>b
and false
otherwise:
function greaterThan(a,b){
c=a;//Copy a
while(true){
if(b==a){
return false;
}
if(b==c){
return true;
}
a++;//Approaches b if a<b
c--;//Approaches b if a>b
}
}
Warning: Since we didn't need to support the A==B
case, the next 3 solutions will lock up for those inputs. Thus, don't fill in equal or empty numbers at the prompts in the test fiddles, unless of course you like pushing red buttons that say "Do NOT push!!!"
149 chars - Fiddle: Conforms EXACTLY to specs ;)
for(A=B='A',C='B',a=c=prompt(A),b=prompt(C);b!=c++||(B=C),b!=a--||(A=C),A==B;);alert("Integer "+B+" is Greater than "+A+".\n\n\nRules : No Brainfuck.")
74 chars - Fiddle: Prompts user for 2 numbers, alerts '-1' if 1st<2nd, '1' if 2nd>1st:
for(A=0,a=c=prompt(),b=prompt();b!=c++||(A=-1),b!=a--||(A=1),!A;);alert(A)
54 chars - Fiddle: Function that takes 2 parameters and returns true
if A > B
, false
if BA < AB
, and, of course, locks up if A==B
.
function a(a,b){for(c=a;b!=++a&&b!=--c;);return b!=a;}