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 / - DBPro Coding Challenges -

Author
Message
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 26th Aug 2006 15:58 Edited at: 26th Aug 2006 16:01
Sure, I will get the zip file to you later today.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Aug 2006 16:05
Cheers

[center]
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 26th Aug 2006 16:14
Congrats Lower Logic, your program really was amazing. I can't wait to see the next challenge!

Do not ask what the forums can do ask what you can do for the forums.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 26th Aug 2006 20:15 Edited at: 26th Aug 2006 21:28
Thanks. I think I went crazy adding so many commands . Anyone have ideas for the next challenge?
[Edit]
Some ideas off the top of my head:
-text editor
This would be like notepad, but could easily be added to programs.

-media player
This would play mp3 files and maybe have pause, play, and stop buttons. Adding songs to a playlist would also be a plus. And if possible having a slide bar to adjust where you are in the song would be cool. Procedurally drawn visualizations would probably be a stretch but would look cool too.

-exact math functions using strings, ie:
'print add("3.025","53.1203")'
would show: "56.1453"
while 'print 3.025+53.1203' shows something like: "56.145318188".
And 'print divide("3.1","2.0")' would show: "1.55" instead of "1.54999999324618". Perhaps you could also set the number of decimal places for the answer.

-program that performs character frequency analysis and tries to decrpt text.

-Mastermind game
Particularly programming a Mastermind AI player would be an interesting challenge.

-Flight simulator

-Program that displays vector operations visually such as vector addition, subtraction, and dotproduct. It could also be a tool for finding the magnitude and angle of a vector based on it's components or vice-versa.

-Tetris. 2d or 3d game loosely based on the original Tetris game.
Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 26th Aug 2006 23:34
I'll refrain from adding what I would like to see for a challenge since as of late I have not had the time to complete anything.

http://www.cafepress.com/blackarrowgames
Check out my great stuff here
qwe
22
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 26th Aug 2006 23:58
exact math functions would be quite useful i think
KimoSabi
21
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 27th Aug 2006 02:46
I agree on the exact math functions.

Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 27th Aug 2006 03:18
The text editor, exact math functions and media player all look like fun. If we did the media player we should deffinately try to make visualizations, that would pose a challenge and look awsome!

Do not ask what the forums can do ask what you can do for the forums.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 27th Aug 2006 03:19
Actually, visualisation could be pretty cool (even without basing it on an input... just a random pretty visualisation).

[center]
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 27th Aug 2006 04:26 Edited at: 27th Aug 2006 04:35
I was trying it out and i think that the math functions would be easy,
I tried it out and i made this pretty easily. This adds two numbers exactly.

And this could easily be altered to be used for other functions.

Do not ask what the forums can do ask what you can do for the forums.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 27th Aug 2006 04:33 Edited at: 27th Aug 2006 04:43
Since the math functions would use strings to store the inputs and output, it would be a bonus to have them not rely on floating point numbers or be limited in size to the size of floating point numbers. This would make operations like divide("12345678901234567890","5.0") return the correct number in a string even though it overflows the floating point data-type, as is seen when you try print 12345678901234567890/5.0 - it returns a very large negative value. I'm guessing the exact math functions would include functions for long division ( http://en.wikipedia.org/wiki/Long_division ), long or lattice multiplication ( http://en.wikipedia.org/wiki/Multiplication_algorithm#Long_multiplication ), and lining up numbers according to their decimals for addition and subtraction.

More advance operations such as exponents would be a bonus. Raising a real number to an integer power shouldn't be to complicated as it's just repeated mutliplication. Raising a real number to a real number power would be a lot harder. Writing a squareroot function would be interesting (http://en.wikipedia.org/wiki/Square_root#Computation ). These functions, of course, wouldn't be as fast as the normal floating point functions, but they would be mainly used for calculators, and other places where exact calculation is needed, or in the case of division and squareroot, where calculation to a specific decimal place is needed.


The media player & visualization would probably require memblock commands to find the changes in volume and pitch etc. Also it could be tricky reading the memblock at the same place as the music playing. Once you figure out the structure of the sound memblock, having general purpose functions like sound_length(music_num) would be useful - I'm suprised that command doesn't come with DarkBasicPro.

Other things for this challenge could be a somewhat intelligent random selector for the playlist. The selector could weight songs that haven't played in a long time higher, giving them a greater chance of being picked next, the selector could let you rate how much you like each song and have it play songs often according to the ratings, the selector could analyze each song for the tempo and amount of changes in pitch and volume, etc, and attempt to play similar songs back to back (so you're favorite soft rock song is never followed by your favorite metal rock song) etc.

Edit:
Spopovich - nice addition function. To keep it challenging, if two entries had the same amount of exact functions (without bugs), we could speed test them so the more efficient set of functions ends up on top.
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 27th Aug 2006 04:43 Edited at: 27th Aug 2006 05:49
I take back what I said about the math being to easy, I was thinking of using a combination of stings and real numbers but it does put the limitation of size on it. The things you are talking about would be a good challenge. I vote for either the functions or music player.
Edit: The speed function test would be pretty cool, it would reall make all of us tidy up our code a little somthing I really need to work on.
Edit2: More work on the addition now it can handle anysized number and return the correct result!


Do not ask what the forums can do ask what you can do for the forums.
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 27th Aug 2006 11:23
I would go for the Text Editor, then I could try work on a text wrapping function! Something I need! media player also sounds cool!


Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Aug 2006 13:18
Quote: "then I could try work on a text wrapping function! Something I need!"


Check the codebase. I already have a text file which loads into a scrollable window with text wrapping.

Hmm, lets do that challenge!

I think a media player isn't a great choice for DBP. There's a lot of features you can add into a text editor.

I've done tetris, mastermind, and a huge mp3 player project with java. Technically I've done a text editor with java also, but i think it'd be fun in DBP. Sorta reminds me of a pascal project i did.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 27th Aug 2006 17:47 Edited at: 27th Aug 2006 17:59
We've narrowed it down to either the Music Player, Exact Math Functions, or the Text Editor.

If any one else wants to participate in the next challenge and hasn't spoken, it would help if you said which of the 3 sounds like a better challenge, as right now there is a 3-way tie, 3 votes each.

Right now I'm leaning toward the math functions.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 27th Aug 2006 19:01
Make a public post in this forum saying that a new challenge is about to start and anyone is currently able to suggest and participate. Might get some more "attendee's"

[center]
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Aug 2006 19:49
Text Editor sounds the most.. 'educational'. Music players are fun to make, but there's no challenge in playing music, it would mostly be working on visualisations, which really means it's a visualisation challenge with music in the background. Text Editors on the other hand are challenging in every aspect, even just simple typing, backspace, enter, selecting charactes, you get my drift.
The Exact Math Functions sound usefull, but not that usefull, I've never come across an occurance where (very slightly) unprecise math function have been a problem.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 27th Aug 2006 20:33
I vote for text editor...

[center]
Joe Cooning
23
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United States
Posted: 27th Aug 2006 20:44
How about a model viewer with shader support (useful for configuring your shaders and such)

lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 27th Aug 2006 22:54
**********************
TEXT EDITOR CHALLENGE!
**********************

Write a text editor.

You have 2 weeks for this challenge: August 27 - September 10 (midnight of your own time zone)

The winner will be decided based on:

-Usability. Does the program have a good response time? Does it get all the characters when the user types quickly? Is it easy to learn how to add and remove text?

-Features. Some ideas include saving/loading, word-wrapping, find&replace, copy&paste, highlighting selected text, bold, underline, italic, changing text color, font, and size, positioning the cursor with the mouse, etc.

Good luck and have fun!
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 27th Aug 2006 23:52
Sounds fun I'll get to work on it!

Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Aug 2006 05:55 Edited at: 28th Aug 2006 13:57
Here's a shot of my WIP. I don't feel like posting code yet. I don't have horizontal scrolling yet, that's next on my agenda.
currently, you can load text files into multiple windows which are movable. vertical scrolling via scrollbar or mouse wheel.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 28th Aug 2006 22:57 Edited at: 29th Aug 2006 03:52
Looking good Phaelax.
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 28th Aug 2006 23:05
Nice, I was going to start with something like that, but then I figured I'd have problems with text editing.

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Aug 2006 01:06 Edited at: 29th Aug 2006 10:52
Added horizontal scrolling and window resizing. There's also the option to display line numbers. Time for the actual text editing. Shouldn't be too difficult to insert text the way its set up.


Nothing like wasting time trying to figure out why your input routine closes the program whenever you hit spacebar only to find out its because:


"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 30th Aug 2006 06:21
I have a start on my text editor so I decided to post it. So far you can cut ctrl x coppy ctrl c and paste ctrl v, move the cursor with the mouse or left and right arow keys. It wordwraps and to select areas drag the cursor from one place to annother, the hightlighting box isnt working. As you get further down in the window it slows alot. So currently its a text editor with a little scotch tape holding it together.


Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Aug 2006 08:21
needs a little more tape.
good start. i think the hardest part for me so far was just getting the cursor to position on the text lines correctly.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Aug 2006 00:17 Edited at: 31st Aug 2006 00:19
Ok, here's mine so far. I'm taking a risk at posting this because I seem to have a tendency to stop coding my challenges after I post them. No saving or highlighting text, yet.

use openFile("filename") to create a new document. If the filename does not exist then a blank document is created. You can open multiple files viewbable from separate windows. Each window allows scrollbars with vertical scrolling cabable with the mouse wheel.

I don't suggest displaying line numbers, there's a problem with the cursor offset. I know how to fix it, just haven't gotten around to it yet.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 31st Aug 2006 03:24
...WOW that is awsome. I can see I have alot of work to do to get my editor even close. Good Luck with it and I got to go get me a whole lot o duck tape.(maybe I am overusing this mdaphor...)

Do not ask what the forums can do ask what you can do for the forums.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 31st Aug 2006 05:17
Wow, really cool. I like the windows, scrolling, etc.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Aug 2006 06:13
Hmmm, executable is 9.96mb. If I remove "sync on", "backdrop on", and "sync" the file size drops to 0.99mb. Wow, that's sad.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 31st Aug 2006 10:48
You're not using 6.2b are you? My EXE's for that are NEVER that big! How many plugins do you have?

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Aug 2006 21:43
5.8, only plugins I have extra are:
barnski's winsock - 264kb
BOS (mine for a RTS hierarchal system) - 232kb
Collision (no idea) - 149kb
d3dfunc - 88kb
darkSideProgressBar 18kb
DKShop - 42.5kb

I think when I add the sync or backdrop commands DB compiles it with every DLL it has, which is almost 15mb.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 31st Aug 2006 23:18
Hey folks, I'm back from the dead!

I survived seven weeks with the in-laws, a family holiday, a house move and a three week wait to get a telephone line connected - and finally I'm back online again. Glad to see that the challenges are still alive and kicking. Just been scrolling through the last few months I missed - darnit - I missed out on a pinball challenge! Impressive entries, though - no surprise to me that the ODE-meister won that one. Just spent the last ten minutes playing Spopvich and Phaelax's space invaders games, too - awesome stuff. And as for the LOGO interprater - that was an inspired choice for a coding challenge.

I might not have time to come in on this challenge, but it'll be business as usual on the next one probably.

Good to be back, chaps.

Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 1st Sep 2006 00:49
Nice to see you back Ric.

http://www.cafepress.com/blackarrowgames
Check out my great stuff here
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 1st Sep 2006 01:09
I'm very glad to meet the famed Ric. Glad you survived living with your in-laws and I hope to see your work on future challenges!

Do not ask what the forums can do ask what you can do for the forums.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 1st Sep 2006 05:31 Edited at: 1st Sep 2006 05:38
Hey Ric,
These summer months in the challenge thread got slow at times, with so many other summer, family things happening.

Yep, I would have loved to see a pinball entry from you. You are a tough competitor, but I love seeing your ideas, and you always do a great job.

Welcome Back!

And thanks for the compliment!
(I have also been playing around with DarkPhysics, and it is great!)
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Sep 2006 15:15
Welcome back Ric!

Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 5th Sep 2006 21:46
I've been working really hard and this is what I've come up with.

You can save or load into my own type of file or export and import into txt files. You can bold, underline, italicize, change fonts, change colors, cut, coppy, paste, highlight and backspace, and place the cursor. I start school in two days so though I'll still be programing durring the school year I want to get as much done now while I have the time. I'm open to any suggestions, I hope you like it!

Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Sep 2006 09:03 Edited at: 6th Sep 2006 09:04
Since your programs haven't displayed for me properly in the past, I just wanna make sure this looks accurate. Is there a menubar or any color behind the menu items dropdown? Cause I just get text with no window-like menus.

And the selection still seems a bit dodgy. Mostly when selecting a lot, there's a gap in the selection. Not positive, but I think it gaps in the same places every time.

The text styles is a nice touch, though I forgot to actually try them out.

I've attached a picture of how it looks on my machine.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 6th Sep 2006 10:51
Looking good Spopovich. I didn't get any spaces when highlighting text. One thing that would be nice, is if when you hold down a key, it would keep typing that character. For example, if you want to delete 20 characters, you have to keep pressing the backspace key 20 times. Very good work so far though!

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Sep 2006 17:43
I've added text selection. Easy enough to establish what should be selection, but kind of a pain to actually draw the selections. Added about 80 lines of code just for displaying the stupid text. I'm sure I can condense it though, just wanted to get it working.

Also, added a full menu bar across the top(visually more aesthetic) and a clock.

I've attached the source cause its nearly 1000 lines, and for me it gets annoying selecting all that to copy n paste.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 6th Sep 2006 19:34
The interface is very nice. One thing that was a problem was that after typing off the window it would scroll however if you were to hit the backspace key enough so that it went off the other side you get an error. Can't wait to see the final product. Oh and nice clock.

Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Sep 2006 07:58
I can't seem to reproduce any error that way. What's the error say?

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 7th Sep 2006 20:43
only positive numbers allowed at line 667 it was in this area

Though I didn't look to much through your code I did see that when you call it here your trying to find the visible text when you hit backspace the visible text might become negitive. Line 603


Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Sep 2006 21:00
insert this into line 360 (editLines function near bottom) and lemme know if it fixes the error. Though technically, I don't seen when a negative number would ever come up.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 8th Sep 2006 04:32
I tried it but it still didnt work. Let me explain again as I didnt do a very good job last time. If you type in one of your windows untill a horizonral scroll bar forms and then backspace untill the cursor goes off the window you get an error. Also I fixed a few things in mine and added a few features my favorite is the definition. Highlight a word and then goto file definition, I also added two buttons to make a selection all caps or all lowercase. Coppy, Cut and Paste now work between programs. You can now also put in special characters.


Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Sep 2006 07:29
Quote: " If you type in one of your windows untill a horizonral scroll bar forms and then backspace untill the cursor goes off the window you get an error"


That's exactly what I tried, yet I still don't get an error.

If either of the values in the substring function are negative, I could simply return an empty string then. If you wanna throw that check in and test it for me that'd be great. Without getting the error myself, I have no way of testing fixes.



I tried your latest code. Sometimes when I type, 1 or more lines will move. I think it has something to do with the wordwrap.
Nice touch with the definitions. After you said that I was like there's no way he included a dictionary file! I was considering a spell check in mine, but that'd add way too many data statements. If you try to load a file that doesn't exist, you get an error.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 8th Sep 2006 22:24
Well I just changed the function to this. I should have done this earlier.

I can't figure out why I was the only one getting that error. Whatever its the weekend the holy time back to coding!

Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Sep 2006 09:51
I added the fix, so next time I post an update you shouldn't have to worry about it. You're using 6.2, right? I'm still on 5.8, so that could be the difference.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike

Login to post a reply

Server time is: 2026-07-09 16:06:00
Your offset time is: 2026-07-09 16:06:00