User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 30 Oct 2002, 23:31   #1
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Delphi Help pls!

One of my little projects that im working on inbetween work, is taking an version of an existing project in delphi, and creating it as a Java Applet.

So initially im converting some of the algorithms etc into java, however, i came across this :

if (Ord(Code[i]) - MinValue - HalfRange < HalfRange)
and (Ord(Code[i]) - MinValue - HalfRange >= 0) then
Code[i] := Chr(Ord(Code[i]) - HalfRange)
else
if Ord(Code[i]) >= MinValue then
Code[i] := Chr(Ord(Code[i]) + HalfRange);

now, i understand most of that code-wise, but when it does
Code:
if (Ord(Code[i]) - MinValue - HalfRange < HalfRange)
and
Code:
and (Ord(Code[i]) - MinValue - HalfRange >= 0) then
im running into some trouble understanding order of preference (i think)

basically there are 3 integers on the left, but i cant work out which order the maths is being carried out in, as there are two minus signs and no brackets anywhere. In java i would have put brackets to indicate how the maths was happening, but here there are non. Having spoken to the guy who wrote the code originally, im no closer to understand it as i know next to nothing about delphi.

the first appears to be
a - b - c < d
but is that
(a - (b+c)) < d
or
(a-(b-c)) < d ?

If i had a copy of delphi here i'd run a small program and check, but i dont.

Can anyone help ?
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 30 Oct 2002, 23:34   #2
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: Delphi Help pls!

Quote:
Originally posted by NEWSBOT3

(a - (b+c)) < d
They're not gonna make it different from traditional left to right association.
queball is offline   Reply With Quote
Unread 30 Oct 2002, 23:38   #3
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
ta.

I know quite literally bugger all about delphi.
I guessed what most of the code i've had to convert so far has done...

This particular code is part of a small en/de coder so the client-server messages arent plaintext.

If i cant read anything i get from the server, i'll know ive buggered up, but i'd rather know first
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 31 Oct 2002, 00:24   #4
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
is 4 - 5 - 10 = 4 - (5+10) = -11
or is it 4 - 5 - 10 = 4 - (5 - 10) = 9?

thats a rhetorical question..
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 31 Oct 2002, 17:49   #5
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Quote:
Originally posted by MT
is 4 - 5 - 10 = 4 - (5+10) = -11
or is it 4 - 5 - 10 = 4 - (5 - 10) = 9?

thats a rhetorical question..
shush you
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 31 Oct 2002, 19:20   #6
Miserableman
Not a Cow
 
Join Date: Nov 2000
Location: Brighton, UK
Posts: 201
Miserableman is an unknown quantity at this point
The above is a good demonstration of why brackets = the win
__________________
<GSVsleep> cows would live a lot longer if they werent made out of steaks and leather
Miserableman is offline   Reply With Quote
Unread 1 Nov 2002, 00:50   #7
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Quote:
Originally posted by Miserableman
The above is a good demonstration of why brackets = the win
indeed, if the guy writing the delpi originally had done it, i wouldnt have had the problem..
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 09:49.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018