Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Bug in Dark Basic Pro?

Author
Message
Programmer X
18
Years of Service
User Offline
Joined: 14th Nov 2007
Location:
Posted: 20th Mar 2015 23:34
Rem Project: Print array
Rem Created: Friday, January 10, 2014

Rem ***** Main Source File *****
dim convtoX(16,16)
dim convtoY(16,16)
dim convtoZ(16,16)
dim convtoU(17,17,17)
dim convtoV(17,17,17)
dim halffourfirst(16)
dim halffoursecond(16)
dim sixsplitfour(64)
dim sixmodulustwo(64)

rem (A/H*A/H)/O/H
for u=1 to 16
for t=1 to 16
convtoX(t,u)=((16.0*cos(90.0/16*u)/tan(90.0/16*t)))%%16+1
if convtoX(t,u)<0 then convtoX(t,u)=0
convtoY(t,u)=((16.0*cos(90.0/16*u)/tan(90.0/16*t)))%%16+1
rem convtoY(t,u)=((16.0/90*atan(cos(90.0/16*u)*(tan(90-(90.0/16*t))))))%%16+1
if convtoY(t,u)<0 then convtoY(t,u)=0
convtoZ(t,u)=u
if convtoY(t,u)<0 then convtoY(t,u)=convtoY(t,u)+16
if convtoZ(t,u)<0 then convtoZ(t,u)=convtoZ(t,u)+16
next t
rem error here
halffourfirst(u)=(floor(((u)/4)))+1
rem
halffoursecond(u)=(u+1)%%4
next u



for s=1 to 64
sixsplitfour(s)=s%%16
sixmodulustwo(s)=floor(s/16)
rem sixmodulustwo(s)=0
ERROR HERE: delete this when i set this to zero i get a previous value
if sixmodulustwo(s)<1 then sixmodulustwo(s)=sixmodulustwo(s)+4
next s

for u=1 to 16
for t=1 to 16
for s=1 to 16
rem if convtoX(i,j)=s and convtoY(i,j)=t and convtoZ(i,j)=u
ang=1
ansa=800
ansb=800
ansc=800
checkang=800
repeat
ansa=abs(convtoX(ang,16-s)-u)
ansb=abs(convtoY(ang,16-s)-t)
ansc=abs(convtoZ(ang,16-s)-s+16)
ang=ang+1
if ang>16
ang=finalang
goto finish
endif
if checxang<(ansa+ansb+anc)
finalang=ang
endif
checkang=ansa+ansb+anc
until ansa+ansb+anc=0
finish:
convtoV(s,t,u)=ang
rem float#=16.0/90*(acos(cos(90.0/16*s)/cos(90.0/16*u)))
rem convtoU(s,t,u)=abs(16.0/90*(asin((16.0*cos(90.0/16*s)/cos(90.0/16*convtoV(s,t,u))%%16/16))))%%16
convtoU(s,t,u)=16-u
rem z=16-u u=16-z s=x z=u
next s
next t
next u
rem 6,6-> (1-4byte table split) (union gpu 2tev)->4,4,4->ram(16kb table)->4,4
rem 6,6<-split middle(2 4byte table ram),(union gpu 2tev each)<-ram(2 1kb table)<-4,4
rem space 2 kb
remstart
1357
is even
is<8
<2 <4 <6
>12 >14 >15
remend
remstart
for a= 1 to 63
for b= 1 to 63
for i=1 to 15
for j=1 to 15
d=sixmodulustwo(a)
e=sixmodulustwo(b)
aa=sixsplitfour(a)
bb=sixsplitfour(b)
c=unionfour(d,e)
ccc=convtoV(aa,bb,c)
ddd=convtoU(aa,bb,c)
aa=i
bb=j
c=convtoZ(ccc,ddd)
d=halffourfirst(c)
e=halffoursecond(c)
q=unionsixa(aa,d)
r=unionsixb(bb,e)
if q=a and r=b
convtoX(ccc,ddd)=i
convtoY(ccc,ddd)=j
endif
next a
next b
next i
next j
remend
a=2
b=1
print a
print b
d=sixmodulustwo(a)
e=sixmodulustwo(b)
print d
print e
aa=sixsplitfour(a)
bb=sixsplitfour(b)
c=unionfour(d,e)
print c
ccc=convtoV(aa,bb,c)
ddd=convtoU(aa,bb,c)
print ddd
aa=convtoX(ccc,ddd)
bb=convtoY(ccc,ddd)
print aa
print bb
c=convtoZ(ccc,ddd)
print c
d=halffourfirst(c)
e=halffoursecond(c)
print d
print e
q=unionsixa(d,aa)
r=unionsixb(e,bb)
print q
print r
wait key
end
function unionsixa(a,b)
rem (4*a)
rem 4*tev1+1/4*b
rem 2 tev
ans=((4*a)+b)
endfunction ans
function unionsixb(a,b)
rem (4*a)
rem 4*tev1+1/4*b
rem 2 tev
ans=((4*a)+b)
endfunction ans



function unionfour(a,b)
rem 4*a+1/4*b
rem 1 tev
ans=(4*a+b)%%16
endfunction ans

XXX
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 21st Mar 2015 00:14
Just a tip: tell us what you are doing, what your expected result is and what the actual result you are getting is. A page of code with no further explanation isn't going to attract many replies, especially with such a vague topic as "bug". What kind of bug?
Also you can surround your code with [ code lang = dbpro ] <code here> [ /code ] tags to get syntax highlighting and better formatting of your snippet, making it more easily readable

Attila
FPSC Reloaded TGC Backer
21
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 21st Mar 2015 20:15 Edited at: 21st Mar 2015 20:16
some hints:

2. Use <code lang=dbpro> </code> tags to put the code in a code window and indent the code to make it readable.

2. try to write down what you expect your code to do and what happens.

kind regards
Attila
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 21st Mar 2015 21:02 Edited at: 21st Mar 2015 21:08
(I surmise he expects it not to crash, which it does.)

1. Eliminate the illegal lines 39 and 165

2. Convert the arguments for the FLOOR expressions in lines 28 and 37 to floating values, not integer expressions, respectively:

halffourfirst(u)=(floor(((1.0*u)/4.0)))+1

sixmodulustwo(s)=floor(1.0*s/16.0)

The crash errors I was getting from your code were eliminated by doing the above. However, I have no idea whether the screen output the program then produces is what you expect.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 23rd Mar 2015 22:37
I'm tempted to share my 10,000 + lines of code project in plain text to see if the forum can handle it

Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2026-07-11 18:27:36
Your offset time is: 2026-07-11 18:27:36