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
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 6th May 2006 09:19 Edited at: 6th May 2006 09:55
@phaelax, sorry. but thats not what the challenge specified.



ive already started on his challenge.

the boats are glitchy at the moment so i remed them.
this is a pretty easy challenge with matrix commands.
well, im going to bed... its 1:18am where i am.
chow.

stargate sg-1 the one show that never gets old

Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 6th May 2006 10:37
@GG: That challenge is fine - good idea. I think we will see a fair bit of reused code from previous challenges, (me included), but that's fine as well.

@DV: Media created by the code, saved as a file and then reloaded all with in the same compilation is ok. However, you MUST be able to copy and paste the entire code from the code snippet and be able to run it, without having to download any media files.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 12:17 Edited at: 6th May 2006 12:58
Quote: "That challenge is fine - good idea. I think we will see a fair bit of reused code from previous challenges, (me included), but that's fine as well."


Thanks, we'll stick with it as stated. I'm looking forward to seeing what people come up with.

Quote: "Ric says in his rules no external media allowed!"


I included the rule as I understand it (which Ric has confirmed) so that everyone knew exactly what was allowed. In some earlier challenges I recall some people not realising it was allowable to create media, save it, and then reload it into the program. As Ric says, the crucial thing is

Quote: "However, you MUST be able to copy and paste the entire code from the code snippet and be able to run it, without having to download any media files."


Quote: "I would much like to do another short challenge such as the one we just did. Like CF said, it was fun with all the quick updates and exchange of code... "


Yes, I thought it worked well too (I would say that, of course!) and was tempted to set something similar. However, I think it's good to keep a variety of activities to help maintain a wider audience. I hope someone sets another of those short challenges soon, I suspect the gloves will be off next time ...

Edit: good start digital dude RELOADED except I couldn't find the boats. I think this will keep people going for more than a day (with luck!).

Edit2: looks like I can't read:
Quote: "the boats are glitchy at the moment so i remed them"
.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th May 2006 16:31 Edited at: 6th May 2006 16:34
here's my random terrain code so far.

F = fault formation randomization
R = completely randomized
S = smooth




Nice clouds, diamond-square algorithm i see.


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 17:21
Nice idea. I didn't think of doing it that way. Will be easier to see how the terrain is developing when it's textured.

Need to make sure it's an island in a sea though.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 6th May 2006 17:57
@Phaleax - nice!

I'd like to enter this - I'm currently working on the DB Challgnes site. Do people like the name "Da Codez" as a domain/site name? Based on the "Gimmeh teh codez"... A place where you can be "given the codez" (I KNOW ITS CORNEY!!)

Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 6th May 2006 18:04
@Green Gandalf:

[For the last challenge] It appears you stumbled on a well known probability formula, but it boggles my mind trying to figure out why it works here.
Quote: "
(10*11*12*13*14*15)/(1*2*3*4*5*6)
"


This can actually be written as (15!)/((9!)(6!)) or "15 choose 6." More information on this can be found at this website:
http://www.stat.ualberta.ca/people/schmu/preprints/article/Article.htm

This has started getting me interested. If I get the chance, I might look into why mathimatically this works.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th May 2006 18:18
(15!)/((9!)(6!))

I get 7 for an answer, unless my factorial function is wrong.




And by "15 choose 6" is that a permutation or am I misunderstanding?


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 18:22
Quote: "This can actually be written as (15!)/((9!)(6!)) or "15 choose 6.""


Which, of course, is the same as "15 choose 9". I don't know which interpretation makes it easier to see why it works in this case. If I think of a simple explanation I'll post it. There are lots of combinatorial formulae - and some of them are easy to understand when you look at a problem the right way.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th May 2006 18:26
only correlation I see is 10^6 = 1 million

Could it just be a coincidence that it gives the right answer?


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 18:38
I think it is obvious why it's "15 choose 6" when you think about it ...

(All I have to do now is convince myself that it IS obvious ... will be back soon.)
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 18:47
@Phaelax

Quote: "unless my factorial function is wrong"


'fraid so - you've exceeded the bounds of integer arithmetic in DBP. How big do you think 15! is?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th May 2006 18:57
1,307,674,368,000

Don't know why that didn't occurr to me.
All better now.



Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th May 2006 19:19
Quote: "I think it is obvious why it's "15 choose 6" when you think about it ..."


Yep - it's "obvious". It's a standard occupancy problem (from my favourite probability textbook (William Feller, Volume 1). Think of the possible digits 0 to 9 as "boxes" arranged in a row, and think of the 6 digits required as 6 balls to be placed in the "boxes". Then each 6 digit number (including zero), with the pattern required by Ric, corresponds to dropping the balls into the right boxes. For example, if there are two balls in the "0" box, 3 in the "4" box and 1 ball in the "7" box and none in the other boxes, then the number selected is 004447, i.e. 4447.

To see why "15 choose 6" is the answer, represent the 10 "boxes" by 11 bars (I) and the "balls" by 6 asterisks (*). The spaces between the bars represent the 10 boxes. A possible arrangement is
II**III*I*II*I*II, which is the number 114578. Notice that the two end bars are fixed in position, but the 9 remaining bars and the 6 asterisks can be arranged in any order. Hence we have 15 objects arranged in a row and we want the number of ways of deciding that 6 of them are asterisks with the rest bars. Guess what - this is "15 choose 6" or "15 choose 9" if you prefer.

Well, that's what mathematicians mean by obvious anyway!
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 6th May 2006 20:49 Edited at: 6th May 2006 23:21
...

stargate sg-1 the one show that never gets old
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 6th May 2006 22:00 Edited at: 6th May 2006 23:48
updated code:

things new:
boats scrapped.(100%)
trees added.(95%)
better looking(and more random) terrain.(80%)
---------------------------------------------
i know this is a competition, but any suggestions for my code???

stargate sg-1 the one show that never gets old
Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 7th May 2006 00:20
Yehaw! We're getting somewhere mathimatically!

Plus, this seems to work for all possible possibilities. Thus:

# of never decrease numbers = (b+d)!/(b!d!) - 1

where b is "type of numbers" (ie 10 for base 10, 2 for binary etc.) - 1
and d is the number of digits.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2006 00:30 Edited at: 7th May 2006 01:20
Segan

Quote: "# of never decrease numbers = (b+d)!/(b!d!) - 1"


Exactly.

@digital dude RELOADED

Will report back on your revised code shortly. Unless there are strong objections from others, I'm quite happy to offer suggestions.

Edit: no violent objections yet, so here are two comments:

1. Get in the habit of indenting commands which are within a grouping structure, such as "if", "for", "do" and "repeat" blocks. It makes your code MUCH more readable - and hence easier to de-bug.
For example, write an "if" block as:



Particularly important with "for" loops which use the same counter!

2. Have you got confused with y and z in one of your loops? (You are stepping through x and y in your matrix, but then referring to them as x and z (if z isn't set, it stays at zero) - at least I think that's what you are doing.)

Edit2: 3rd comment: Nice to have code which compiles and runs without fuss - keep it up.

Edit3: 4th comment: Have another look at your "for-next" loops. For example, you have:



I think this could be more clearly written as something like:


but you need to check whether x and y start from 0 (your code doesn't seem consistent on this). I think the first "dot" in your code is unnecessary (copied and pasted from elsewhere?).

Enough for now - good luck.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 01:28
ok, thx.

stargate sg-1 the one show that never gets old
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 02:39
Quote: "2. Have you got confused with y and z in one of your loops? (You are stepping through x and y in your matrix, but then referring to them as x and z (if z isn't set, it stays at zero) - at least I think that's what you are doing.)"

z is depth.y is height.

-------------z
------------/-------
-----------/--------
----------/---------
____________________x
--------/-----------
-------/------------
------/-------------

stargate sg-1 the one show that never gets old
Homey the Clown
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 7th May 2006 03:04
Are we doing the Island thing? If so here is mine...but I dont want to be apart of this challenge. I was just bored and decided to do this. I'm not sure if the zip file will work or not(please reply if it does).


Enjoy,
Homey

"I don't think so... Homey don't play that."
-Homey D. Clown
Intel Pentium 4 2.4Ghz processor,512MB Ram,GeForce4 MX 4000

Attachments

Login to view attachments
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 03:13
zip does work,
but sorry!!! no media allowed.

stargate sg-1 the one show that never gets old
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 04:08
screenies(not going to post updated code!!)



stargate sg-1 the one show that never gets old
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 07:03
I haven't entered these challenges for a while, so I thought I'd have a go. Here's what I have so far.



I know, it's not amazing, but it's a start.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 07:15
pretty good

stargate sg-1 the one show that never gets old
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 07:24 Edited at: 7th May 2006 07:42
screenies:
group of trees:

nice pic of dock and the water:

starting configuration:

nice overall map look:

thats all for now!


stargate sg-1 the one show that never gets old
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 07:38
nice trees, wait until I post my updated code tomorrow. right now, I have to go to sleep, it's 1:00 AM here.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 08:30
thx.

stargate sg-1 the one show that never gets old
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2006 12:40
@digital dude RELOADED

OK, I misread your code relating to the z vs y thing. However, it still looks wrong to me. The second version you posted contains the following:



At the point where the "set matrix height" command occurs, I think x must have the value 10, and z has the value 0 (because in that version of your code z is not given a value so it takes the initial vale of 0 given by the compiler). Perhaps that is what you intended?

Some interesting features are appearing on your terrain. You're the front runner so far.

@Alexb Orsova

Another promising start - but I started to get sea-sick looking at your waves! (And they look more like tsunamis.) Perhaps you could include some code to allow the viewer to move around the landscape?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2006 12:48
@Homey the Clown

Quote: "If so here is mine...but I dont want to be apart of this challenge."


Why not? The more the merrier! Modify your program to create the images itself and you'll be up and running with the rest.
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 18:04 Edited at: 7th May 2006 18:43
I'm back! Here's my updated code.



I've added bushes (help welcome), atmospheric effects (work in progress), and a sun/moon that circle above. What do all of you think?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2006 18:41
Alexb Orsova

Some nice ideas in that code. A few comments/suggestions:

1. The following bit of code might not work correctly, because the float time# might never be exactly equal to 48.



Probably safer to code it as:



2. Your screen suddenly goes black for a while at the end of the day (I thought my machine had hung!) - could you arrange a more gradual transition between night/day?

3. Waves still look big - and the texture looks a bit like a carpet!

4. Perhaps change the camera controls so the camera moves around the terrain (e.g. "control camera using arrowkeys") as well as turning.
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 18:46
@ Green Gandalf

That's what I'm working on now. Another thing that's bothering me, I can't seem to be able to make a good texture for my bushes and only one side of them appear... Anyway, thanks for the feedback.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 7th May 2006 19:42 Edited at: 7th May 2006 19:42
Only one side appears because you're using plains, use double the plains and it'll work (flip the plains so they're back to back ofcourse).

Though for something like this I'd think using an alpha mapped sphere for bushes would look better, and just a hint, they never said the trees needed leaves

Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 19:47 Edited at: 7th May 2006 19:47
@ruccus

you're right, I think I'll switch them to spheres.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 7th May 2006 20:19
On a non-challenge but challenge thread related topic, I was wondering if someone would offer to collate the challenge entries since 13th Dec 2005 Its only about 5 months and at 2 weeks per challenge, about 10 challenges.

I'm working on the site - done a LOT this weekend. I've decided to use Drupal as a CMS for a few reasons:
1) I need to learn how to use it on a coding/techie level because I have to be part of a team which is moving two high traffic sites into it next weekend with the help and tutoring of a excelent guy called Rob Douglass.
2) Its an incredibly powerfull CMS!!

The site is approaching a level where I can start putting challenges in - however I am going to have to manually brign across the previous 30 or so challenges from my current site to the CMS. Shouldn't be too hard.

So - any offers?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th May 2006 20:53
I was checking out CMS on e107.org. Seems good, but a lack of documentation.

I started adding the challenges to my site, it does take awhile to go through each page, making sure you have the last updated version of everyone's entries. Lemme know where to upload the data from and I'll try to do both at the same time.


Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 7th May 2006 20:58 Edited at: 7th May 2006 21:02
yeha - I have looked at e107 before. Its not great. Phaelax - if you want the old challenges, take a look at my site. I have them compiled already.
@Phalaex: Do you use Skype or GoogleTalk?

The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 22:55 Edited at: 7th May 2006 22:55
new trees(different leaf texture):

bigger and beter dock:


stargate sg-1 the one show that never gets old
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 7th May 2006 22:58
cool textures
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 7th May 2006 23:00 Edited at: 7th May 2006 23:02
and finally,
da codez(srry nic):

EDIT: BTW how much more time on this challenge?

stargate sg-1 the one show that never gets old
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th May 2006 23:25
I have googletalk, but I'm never on it. I pretty much stick to AIM/MSN/YIM

I've got 59 entries entered so far and just got up to the Virtual Pet challenge.

Actually, you can talk to me on google now. I got Adium on my laptop and it has googletalk in it, so I just connect to everything from 1 app. Take a wild guess what my username is.


Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 7th May 2006 23:35
Quote: "Unless there are strong objections from others, I'm quite happy to offer suggestions."


@GG: No objections at all - these challenges are meant to be educational, so any advice and suggestions offered by anyone is great to see.

Quote: "I started adding the challenges to my site, it does take awhile to go through each page, making sure you have the last updated version of everyone's entries."


@Phaelax: If you work backwards through the thread rather than forwards, you will find the last updated versions much more quickly.

Quote: "BTW how much more time on this challenge?"


@DDR: You've still got ages - it's a two week challenge, and it only started a couple of days ago. I'll be starting work on my entry this week.

@Nick: Personally, to put it subtly, 'DaCodez' isn't my favourite name. To put it less subtly, just typing it makes me cringe. Actually having to click a 'DaCodez' hyperlink may push me over the edge. ANY of the other suggestions would be better. But hey - it's your choice!! Did anyone else say they liked it?

Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th May 2006 02:54
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th May 2006 04:16
everytime i say dbshed aloud, i think dp dough and want a calzone. since im not near the campus i have to settle on pizza right now


The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 8th May 2006 04:23 Edited at: 8th May 2006 04:25
http://www.DBPResorce.com/index.htm

stargate sg-1 the one show that never gets old
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 8th May 2006 04:48 Edited at: 8th May 2006 04:50
heres a pic of it raining
does a number on fps though


stargate sg-1 the one show that never gets old
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th May 2006 06:16
i think they looks more like stars. you've really taken off on this challenge. Trees?! Raising the bar for the rest of us!


BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 8th May 2006 06:27
@Nicholas - I've also got some of the competitions since December gathered up, I will send them to you.
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 8th May 2006 07:30 Edited at: 8th May 2006 07:32
I am going to work on my challenge now

@Ric
I am using your medialess map maker, but I have one question...

Thank You!


[EDIT]By the way, can I use the #INCLUDE command to include another source file?[EDIT]

When in Trouble with anything visit here your number one stop for help

Login to post a reply

Server time is: 2024-11-24 22:33:20
Your offset time is: 2024-11-24 22:33:20