473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

need a spaghetti code translator program or expert

I want to use this algorithm but can't figure it out, I never used BASIC. I
tried translating it but got lost in the gosubs and "for i - 1 to ...
nexts". I have figured out that FNU(X) is degree to radians, and FNY is a
modulo, but those are not what get me confused, it's just this section here.
Anyone in here with "old school BASIC" experience who can unravel this for
fun? :)

1740 DEF FN Y(X) = ATN(SQR(1 - X * X) / X):Y = 0:MO = 360
H(4) = fN U(MC + 180):H(1) = FN U(AS)
1745 R1 = RA + FN R(30):FF = 3: GOSUB 1770:H(5) = FN U(LO + 180
1750 R1 = RA + FN R(60):FF = 1.5: GOSUB 1770:H(6) = FN U(LO + 180
R1 = RA + FN R(120):Y = 1
1755 GOSUB 1770:H(2) = LO:R1 = RA + FN R(150):FF = 3; GOSUB 1770:
H(3) = LO
1760 FOR I = 1 TO 12:H(I) = FN U(H(I)): IF I < 6 THEN H(I) = FN U(H(I-6)
+ 180)
1765 C = H(I): GOSUB 1190:H$(I) = A$: NEXT I: RETURN
1770 X = - 1: IF Y = 1 THEN X = 1
1775 FOR I = 1 TO 10:XX = FN y(X * SIN(R1) * TAN(OB) * TAN(LA)): IF XX < 0
THEN XX = XX * PI
1780 R2 = RA + (XX /FF): IF Y = 1 THEN R2 - RA + PI - (XX / FF)
1785 R1= R2: NEXT 1:LO = ATN(TAN(R1)) / COS(OB)): IF LO < 0 THEN LO = LO +
PI
1790 IF SIN(R1) < 0 THEN LO = LO + PI
1795 LO = FN D(LO): RETURN

TIA
--
Patrick Sullivan, AA-BA, BA-IT
Nov 23 '05 #1
6 1344
Well euhhmmm ....... :-)
Like GOTO , GOSUB takes a line number to wich the interpreter will jump
however unlike GOTO with GOSUB the jump-from location is stored. At the end
of the subroutine found at the GOSUB jump-to location, you normallly place
a RETURN statement , which causes execution to resume after the GOSUB
statement.

1760 FOR I = 1 TO 12:H(I) = FN U(H(I)): IF I < 6 THEN H(I) = FN U(H(I-6)
+ 180)
1765 C = H(I): GOSUB 1190:H$(I) = A$: NEXT I:
is the same as
FOR I = 1 TO 12
H(I) = FN U(H(I))
IF I < 6 THEN H(I) = FN U(H(I-6) + 180)
C = H(I)
GOSUB 1190 REM :-) jump to line number 1190 execute all code untill you
encounter a return statement
H$(I) = A$
NEXT I
did you not see this because of the : ?? wich sperates statements that
should normally be on seperate lines ( i use this still in VB.Net as it is
to today supported )
hth

Michel Posseth [MCP]
"Patrick Sullivan" <ps****@eatel.net> wrote in message
news:EO********************@eatel.net...I want to use this algorithm but can't figure it out, I never used BASIC. I
tried translating it but got lost in the gosubs and "for i - 1 to ...
nexts". I have figured out that FNU(X) is degree to radians, and FNY is a
modulo, but those are not what get me confused, it's just this section
here.
Anyone in here with "old school BASIC" experience who can unravel this for
fun? :)

1740 DEF FN Y(X) = ATN(SQR(1 - X * X) / X):Y = 0:MO = 360
H(4) = fN U(MC + 180):H(1) = FN U(AS)
1745 R1 = RA + FN R(30):FF = 3: GOSUB 1770:H(5) = FN U(LO + 180
1750 R1 = RA + FN R(60):FF = 1.5: GOSUB 1770:H(6) = FN U(LO + 180
R1 = RA + FN R(120):Y = 1
1755 GOSUB 1770:H(2) = LO:R1 = RA + FN R(150):FF = 3; GOSUB 1770:
H(3) = LO
1760 FOR I = 1 TO 12:H(I) = FN U(H(I)): IF I < 6 THEN H(I) = FN U(H(I-6)
+ 180)
1765 C = H(I): GOSUB 1190:H$(I) = A$: NEXT I: RETURN
1770 X = - 1: IF Y = 1 THEN X = 1
1775 FOR I = 1 TO 10:XX = FN y(X * SIN(R1) * TAN(OB) * TAN(LA)): IF XX < 0
THEN XX = XX * PI
1780 R2 = RA + (XX /FF): IF Y = 1 THEN R2 - RA + PI - (XX / FF)
1785 R1= R2: NEXT 1:LO = ATN(TAN(R1)) / COS(OB)): IF LO < 0 THEN LO = LO +
PI
1790 IF SIN(R1) < 0 THEN LO = LO + PI
1795 LO = FN D(LO): RETURN

TIA
--
Patrick Sullivan, AA-BA, BA-IT

Nov 23 '05 #2
Patrick Sullivan wrote:
I want to use this algorithm but can't figure it out, I never used
BASIC. I tried translating it but got lost in the gosubs and "for i -
1 to ... nexts". I have figured out that FNU(X) is degree to
radians, and FNY is a modulo, but those are not what get me confused,
it's just this section here. Anyone in here with "old school BASIC"
experience who can unravel this for fun? :)

1740 DEF FN Y(X) = ATN(SQR(1 - X * X) / X)


That's the entire definition of FNY. Just use Math.Acos(X) instead, as
that's what that function does. I'm not sure what the rest of the line is
doing there. Is there a GOSUB 1740 anywhere else in the program?

The rest of the code you show is part of the program. I'm slightly surprised
that there's a DEF FN in what appears to be the middle of it.

For the rest, split it into separate lines at the colons and in-line the
parts that would have been GOSUBs.

So, everywhere you have GOSUB 1770, replace it with

X = - 1
IF Y = 1 THEN X = 1
FOR I = 1 TO 10
XX = Math.Acos(X * SIN(R1) * TAN(OB) * TAN(LA))
IF XX < 0 THEN XX = XX * PI
R2 = RA + (XX /FF)
IF Y = 1 THEN R2 = RA + PI - (XX / FF)
R1= R2
NEXT I
LO = ATN(TAN(R1)) / COS(OB))
IF LO < 0 THEN LO = LO + PI
IF SIN(R1) < 0 THEN LO = LO + PI
LO = FND(LO)

What's the algorithm for? Something better might have been discovered since
it was written.

Andrew
Nov 23 '05 #3
1740 DEF FN Y(X) = ATN(SQR(1 - X * X) / X)
That's the entire definition of FNY. Just use Math.Acos(X) instead, as
that's what that function does. I'm not sure what the rest of the line is
doing there. Is there a GOSUB 1740 anywhere else in the program?
Oh, wow, I did not even notice that function doesn't get called. That's the
kind of headache this gave me. I did try translating it, but I eneded up
with "nexts" in functions or subroutines that were not even in the same
block. So I wanted to make the whole thing one sub that doesn't call other
subs, except for the decimal to radians function.
The rest of the code you show is part of the program. I'm slightly surprised that there's a DEF FN in what appears to be the middle of it.

For the rest, split it into separate lines at the colons and in-line the
parts that would have been GOSUBs.

So, everywhere you have GOSUB 1770, replace it with
Thanks, I don't know how long it would have taken me to figure that out.
X = - 1
IF Y = 1 THEN X = 1
FOR I = 1 TO 10
XX = Math.Acos(X * SIN(R1) * TAN(OB) * TAN(LA))
IF XX < 0 THEN XX = XX * PI
R2 = RA + (XX /FF)
IF Y = 1 THEN R2 = RA + PI - (XX / FF)
R1= R2
NEXT I
LO = ATN(TAN(R1)) / COS(OB))
IF LO < 0 THEN LO = LO + PI
IF SIN(R1) < 0 THEN LO = LO + PI
LO = FND(LO)

What's the algorithm for? Something better might have been discovered since it was written.
It's one of the only publicly available algorithms for figuring house cusps
in a horoscope in the Placidus method. That method takes 3 great circles
around the celestial zodiac and subdivides them, but then uses some
numerical method that is supposed to be iterated until the cusps don't
change anymore, but this method only uses a few iterations, and disregards
the small resulting error.

Far as I can tell, this same algorith is used in all the public domain
programs that have the source code available (astrolog), and is probably
used in the commercial programs, too. But the astrolog guy translated his
version into C that looks nearly as bad as this BASIC version (lots of
global variables with unknown definitions), so I bought the original BASIC
program listing for $20, and this is the only thing I wanted out of the
entire book. I know a dozen methods for calculatiing planetary positions.
There is also a dll in the Swiss Ephemeris that can calculate ALL the stuff
(sweph), but that's unmanaged code and I don't want to take the time to
learn all the calls for that. Thanks for your help.
Patrick
Andrew

Nov 23 '05 #4

Patrick Sullivan wrote:
[snip]
What's the algorithm for? Something better might have been discovered

since
it was written.


It's one of the only publicly available algorithms for figuring house cusps
in a horoscope in the Placidus method. That method takes 3 great circles
around the celestial zodiac and subdivides them, but then uses some
numerical method that is supposed to be iterated until the cusps don't
change anymore, but this method only uses a few iterations, and disregards
the small resulting error.


<http://www.widgetsworld.co.uk/search/go.php?art_id=2073> is in PHP but
you don't need to know PHP to parse it. Looks vaguely similar to what
you have, even.

Personally only equal house makes any sense, but each to their own :)

--
Larry Lard
Replies to group please

Nov 23 '05 #5
Thanks, Larry.

Probably the reason I did not find this is "Placidus domification system." I
never heard it called domification before! php, looks like it uses a lot of
dollar signs. I have that somewhere in my computer, so I can read the
documentation.

--

Patrick Sullivan, AA-BA, BA-IT

"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

Patrick Sullivan wrote:
[snip]
What's the algorithm for? Something better might have been discovered

since
it was written.


It's one of the only publicly available algorithms for figuring house cusps in a horoscope in the Placidus method. That method takes 3 great circles
around the celestial zodiac and subdivides them, but then uses some
numerical method that is supposed to be iterated until the cusps don't
change anymore, but this method only uses a few iterations, and disregards the small resulting error.


<http://www.widgetsworld.co.uk/search/go.php?art_id=2073> is in PHP but
you don't need to know PHP to parse it. Looks vaguely similar to what
you have, even.

Personally only equal house makes any sense, but each to their own :)

--
Larry Lard
Replies to group please

Nov 23 '05 #6
m.posseth,

I answered you but the message disappeared into hyperspace I suppose, or
else the NSA snagged it. Thanks for the help. I will post what I figured out
in here when I get it working. So far it looks like I have about 6 functions
and subs and about 20 global variables.
--

Patrick Sullivan, AA-BA, BA-IT

"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
Well euhhmmm ....... :-)
Like GOTO , GOSUB takes a line number to wich the interpreter will jump
however unlike GOTO with GOSUB the jump-from location is stored. At the end of the subroutine found at the GOSUB jump-to location, you normallly place a RETURN statement , which causes execution to resume after the GOSUB
statement.

1760 FOR I = 1 TO 12:H(I) = FN U(H(I)): IF I < 6 THEN H(I) = FN U(H(I-6)
+ 180)
1765 C = H(I): GOSUB 1190:H$(I) = A$: NEXT I:


is the same as
FOR I = 1 TO 12
H(I) = FN U(H(I))
IF I < 6 THEN H(I) = FN U(H(I-6) + 180)
C = H(I)
GOSUB 1190 REM :-) jump to line number 1190 execute all code untill you
encounter a return statement
H$(I) = A$
NEXT I
did you not see this because of the : ?? wich sperates statements that
should normally be on seperate lines ( i use this still in VB.Net as it is
to today supported )
hth

Michel Posseth [MCP]
"Patrick Sullivan" <ps****@eatel.net> wrote in message
news:EO********************@eatel.net...
I want to use this algorithm but can't figure it out, I never used BASIC. I tried translating it but got lost in the gosubs and "for i - 1 to ...
nexts". I have figured out that FNU(X) is degree to radians, and FNY is a modulo, but those are not what get me confused, it's just this section
here.
Anyone in here with "old school BASIC" experience who can unravel this for fun? :)

1740 DEF FN Y(X) = ATN(SQR(1 - X * X) / X):Y = 0:MO = 360
H(4) = fN U(MC + 180):H(1) = FN U(AS)
1745 R1 = RA + FN R(30):FF = 3: GOSUB 1770:H(5) = FN U(LO + 180
1750 R1 = RA + FN R(60):FF = 1.5: GOSUB 1770:H(6) = FN U(LO + 180
R1 = RA + FN R(120):Y = 1
1755 GOSUB 1770:H(2) = LO:R1 = RA + FN R(150):FF = 3; GOSUB 1770:
H(3) = LO
1760 FOR I = 1 TO 12:H(I) = FN U(H(I)): IF I < 6 THEN H(I) = FN U(H(I-6)
+ 180)
1765 C = H(I): GOSUB 1190:H$(I) = A$: NEXT I: RETURN
1770 X = - 1: IF Y = 1 THEN X = 1
1775 FOR I = 1 TO 10:XX = FN y(X * SIN(R1) * TAN(OB) * TAN(LA)): IF XX < 0 THEN XX = XX * PI
1780 R2 = RA + (XX /FF): IF Y = 1 THEN R2 - RA + PI - (XX / FF)
1785 R1= R2: NEXT 1:LO = ATN(TAN(R1)) / COS(OB)): IF LO < 0 THEN LO = LO + PI
1790 IF SIN(R1) < 0 THEN LO = LO + PI
1795 LO = FN D(LO): RETURN

TIA
--
Patrick Sullivan, AA-BA, BA-IT


Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: steve | last post by:
Hi, Recently I have been looking at the various ways people are implementing, interaction between java & oracle databases. I was always instructed on the purity of the data model, "normalize...
2
by: Megat | last post by:
I'm trying to create a conversion program, that convert a simple proprietry programming language to an international standard languange, using Visual C++. Need some help from those who has...
48
by: Chad Z. Hower aka Kudzu | last post by:
A few of you may recognize me from the recent posts I have made about Indy <http://www.indyproject.org/indy.html> Those of you coming to .net from the Delphi world know truly how unique and...
7
by: CoreyWhite | last post by:
You know what I have to say to the giant spaghetti monster? Do you want to know? Do you? Well I'm tired of sucking on your spaghetti and chewing on your fresh meat balls! It isn't only about...
4
by: AViS | last post by:
Hi, I am building a language translator, that must convert input from source languages to a language neutral format in XML. This XML must be read by the target language translator and produce the...
20
by: Victor Smootbank | last post by:
I did program in BASIC for more than 20 years and for me it's still the ultimate programming language. Unfortunately, I was forced to upgrade to C++ and now I'm confused. While programming in...
40
by: Campy Happer | last post by:
Hello all, I would like to bring to your attention a concept and a term for it that I think is long overdue. But first: In the bad old days of programming, before subroutines were even...
5
by: Bob Nelson | last post by:
My interest in this new topic was piqued by santosh's recent posting concerning the subject of ``diagnostic message'' here in clc. After reading the C99 standard (``n1256.pdf''), I am unclear if...
2
by: forums_mp | last post by:
Facing a design problem here and I'm not sure how to solve this. The system consists of bi-directional communication between a subject communicating with two (at least for now ) listeners. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.