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.

Newcomers DBPro Corner / Did I learn anything?

Author
Message
Xarcolt
16
Years of Service
User Offline
Joined: 29th Sep 2007
Location:
Posted: 4th Jan 2008 22:42
I once made a random music player that I knew had plenty of flaws, but it still worked.T'was 4 months ago since I last coded (yes im very very lazy) and today I decided to re-make it. I sucsessfully shortend the code to about 1/2 its original size. I think in doing that I learned a thing or two. But what I wanna know is, did I do a good job remaking, and if not, what can I do to improve?

original(343 lines):


Remake(173 lines):


what do you think?
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Jan 2008 23:50 Edited at: 4th Jan 2008 23:51
Well, I don't quite understand why the

and


Since

and

would do just the same.

And finally, you might want to use the keyword "else" more. But that's probably just more for readability.

Else than that, you did a good job remaking the original. I'm stunned how you actually got the patience to write all percents lol...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
badrock
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: Missouri, USA
Posted: 5th Jan 2008 02:13 Edited at: 5th Jan 2008 02:16
You should be able to use something like this instead of manually typing all the LOAD MUSIC lines at the top:



--edit--

Sorry apparently I was looking at your old code, you are doing this in your new snippit. Please disregard!

DarkBASIC Pro / CodeSurge
Windows 2000 SP4 / PIII 1Ghz / 256mb
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Jan 2008 02:40
Quote: "x*1.408450704"


You could probably just do x * (100.0 / 71)

Note: Notice instead of 100 I wrote 100.0; that is because dividing an integer by an integer will result in an integer, so you might have got 1.5, whereas having one of the operands as a float will make the result a float.

Your signature has been erased by a mod
Xarcolt
16
Years of Service
User Offline
Joined: 29th Sep 2007
Location:
Posted: 5th Jan 2008 03:46
Thx 4 all the feedback, i think i should code more often.. lol

Login to post a reply

Server time is: 2024-09-27 10:24:27
Your offset time is: 2024-09-27 10:24:27