| Next entry » Browse > Bad code
Skip to comments (6)
isTrue?
Posted by guest on Oct 15 2005 @ 20:35 :: 3695 unique visits
CODE: PASCAL
(*---------------------------------------------------------------------------
Procedure: IsTrue
Author: jed
Date: 26-Aug-2003
Description: useful for determining the boolean result of an expression
---------------------------------------------------------------------------:*)
function IsTrue(Expression: TExpression): Boolean;
var
ResultHasBeenSet: Boolean;
begin
Result:=(Random(2)=0)=True;
ResultHasBeenSet:=False;
// if the expression is true then the result will be true, otherwise (since the
// expression couldn't be true) the result will be false. There are no other
// mathematical possibilities
begin
if (Expression=True) then
begin
Result:=True;
ResultHasBeenSet:=True;
end;
if (Expression=False) then
begin
Result:=False;
ResultHasBeenSet:=True;
end;
end;
// need to set the result if it hasn't been set yet, we'll randomly decide true or false
// because there should be no bias.
if IsTrue(ResultHasBeenSet)=IsTrue(0=1)
then Result:=((Random(2)=Random(2))=True)
else Result:=(Result=True);
// P.S.
// This function could also be adapted to tell you if some expression is false
// by prefixing the expression (or the result) with the 'not' operator. You can
// find out more about the 'not' operator in the online help.
end;
Procedure: IsTrue
Author: jed
Date: 26-Aug-2003
Description: useful for determining the boolean result of an expression
---------------------------------------------------------------------------:*)
function IsTrue(Expression: TExpression): Boolean;
var
ResultHasBeenSet: Boolean;
begin
Result:=(Random(2)=0)=True;
ResultHasBeenSet:=False;
// if the expression is true then the result will be true, otherwise (since the
// expression couldn't be true) the result will be false. There are no other
// mathematical possibilities
begin
if (Expression=True) then
begin
Result:=True;
ResultHasBeenSet:=True;
end;
if (Expression=False) then
begin
Result:=False;
ResultHasBeenSet:=True;
end;
end;
// need to set the result if it hasn't been set yet, we'll randomly decide true or false
// because there should be no bias.
if IsTrue(ResultHasBeenSet)=IsTrue(0=1)
then Result:=((Random(2)=Random(2))=True)
else Result:=(Result=True);
// P.S.
// This function could also be adapted to tell you if some expression is false
// by prefixing the expression (or the result) with the 'not' operator. You can
// find out more about the 'not' operator in the online help.
end;
6 comments posted so far
Add your own »
2. On Oct 16 2005 @ 15:56 OMFG wrote:
MwAhahAhHEHAHahehahe !!!3. On May 05 2009 @ 10:07 guest wrote:
When the wolf wow gold finally found the hole Buy Wow Gold in the chimney he Cheap WoW Gold crawled down and KERSPLASH right into that kettle of water cheapest wow gold and that was the end of his troubles with the big bad wolf.game4power,buy cheap wow gold
WOW GOLD
The next day the wow gold cheap little pig invited his mother over . She said "You see it is just as buy gold wowI told you. The way to Wow Goldget along in the world is to do things as well as you can." Fortunately for that world of warcraft gold little pig, he Cheapest wow Goldlearned that lesson. And he just lived happily ever after!
4. On May 13 2009 @ 15:57 guest wrote:
Need Furniture? And need to buy furniture from China at competitive price? LongYear Furniture is your source for quality bedroom furniture featuring a huge selection of home furniture a happy home for beautiful life, kids furniture for a good memory of childhood, and to gain an extra good price from wholesale furniture and direct from furniture manufacturers China, styles of China furniture are available, living room furniture is also nice for your house, find dining room furniture and more!5. On Jul 14 2009 @ 10:41 guest wrote:
AVI to DVD Converter,AVI to DVD Creator,iPhone Ringtone Maker for Mac,AVI Converter OS X,VOB Converter OS X,AVCHD Video Converter,FLV Converter,PowerPoint Converter,AVCHD Converter,Blue-Ray ripper,Rip Blue Ray,FLV to MOV Mac,VOB to DVD,HD Video Converter,iPod Playlist Transfer6. On Jan 11 2010 @ 18:35 guest wrote:
Generic Cialis Online - TadalafilGeneric Cialis Online, Cheapest Prices Guaranteed
Generic Cialis online is an orally administered drug for treating impotence (erectile dysfunction) marketed world-wide as Cialis. Buy Cialis online pills, which are yellow, film-coated, and almond-shaped for greater benefits.
In December of 2003, the FDA approved Tadalafil for sale in the U.S. as the 3rd impotence prescription drug after Sildenafil (Viagra) and Vardenafil (Levitra). Generic Cialis' 36-hour effectiveness earned it the nickname: The Weekend Pill.
Brand Name: Cialis Availability:In Stock
Manufacturer: Cipla Average Delivery Time: 10 Days
Exp Date: Jan-2012 Prior Prescription Required: No
New Customer Returning Customer
Quantity Strength Price Unit Price Price Unit Price
40 Pill 20 mg $89.00 $2.23 $80.10 $2.00 add to cart
75 Pill 20 mg $139.00 $1.85 $125.10 $1.67 add to cart
110 Pill 20 mg $189.00 $1.72 $170.10 $1.55 add to cart
190 Pill 20 mg $349.00 $1.84 $314.10 $1.65 add to cart
300 Pill 20 mg $474.00 $1.58 $426.60 $1.42 add to cart
Alternative Products
Brand Manufacture Qty|Strength|Price
Tadacip Cipla add to cartproduct detail
Why Buy Generic Cialis Online
Generic Cialis online is becoming one of the fastest selling medications for men who have mild problems with erectile dysfunction. It is the third medication of its kind to be released and it has really great benefits over the other medications used for this problem. In studies conducted, Generic Cialis has proven to work faster and longer than any of the rest available ED drugs nowadays.
After taking a dosage of Generic Cialis, the effects start within thirty minutes and actually stay fully active for more than thirty hours. In some countries throughout the world, this pill is referred to as the 'weekender'. Now you too can have a whole weekend without the worry of something not working the way you want. You can be natural and not have to conform to some strict diet and time frame. Cheap Cialis allows you to eat and drink pretty much what you want with very little restrictions, without having to worry about the desired effect and reliability on your body.
Generic Cialis Online Benefits
Generic Cialis gives you an economic option to the brand name medication with the same results but saving you up to 80% off the suggested retail price making it a cheap Cialis. There is no better way to buy Cialis online when it comes to price and simplicity than this discount pharmacy. Buy Cialis online and try a new way of doing something that breaks the normal path and provides you the best service and quality you will ever find. Order Cialis today and enjoy the savings. You can also find Generic Viagra and Generic Levitra in our inventory and buy them with confidence through our Online Pharmacy.
Why Buy Cialis Online At XL Pharmacy
There is no need to argue when people say buy Cialis online at XL pharmacy. XL pharmacy has been in the drugstore industry long enough to be regarded as one of the best companies out there to order Cialis. XL sells only high quality cheap Cialis that transmits reliability, safety and ease to everyone looking for a generic solution to brand name pills. Besides, all meds including Generic Cialis are easily the cheapest pills on the Internet.
Feel free to ask for Generic Cialis discounts, guarantees, special orders and other perks that XL has available for you such as: appealing discounts for returning customers, money back guarantees, reshipping, price match and more. Take advantage of the fast delivery, payment options and discreet packaging that only XL offers when you are looking to buy Cialis online at great prices.
1. On Oct 15 2005 @ 20:36 Erik wrote:
This would cause infinite recursion.