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
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 18th Mar 2006 21:55
ignore the above one..
here is fixed and more decorated version:

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Mar 2006 01:15
Still gives the wrong results.

Here's a suggestion for you. Have the players bid on each die roll. Maybe 1 or 5 to enter. Then roll the first die, and each player bets (raise or call) on first roll, or folds. Then roll the second roll, and maybe even 3 to 5 rolls, keeping the betting going each time. The winner is either the last player to remain in (not fold) or has the highest results.


Open MMORPG: It's your game!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 19th Mar 2006 01:42
still error???i dont have error here,it works perfect?
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 19th Mar 2006 01:51
@Ric - Speaking of ODE, I'm working on an idea using ODE for this challenge. I will let you know if I get it to work OK. You know how ODE can be.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Mar 2006 02:19
For anyone interested: a die making function.




Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Mar 2006 08:21
Okay - apperently not impressive enough to get any comments. So here's some dice rolling code.






Open MMORPG: It's your game!
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 19th Mar 2006 11:55
@RiiDii - Nice die function and nice dice rolling code!
Hmmm...I wonder if RiiDii is doing a dice game?
I do hope you enter this challenge, I like it when there are lots of entries, lots of different ideas for everyone to see.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Mar 2006 13:34
I probably will. Still thinking of a game to make though. I want to do something a little different, but not sure what.


Open MMORPG: It's your game!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 19th Mar 2006 18:33
Cool stuff so far. I wonder how easy it would be to make Yahtzee. Used to love that game. Also, I don't know what they're called, but I love those machines you find in arcades where you put in a coin, it drops to the bottom through a series of obstacles, where it joins a whole load of other coins all being shunted backwards and forwards by a mechanical slider thing - if you're lucky, a whole load of coins spill off into the tray at the bottom and you win them. Could be another use of the ODE.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 19th Mar 2006 20:12
why ODE is acceptable but Newton is not?
I mean Newton is far more advanced but also much easier than ODE.
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 19th Mar 2006 20:15
There is a "no outside media" limitation. Everything you do must be pure code.

formerly xMik
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 19th Mar 2006 23:04
Because ODE is part of the DBPro 5.9 release. I too wish ODE was better, can't wait for the new physics engine that will be included with DBPro. They have not said when it will be ready though.
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 20th Mar 2006 11:45
Hi everyone! Here is what I have so far

Its going to be a horse racing game it is going to look a lot better, I have just ran into a problem, doeas anyone know how to move the horses at different lengths without goign super fast as they are going now!

Thanks!

When in Trouble with anything visit here your number one stop for help
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Mar 2006 12:08
@Darth Vader - Hey,to make the race last longer, either build a bigger race track, or use floating point number to move your horses, or both. I have modified your code to use floating point numbers.



Hope this helps
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 21st Mar 2006 02:40
Thanks Billr!

Ohh can we use the createsound commands or are they against the rules?

When in Trouble with anything visit here your number one stop for help
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 21st Mar 2006 04:01
Whats wrong with my collision it does'nt seem to be working

There is a bit of REMed out collision code, but nothing works and I am a bit suprised, can anyone else see?

When in Trouble with anything visit here your number one stop for help
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 21st Mar 2006 04:17 Edited at: 21st Mar 2006 04:30
I now am trying to place text before the game starts but after everything has been loaded, but it doesn't show I am using the center text command and placing it in the middle of the screen (screen size is 1024,768).

EDIT: Fixed

When in Trouble with anything visit here your number one stop for help
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 21st Mar 2006 05:29 Edited at: 21st Mar 2006 05:31
@Darth Vader - I use collision a diiferent way, I changed your code to work, using collision the way I use it.
I also changed your camera position, to use what I think is a better view for a horse race.



Good Luck with your program in this compo, it's looking good, keep working on the game play, and polish it up before you're done.
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 21st Mar 2006 05:49
Thanks Billr for the help and feedback!

When in Trouble with anything visit here your number one stop for help
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 21st Mar 2006 10:38
That's looking good DV. I hope we're going to see some form of betting on the horses next. Yes you can use the createsound function, as it doesn't require any external files or media.

Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 21st Mar 2006 11:37
Quote: "I hope we're going to see some form of betting on the horses next"


I am working on it!

When in Trouble with anything visit here your number one stop for help
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 21st Mar 2006 12:48
okay here is my final:
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 21st Mar 2006 18:04 Edited at: 21st Mar 2006 18:04
I love the concept - go into a casino, roll some dice, and be certain of going home with more money than you started with! For more realism, though - and to make it a bit more interesting, it might be better if there was some chance you might lose money as well as win it.

BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 21st Mar 2006 18:08 Edited at: 21st Mar 2006 18:09
@CuCuMBeR - Still a week left before judging, don't be in such a hurry to finish.....I have something more you can add to your program.

If this is a gambling game, then you need to wager money each round, hoping to wim. The players in your game don't wager any money that they might lose.

---Ric beat me to it!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 21st Mar 2006 20:38 Edited at: 21st Mar 2006 20:40
well, here is the very final version:p
but this one is special, you bet 5$ each play and winner gets the total 20$in his pocket

however if you can stand until the game ends, you will notice the casino wins all the time, that expresses how bad gambling is and you should know when to stop gambling(just an excuse that i couldnt figure a problem out:p), after all casino always wins:p
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 21st Mar 2006 21:42
If you bet 5$ each play, and have a 1 in 4 chance of winning 20$, then you should always break even.

Quote: " that expresses how bad gambling is and you should know when to stop gambling "


Well, I stopped once I had lost all of my money and it wouldn't let me play anymore, so I guess I didn't learn my lesson.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 21st Mar 2006 22:03
you dont have a chance to win 1 at 4, its very seldom indeed..
Quote: "
Well, I stopped once I had lost all of my money and it wouldn't let me play anymore, so I guess I didn't learn my lesson.
"

i knew you wouldnt stop, thats why i restricted you to play again:p
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 22nd Mar 2006 00:00 Edited at: 22nd Mar 2006 00:45
@CuCuMBeR - you let the player with $0 still win even though he wasn't able to bet. You should narrow it down until only 1 player wins it all. Then have a fireworks display on screen for the winner.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Mar 2006 01:06
Quote: "you dont have a chance to win 1 at 4, its very seldom indeed.."


Eh? If there are four players, one of whom must win, and the dice are fair, then there is a 1 in 4 chance that it will be you that wins. I'm simplifying by not accounting for ties, but that won't make that much of a difference to the odds.

Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 22nd Mar 2006 01:32
@CuCuMBeR: Just to let you know, I think a math problem still exists. This one isn't about "who wins" but about how much money there is in play.

I think the pot increased by 5$ each time everyone bets! That's because the winner's sum is increased by 20, (but hasn't taken into account the 5$ he had to pay to get into the game!)
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 22nd Mar 2006 04:04 Edited at: 22nd Mar 2006 04:18
Wrong place!

When in Trouble with anything visit here your number one stop for help
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Mar 2006 10:07 Edited at: 22nd Mar 2006 10:11
Quote: "
Eh? If there are four players, one of whom must win, and the dice are fair, then there is a 1 in 4
"


actually no, this is gambling whether 4 or 40 guys play, your chance of is 1/2 (you win or you lose):p

Quote: "
I think the pot increased by 5$ each time everyone bets! That's because the winner's sum is increased by 20, (but hasn't taken into account the 5$ he had to pay to get into the game!)
"


well theres a bet variable which takes 5$ from every player who has enough money, and adds the sum of this bet to winners money. if nobody wins, it gives 5$ back to each player.

however something else cause the money to disappear from the game play which i dont know really, its very buggy and im quite bored with working on this one, still i believe ive a chance to win though:p
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Mar 2006 10:21
Quote: "this is gambling whether 4 or 40 guys play, your chance of is 1/2 (you win or you lose):"


No!! Excluding ties, if 40 people played against each other, and only one can win, then your chances of winning would be 1 in 40!Don't worry about it - maths clearly isn't your strong point.

Quote: "still i believe ive a chance to win though"


Yeah - either you will win this challenge, or you won't, so that must mean you have a 1 in 2 chance of winning.

Mr Bigger
19
Years of Service
User Offline
Joined: 31st Jan 2005
Location: was here!
Posted: 22nd Mar 2006 12:27
Hi everybody,
I had some extra time and thought i would take Ric up on his challenge.I had fun making this entry over the past few days
and i`m glad i did it.

I learned a few things along the way,like how much of a pain it is to code textures and how you seem to finish a project when a deadline is looming.

When i was playing more than writing i knew it was time to
post it. Thanks for the invite Ric.

My humble entry.


AMD 2600+/1GB DDR ram/GeForce Fx5200 128MB/W2KPro/DBPro 6.0
Better to remain silent and be thought a fool than to speak out and remove all doubt.
Abraham Lincoln
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Mar 2006 12:46
Hey - that looks great Mr. B! Nice work. I think this sets a standard for the rest of the entries to beat ......

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 22nd Mar 2006 18:59
Great job Mr. BIgger!


Open MMORPG: It's your game!
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Mar 2006 23:07 Edited at: 22nd Mar 2006 23:47
@Mr Bigger: Good Stuff

k. i might get this finished before the due date so i thought i'd offer a screen shot. lotta work to be done but it's going well enough/i can imagine finishing.



i had a solid start on the last asteroids challenge but after spending a couple hours on it one day i forgot to save before i closed and was too disheartened to complete it (maybe some day)

Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb)
Drivers and Updates Kept Current

Attachments

Login to view attachments
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 23rd Mar 2006 01:11
Woah - that's looking nice! This challenge is beginning to hot up.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Mar 2006 04:56
How about the next challenge not be a game? Cause thats all we seem to do anymore. Coding challenges should focus on a specific task.


Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 23rd Mar 2006 05:34 Edited at: 23rd Mar 2006 05:35
Here is an image of my game


When in Trouble with anything visit here your number one stop for help
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 23rd Mar 2006 06:57
@Billr I am having a little trouble with your code that you gave me this is what it is,

As you can see in the post winner function I take the game to a check function were it checks to see if you have won or lost by comparing a variable that stores the horse you are bidding on with the winner variable that you made, the problem is when I ran the program through the step mode debugger and watched the variables the winner variable doesn't store a number! But it shows up which horse won but can't compare it to my checking variable!

Do you know the problem?
Thanks!

When in Trouble with anything visit here your number one stop for help
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 23rd Mar 2006 08:08 Edited at: 23rd Mar 2006 08:09
Just a guess, but you might try something like this:



That way, once there is a winner, it's locked in.


Open MMORPG: It's your game!
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 23rd Mar 2006 10:12 Edited at: 23rd Mar 2006 10:23
@Darth Vader - I took randomize timer() out of your main do-loop, you only have to do this once, or before each race if you so desire.
It helps when you post all your code, then I can see what you have done, and help you better.
If the variable horsenum=3, the horse you bet on,



You might also tell the player how much he won at the end of the race.
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 23rd Mar 2006 12:02 Edited at: 23rd Mar 2006 12:03
Okay here is my full code with the problem which is, after the program stores the winner in the winner variable the program goes to the post winner function were he goes to the check function and here is the problem... It compares the winner variable with the bid variable (the bid variable is the one that stores the horse you bet on) if the variable are equal it gives you the money if the variable aren't equal it keeps the money from you and pastes a message on the screen. The problem is it always goes to losing function even if the variable are equal! I can't see the error cause if you look at this small code it does the same basic principal and it works! but my source doesn't.


And here is the full game source

Thanks!

When in Trouble with anything visit here your number one stop for help
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 23rd Mar 2006 23:18
Quote: "How about the next challenge not be a game? Cause thats all we seem to do anymore. Coding challenges should focus on a specific task."


I'd quite like to do some non-game challenges too, although they tend to generate less interest. And if the games are chosen carefully, they can still focus on specific techniques - for example, the asteroids/lunar lander challenges were quite specific to forces and acceleration, which are useful techniques (until DarkPhysics arrives, after which nobody will need to understand how physics is coded). Anyway, Phaelax, it's really about time you won one of these challenges - and then you can pick your own challenge!

BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 24th Mar 2006 12:50 Edited at: 24th Mar 2006 13:07
Here is my Pachinko game so far. Pachinko is a Japanese gambling game.
Lot of work still to do....

[/img][img]

There won't be that many balls on the screen in the finished game, I just wanted them to show up for testing.

The idea is to get the balls in the win boxes at the bottom, the balls are shot into the playfield from above, they fall, bouncing on the nails in the backboard, bouncing around as they fall.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Mar 2006 19:06
Looks good - ODE I presume?

BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 24th Mar 2006 20:06 Edited at: 24th Mar 2006 23:28
Yep, ODE.
ODE can do some cool things, but it can be really frustrating too!

I can't wait for DarkPHYSICS!
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 25th Mar 2006 05:42
Yippe! Whahooo, Oh Yes! Done it Yeah thank you!
Sorry for that but this is my first completed game! Yes after having DakBASIC Pro for almost one year this is my first COMPLETED game! (I spent a lot of time messing around starting one project after another).

But I could not have done without these two people




And now the game

Horbox Racing Bronze edition

After the introduction you will be taken to the betting room after placing your bet and chossing your horse the game will comence! After which it will show hom much you could win and if you win!

Starting Money:$500
Bid until you drop!

Please note: By playing this game I hold no responsibility for the outcome whether you start gambiling consistenly or otherwise


When in Trouble with anything visit here your number one stop for help
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 25th Mar 2006 06:46 Edited at: 25th Mar 2006 06:52
@Darth Vader - Glad you finally were able to finish a game, hopefully just the first of many yet to come.

You will find that they get easier as you get more used to programming in DBPro. Even in the real world, programs are RARELY finished. They are usually completed enough to work well for a given schedule, sometimes a few bugs remain, and ALWAYS more that you could have done to enhance, polish, or add that little bit more to take it from a good game, into one that shines.

If you will allow me, I will comment on a few things you could make better, either so you know what to work on next in this game, or to be aware of to make your next game better. It is always a very good idea to get someone else to play test your game, they won't know how everything works, such as user input, etc. so you can make it better.

So here goes:
1) Show the amount of money I have when I am placing the bet.
2) When I'm out of money, there is no "Sorry you're broke now" kind of message, the game just quits - a little rude maybe"
There are others, but all things considered, a good job so far.

Good Things:
1) Using functions and subroutines, always good for breaking up code logic.
2) Basic programming style is good! Your code is readable for others and yourself to understand well. If you will indent your code it will be even better.
3) You have pride in your hard work, and it is hard learning, programming, getting things to work right.

GREAT JOB! - hope to see you in future challenges!
PS..And you're welcome. The more considerate programmers in this forum are more than willing to help the newer programmers. All it takes is for the newer programmers to read and learn on their own, try programming some code, spend some time trying to work out the problems, THEN ask for help if they can't figure it out on their own. You have matured some in this area, good for you. So keep struggling with new ideas as we ALL do, and you will get better. By the way, EVERYONE struggles some times with their code, I have struggled with this current challenge, using ODE, and have compiled my code probably 100 times.

Login to post a reply

Server time is: 2024-11-24 17:51:12
Your offset time is: 2024-11-24 17:51:12