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 Discussion / The DB Classic Programming Challenge Thread

Author
Message
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Oct 2007 00:54 Edited at: 14th Oct 2007 00:56
Don't forget that in my program I'm viewing the dice from the front. Are you?

If my program didn't work I wouldn't have posted it!

It does display six random dice sides right?

TDK_Man

Binary Coder
19
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Queensland, Australia
Posted: 14th Oct 2007 01:37
Congrats TDK!

Hmm... This is a bit baffling, i can't think of anything creative!

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 14th Oct 2007 03:25
@TDK
aaaaah you're making me do 3D man!
haha jk I'll handle it

Something original with dice? YAHTZEE! that was pretty original

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 14th Oct 2007 11:12 Edited at: 14th Oct 2007 11:33
Quote: "Don't forget that in my program I'm viewing the dice from the front. Are you?"

Aaah, there goes any reputation of intelligence that I may ever have had.
Thanks TDK.

EDIT: Ok, with that II can basically give in my entry. It's an example really, not a game, 'cause 3D and visuals are my strong point, not the basic stuff like variables and arrays and that sort of thing. I may work on this later.



Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 14th Oct 2007 21:26
Are we allowed to change up the function abit. I have an idea for this challenge, but i am not sure i will be able to do it. My idea was taken from a mario party 5 minigame. fist the opponent goes up and hit three dice, one at a time. The middle dice is a +,-,*, or / sign and the two on the end are numbers. The results are added up and then the player goes and does the same thing. The won with the highest result wins. Other people are welcome to try this idea as i may have trouble along the way cause i am a noob, sort of, and if others are doing this they can help me figure some thigs out on the way. Great challenge TDK. I think its easy enough to do, and i can learn from it. If i cant advance on this idea, i wiil ask for help later.

Future programming master.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 14th Oct 2007 23:05
@Tone
You could just make the operator (*,/,+,-) dice yourself and that would be within the specs.

luke810
19
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 14th Oct 2007 23:23
Quote: "the two on the end are numbers"


Then use TDK's function for the two numbered dice and another function for the third die.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Oct 2007 23:24 Edited at: 15th Oct 2007 00:12
Quote: "Are we allowed to change up the function abit."


Strictly speaking the idea is to create something from the supplied function so you shouldn't change it. However, if you want to change the dice graphics to something else then I suppose that's OK - as long as everyone else agrees.

Writing your own 'dice' function wouldn't be allowed because the challenge is to use the one I supplied.

Actually, I was expecting a rash of Yahtzee or Poker Dice type games. A pretty screensaver is acceptable too...

Quote: "fist the opponent"


Ooh.. I don't like the sound of that!

TDK_Man

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 14th Oct 2007 23:58
OBese is right though... just leave the function as it is, use it for 2 dice, and then using your own function make a dice for the middle...

http://jamesmason01.googlepages.com/index.htm
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Oct 2007 00:14 Edited at: 15th Oct 2007 00:18
Quote: "using your own function make a dice for the middle..."


Oh right I see - use another function as well... Yes - that's perfectly OK!

Actually, just copy the function I supplied and modify the texture making routines. (I don't know if you've looked at the function closely, but it's not a normal DB cube (you can't texture all six sides of a DB primitive with different textures).

TDK_Man

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 18th Oct 2007 01:01
Quote: " [quote]"fist the opponent""
Ooh.. I don't like the sound of that![/quote]
haha, i hadnt noticed that.Yeah, i am going to use another function as well. I tried to start already, but i am not having much succes. i will post back when i get something working if indeed i do.

Future programming master.
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 20th Oct 2007 02:15
Sorry guys I haven't been online, my internet was down for a strange reason (lol I did like 10 virus checks), but now I have it back!! To bad in that whole period I forgot to copy the dice function in my projects folder.

how do you make a sig?
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 23rd Oct 2007 00:52
Here is the start of my entry, but i am having some trouble with some things.



1.The second and third die dont totate too well.
2.How do i store the number on the face of each dice so i can do the math and compare it to the num2beat variable.

If anyone could help me i would appreciate it, and if not then i will try my best to finish it. This is barely the second challenge i enter, even though i have been following them since the beggining, but i didnt enter my other entries because they were just really bad. Hopefully this one is all right.

Future programming master.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 23rd Oct 2007 06:53
Quote: "Challenge closes: 20th October at midnight GMT (Saturday Night).
"


???? I was looking for the winner, but didn't see one or an extension/change to the challenge. Did I miss something?

LB
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 23rd Oct 2007 12:35
I expect TDK's been called off to something. Who does that mean needs to decide the winner/s? Although as far as I can see I'm the only one who's entered...

the rabi, Nancy DrewG and Sudoku Arts.

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 23rd Oct 2007 12:46
Yeah what happened? This just sort of died...

http://jamesmason01.googlepages.com/index.htm
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Oct 2007 23:11
Sorry - major power and internet problems here in Tenerife this week.

Only just been able to get on properly for days.

Anyway, INH had the only entry as I can see, so his cup and two dice win - even though he didn't change my reading the dice from the front - I doubt they'd let you read the dice that way in Vegas!

Anyway as no-one else bothered attempting the challenge (shame on all of you), it's over to INH to set the next challenge.

TDK_Man

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 23rd Oct 2007 23:12
Uh... uh.... uh....
I'll get back to you on that...
Help...

the rabi, Nancy DrewG and Sudoku Arts.

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 23rd Oct 2007 23:17
Ok (I've been noobslaped so I can't edit my post, sorry)
Write a drawing program - but not a program that lets the user draw, a program that shows a image draw by only DB's drawing or 3D commands!
The most high quality drawing is the winner... but, Bonus points for
*The program drawing (in a realistic way) the image in real-time
*The drawing being 3D (I don't know how you'd implement this, but let's see your creative side, perhaps a better name would be 'scene program')
*The drawing being 'realistic'.

This isn't really a test of basics coding abilitys, more of patients and skillz with images.

Good luck guys.

the rabi, Nancy DrewG and Sudoku Arts.

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 24th Oct 2007 03:09
Sorry TDK I really couldn't think of anything original to do with that die.
Have the rules changed since DBC v1.2 is now released?

@INH
Do you mean a program that uses an image to draw from?
The user would have to be able to draw the image first, as you can't load files.

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 24th Oct 2007 04:22
So mine wasnt considered an entry? Oh well it wasnt finished anyways and INH's was better as well. I know it was after the deadline but the judge hadnt said anything and as TDK previously pointed out that contestants could make use of that time. I dont really understand the new challenge. does it mean do make a drawing using DB's basic 2d commands?

Future programming master.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 24th Oct 2007 05:23
INH

Have you thought about a deadline for this? Didn't see one in the challenge post.

LB
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 24th Oct 2007 11:27
Ooops...
Saturday the 3rd of November, midnight GMT.
@OBese87
The idea is basically that you (As in the programmer) draws a picture using DB's native drawing commands.

the rabi, Nancy DrewG and Sudoku Arts.

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 24th Oct 2007 13:42
hmmm. I'm graphically r3tarded. I might give it a go though. Haven't really been on DarkBASIC in a few days, just been spending my entire life on the forums instead

And I didn't enter for much the same reason as OBese.

http://jamesmason01.googlepages.com/index.htm
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 24th Oct 2007 15:05
Quote: "I'm graphically r3tarded"

Don't say that!
Quote: "Haven't really been on DarkBASIC in a few days, just been spending my entire life on the forums instead"

Same here...

the rabi, Nancy DrewG and Sudoku Arts.

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Oct 2007 02:36 Edited at: 27th Oct 2007 03:37
@Tone3e

Quote: "So mine wasnt considered an entry?"


It was probably the timing - even though it hadn't been judged yet, I think your entry might have been a little late.



Enjoy your day.
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 27th Oct 2007 12:06
Is that your entry latch? Very clever, especially for such small code. 3D from dots. Mmmm.

Your signature has been erased by a mod
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 27th Oct 2007 20:23 Edited at: 27th Oct 2007 20:24
Nice work Latch!

I've just finished this sand simulation today and well, it sort of draws (after you've set things up anyway). So I'll enter it

Entry: Sand!


I've just realised I never use CLS in this code! Is that a problem?

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Oct 2007 21:30
@OB
Quote: "Nice work Latch!"

Thank you.

That sand pouring is really great! I wonder if there is a way to store the order of which cells "turn on" so you don't have to test the conditionals every time through the draw loop. The setup would be before the actual drawing. Maybe this order would be stored in an array, and then in a game, you only have to loop through the array so it would be faster than testing the conditionals.

@INH
Yup, that's an entry.
Quote: "Very clever, especially for such small code"

Thank you.

Here's an updated version - I just changed the color a bit so the "inside" of the tunnel is more visible:



And here's some goofball eyes that follow the mouse pointer:



Enjoy your day.
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 27th Oct 2007 22:59
@OBese87
That is pure genius! Very cool.
@Latch
Yep that addition helps it along nicely.
Ah, and the good old goofy eyes.

Nya!
Well, yes but - wait, what?
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 28th Oct 2007 04:27 Edited at: 28th Oct 2007 04:29
This is the start if my entry. Its a 3d perspective drawing of some buildings. I might add some details like doors and windows as well as some different sized buildings.


It is when I am weak, when I am truly strong.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 28th Oct 2007 22:23
@Tone3e

(thought I posted this but it seems to have disappeared)

Starting to look good!

Enjoy your day.
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 28th Oct 2007 23:46
@Tone3e
I'll have a look tomorrow, I've got a busy schedule just at the moment.

Nya!
Well, yes but - wait, what?
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 29th Oct 2007 17:43
my entry

first one to gues what it is gets the honor

Don't look at my sig!
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 29th Oct 2007 22:30
@Tone3e
Looks quite nice, I can see you're using the envelope effect.
@Link102
Bubbles! I get the honor.
Unless it's like, sperm gone wrong. Nice anyway.

Nya!
Well, yes but - wait, what?
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 29th Oct 2007 23:57
I dont really know what that is but ok. And link is that supposed to be cells. I need some help. In my program, I wanted to make lines to separate the building and I also wanted to color in doors and such, but for that I need to know the y value at certain points in the lines that lead to the origin.(400,300) I had an idea and was almost sure it would work which involved making a function and implementing the slope formula and the y slpoe form to figure out that y value, but it dint work. I erased it already but it went sort of like this.

where x1,y1 is the initial point and y1 is the ending x value. I think that maybe the parenthesis were placed wrong or something i dont know how to make it work. If i cant figure it out then I am afraid I cant add to my entry. If anyone could help me I would appreciate it.

It is when I am weak, when I am truly strong.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 30th Oct 2007 02:30
Quote: "y2=abs([m*(x1-x2)]-y1)
m=abs[(-y1+300)/(x1-400)]"


You can't use square brackets in a formula. You should use normal brackets - ( and ).

You also can't refer to a variable in negative format. Use:

m=abs(((0-y1)+300)/(x1-400))
y2=abs((m*(x1-x2))-y1)

instead...

TDK_Man

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 31st Oct 2007 04:22
Thanks TDK, I figured out thanks to you. Here is an updated version. I might change something like color or maybe even size, but I dont want to do too much to it since it has already taken so much of my time.


It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 31st Oct 2007 23:21
@Tone3e
I've added some functions to your code that you can use to make it a little smoother, they are quite slow though so I had to remove the loop and only draw once.
I messed up the sun but I actually quite like it like that



can anyone tell me why you can see the cpu drawing when the sync is after all that?
I thought that's what sync was for!

"You must be someone's friend to make comments about them." - MySpace lied.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Nov 2007 00:51 Edited at: 1st Nov 2007 01:05
Quote: "can anyone tell me why you can see the cpu drawing when the sync is after all that?"


Sync is meant for syncronising the 3D scene - not 2D. Plus the fact that 2D is so slow. But, having looked at it a little closer, there's something odd going on...

A little trick in 2D is to use Set Gamma to 0 before starting the drawing and then turn it back on when it's finished.

[Edit] On closer inspection, there's something screwy going on with some of those functions - not sure what though... possibly some command used was forcing a Sync...

Any way, I'm not sure what the functions were actually being used for as you don't need them. I re-did it without them and you no longer see anything being drawn.

The version with only one function:



TDK_Man

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 1st Nov 2007 01:09
OH! you just have to basically create a picture

I thought you had to show the computer drawing it step by step :S

I might actually try and enter this then...

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Nov 2007 02:23
@TDK
ha, that's a very sneaky way of solving the problem. looks good.
I kinda liked my accidental sun but that's up to tone3e.
those functions were my add-ins so blame me for the weirdness

Quote: "Any way, I'm not sure what the functions were actually being used for as you don't need them."

@round - rounds a float to nearest whole number.
@dline - draws a line in dots (seems to make neater lines than DBs command, but is very slow)
@dcircle - draws a circle in dots: each circle has 360 dots so larger circles will have gaps.

here's TDK's version but with my sun


I added a second bitmap to draw to, it sped it up amazingly!

"You must be someone's friend to make comments about them." - MySpace lied.
demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 1st Nov 2007 02:34
does anyone know how to make a code which basically says if a point x,y is between a line of angle q degrees from point 640,0 and another line of angle r degrees then do whatever the code is?

Sorry I'm not explaining this well but I don't know how to really. I feel like a right noob now I think it has something to do with vectors, but that's just a hunch as I don't know what vectors are and how to use them...

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Nov 2007 04:18
@demon
what are you trying to do?
what is the result of all that? (sometimes easier to work back)

"You must be someone's friend to make comments about them." - MySpace lied.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 1st Nov 2007 09:02
@demons breath

Maybe something like this?



Enjoy your day.
demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 1st Nov 2007 10:17 Edited at: 1st Nov 2007 10:18
sorry I was quite tired and a little drunk. What I actually wanted to do is to only draw certain segments of a circle. Latch, can you explain how your code works? I don't want to use the code without really understanding it, you know...

Thanks for the help, and sorry for not being clearer with my query

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Nov 2007 16:39 Edited at: 1st Nov 2007 17:06
like this?


or like this?


same code with TDK style trickery


"You must be someone's friend to make comments about them." - MySpace lied.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 1st Nov 2007 17:48 Edited at: 1st Nov 2007 17:51
@demon

Quote: "Latch, can you explain how your code works?"

Sure. There is a starting point in the upper right hand corner (639,0). Two lines are drawn - one down and towards the left, and one a little closer to straight down.

The atanfull() function returns the angle formed connecting two points. The order of the points determines the direction of a vector and thus the angle. For each angle, I start at (639,0) and stop at either of the line ends (either x2,y2 or x3,y3) so the equation from x1,y1 to any of the other point looks like
atanfull(y2-y1,x2-x1), or atanfull(y3-y1,x3-x1)

I do the same type of calculation using the mousex() and mousey() position to get the angle the mouse pointer is relative to (639,0).

Once I have the mouse angle, I compare it to the other two angles. If it is an angle that falls in between them, then I know the point the mouse pointer is at is between those two angles/lines.

You could use this kind of approach for an auto-lockon feature in some kind of shooting game. You create an angle that is within the range of the lock on weapon and if the target falls in between the "lines" you have the weapon lock on.

Enjoy your day.
demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 2nd Nov 2007 04:45 Edited at: 2nd Nov 2007 11:58
I'm trying to understand, but I went to my first pub 11 hours ago, and I did go to see Saw IV (amazing film, I'd most heartily recoomend it) and go for a meal (although I did get margheritas so I guess that that still counts as drinking) and go to my mate's (where I still drunk) but basically apart from that film I've had 11 hours of solid drinking. Don't mix your drinks. I would've been fine if it'd just been beer, but it was beer, lager, southern comfort, tequila, margheritas, bitter, ale and all sorts of whatever else I could find til they refused to serve me any more. I'm a wee bit drunk but I kind of understand.

Thanks Latch.

@Obese I don't have a clue what your code is doing. I'm just going to dig out some vodka and watch one of the DVDs I bought today, but I might try some of this code and ruin something I've already made.

Can you do



I'll try it now.


EDIT:

OK Thanks Latch that code worked



I may update this more later, but I'm tired and drunk and it's half four on a school night :S




EDIT 2: OK revised the code a bit... I spent ages last night thinking "I wonder how I can put in the x and y coordinates right so that the sun beams will look right" not noticing that I could just insert the angles instead of calculating the coordinates on a line at a certain angle and then reading the angle off it :S




Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Nov 2007 17:29 Edited at: 2nd Nov 2007 18:19
@Demon
my code draws a circle
I made an entry out of it.
Anyone can use the function if they like, may prove useful for the challenges. Unlike most of my functions, this one seems quite fast


Blurry version (some cool colour blending)


[edit]
I accidentally made this ellipse thing, I'm trying to turn a circle into a square using a formula so I can have rounded squares.
Got the idea from blender which I just started using and is totally awesome

OOPS! there are two r variables in there

[edit]
A rotating coin, not very smooth or fast.


"You must be someone's friend to make comments about them." - MySpace lied.

Login to post a reply

Server time is: 2026-06-08 14:07:37
Your offset time is: 2026-06-08 14:07:37