Flip a boolean

When you're dealing with qubits you could have

Code:
enum Qoolean
{
 True = -1,
 False,
 Both
}

:)

arty
 
Dj_Jestar said:
MVC for the win.
MVC + Obfuscation for the win. :D

Code:
class B { private $b; function gB () { if (is_bool($this->b) !== false) {
return (bool) $this->b; } else { throw new Exception ('I pity the foo that ' .
'tries to retrieve a value before they have set it!'); } } function B ($v =
null) { if (is_bool($v) !== false) { $this->b = (bool) $v; } else { throw new
Exception ('Wtf? Why are you trying to set a Boolean to anything but a ' .
'Boolean value, foo?'); } } function fB () { if (is_bool($this->b) !== false) {
$this->b = (bool) !$this->b; } else { throw new Exception ('GADDAMIT! You ' .
'can\'t flip a value that doesn\'t exist, foo!'); } } };
 
Ooh obfuscation!

Code:
$_=gehr;$£=create_function('$£',base64_decode('cmV0dXJuIHN0cl9yb3QxMygkoyk7'));switch
((bool)call_user_func($£,$_)){case$_=call_user_func($£,'gehr'):$_=false;break;case$_=
call_user_func($£,'snyfr'):$_=true;break;default:var_dump(join("",func_get_args()));}

I should brush up on my Perl.

Inquisitor said:
True, it was mainly intended as a take on the "The real WTF is..." thing on TDWTF :)

Yah :o
 
That's cheating though - using precompiled binary functions and calling them on the fly. Luckily that doesn't fall foul of the likes of the no-execute bit as Perl (like PHP) is interpreted.

Working for a company whose software assets include a COBOL compiler and interpreter-based runtime helps at times like this. :)
 
Berserker said:
Why these fora prohibit all the various swear words yet something this unspeakable manages to get through, repeated by a Don no less, is completely beyond me. Don't even mention it in jest :D
 
<?php

function _(&$_){$£=create_function('$£=0',base64_decode('cmV0dXJuIHN0cl9yb3QxMygkoyk7'));
switch($_){case call_user_func($£,'1'):$_=false;break;case call_user_func($£,''):$_=true;
break;default:var_dump(join("\n",array()));break;}}

$_ = true;
_($_);
var_dump($_);

?>

Berserker said:
That's cheating though - using precompiled binary functions and calling them on the fly. Luckily that doesn't fall foul of the likes of the no-execute bit as Perl (like PHP) is interpreted.

Working for a company whose software assets include a COBOL compiler and interpreter-based runtime helps at times like this. :)

It's just a red herring though ;)
 
I see what you did there. ;)

phykell said:
Why these fora prohibit all the various swear words yet something this unspeakable manages to get through, repeated by a Don no less, is completely beyond me. Don't even mention it in jest :D
The language is stuck in a timewarp, but there's billions of lines of code out there. Customers willing to pay six or seven digit sums to us for our software can't be wrong. Pays my salary anyway. :D
 
Berserker said:
The language is stuck in a timewarp, but there's billions of lines of code out there. Customers willing to pay six or seven digit sums to us for our software can't be wrong. Pays my salary anyway. :D
As a primarily C/C++ specialist, I'm biding my time :)
 
Let me get one thing straight. I do not write COBOL. Used to (about 10 years ago, when the company had a policy of being self-resident, but that vanished somehow).

Primarily C/C++ these days. Most of the rest of our team do Java as well, but they've not dared let me loose on that code yet (I did a Java course many moons ago, but it's not so different from C++, so I ended up helping the tutor at a few points :)).

Anyway, I digress.

Code:
F6 D0
Or, of you prefer:

Code:
34 FF
Let's see who figures that one out first. :)
 
Berserker said:
Looks like I've stumped everyone on the codes. \o/

Shall I offer a clue? :)

Could be anything (hex, part of an op code).

XOR AL, FF
NOT AL

If its x86 asm (which it looks like because both operations do the same thing).
 
Last edited:
Back
Top Bottom