Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Programming Challenges

Author
Message
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 17th Mar 2003 22:38
A lot of people have been asking for tutorials to improve their skills and get the hang of DB, and now I have come up with an (in my opinion) good idea. People can post programming challenges (will be explained later in this post) and people can post their solutions in this thread. By programming challenges I mean that people practically post a sort of question which can be solved by programming, and offers some challenge so people can improve their programming skills, and more experienced members can post their solutions showing the most efficient way to write the code, thus showing other people better ways to solve answers. Obviously, anyone can post challenges if they think it will help people improve their programming. I would like your opinions on this and I'll post the first challenge later today.

Cheers, Kentaree
Whatever I did I didn't do it!
Oraculaca
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: Scotland
Posted: 17th Mar 2003 23:18
sounds good , as long as the challenges arent :
make me a fps ,or
make me a map editor
or make me a map editor for an fps


Not-Mr-Thumpy wrinkled his nose, it was suddenly hard to concentrate
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 17th Mar 2003 23:19
Hmm, I had hoped for bit more of a reaction. Oh well, maybe just the wrong time spot
Anyways, here is the first challenge.

Programming Challenge 1: - Change Machine -
-Basic programming and maths challenge-

For this challenge, you have to write a program that acts as a change machine. You put in a coin
and the greatest possible change is given by the machine that is less than the coin put in, if possible. i.e £1 is put in, and the machine returns 2 x 50 pence. However, to make it more realistic (and challenging) the machine has a finite amount of coins. So for example, you put in £1, but there's only 1 50 pence piece left in the machine, it will have to return 1 x 50 pence, 2 x 20 pence and 1 x 10 pence (if possible), and if change cannot be given, the initial coin is to be returned.
This tutorial isnt too hard, but it will test your basic maths skills. Also, try to keep the program as small and efficient as possible, and put comments so other users can see why exactly you changed that one variable in that situation etc.

I hope a lot of people will participate, and good luck to you.
Kentaree

Whatever I did I didn't do it!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 17th Mar 2003 23:22
lol Cut_Me_Own_Throat_Dibbler, you got there just before me. I'm not gonna ask anyone to make stuff for me, I'm just posting challenges to help ppl improve their coding skills. Also, I'm gonna try not to make vague challenges like "make me a game". If anyone has any idea for a challenge, post it!

Whatever I did I didn't do it!
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 17th Mar 2003 23:24
yeah thats a very good idea

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 18th Mar 2003 01:07
yeah good idea the challenge..but ..... i cant participate...

what that 50 pence?? lol.. there is not pence in canada

there is 1 dollar 25 cents 10 cents 5 cents....

your coins r too complicated for me

what about turning an image on itself..in 2d only?
Oraculaca
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: Scotland
Posted: 18th Mar 2003 01:51
O.k Not being talented at A/ Maths
or B/ Programming
but being excedingley bored I wrote a program to do the aforementioned task. However there is a problem sometimes with the end figure for change returned ,as in it has many places after the decimal point even though the used change seems to work. Doh I know i should of just went to sleep. Anyone know how to fix it? maybe I need one of Mr Tatoads plugins

p.s I know it sux and theres easier ways prob but im bored



Not-Mr-Thumpy wrinkled his nose, it was suddenly hard to concentrate
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 18th Mar 2003 19:27
Well obviously you're not gonna agree with a change machine that you put 10 pounds/whatever currency in and only gives you 9 back, so the most logical solution would be for the machine to give back what you put in, thus discarding the need to go into a lot of decimals.

So you should just make a sub routine that gets the total value of the money in the machine. If the money put in exceeds the money in the machine, the machine returns what you put.

TotalMoney()
totalAmount=(pennies*.01)+(twopennies*.02)+(fivepences*.05) etc.
and you call the function to compare the amount of money each time you enter a value.

To Chiwawa: Obviously, currency doesnt matter, you can use whatever you feel comfortable with. I just used pounds and pennies as an example because this forum is English and a lot of users are English.

what about turning an image on itself..in 2d only?

Uhm, I'm kind of at a loss here about what you mean. Please explain

Cheers,
Kentaree

Whatever I did I didn't do it!
Oraculaca
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: Scotland
Posted: 18th Mar 2003 19:36
Well obviously you're not gonna agree with a change machine that you put 10 pounds/whatever currency in and only gives you 9 back.

well i dont know ,it happens quite a lot in the multi- stories i park in

Not-Mr-Thumpy wrinkled his nose, it was suddenly hard to concentrate
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 18th Mar 2003 19:43
lmao, well, maybe apply for a job programming those machines, they must be begging for staff.

Whatever I did I didn't do it!
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 18th Mar 2003 19:59
i mean that:

Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 18th Mar 2003 20:00
instead of


ink rgb(255,0,0),0
box 200,180,400,240

you can draw anything you want...
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 18th Mar 2003 20:24
now you can change the level of detail:

Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 18th Mar 2003 20:34
here ... to see a centered image... and with multiple color...to see that it work..for anything..

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 18th Mar 2003 22:09
Uhm, I dont particularly get the relevance with this topic...
Did you mean that as a programming challenge or...?

Whatever I did I didn't do it!
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 18th Mar 2003 22:21
i like this idea, especially as i'm a newbie!!!! but could you give people time to work it out for themselves, maybe post the solution 1-2 days later which would give people time to work out how to do it by themselves.

'You were born crying while people around you smiled'
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 18th Mar 2003 22:27
that was good dibbler

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 18th Mar 2003 22:51
Yeah, sure. Also, you could still try this one making it differently from Cut_Me_Own_Throat_Dibbler's version. I was actually thinking that as this is not a competition, ppl should just try to make their own version, and current ones that are posted up could act as a guide to people who get stuck. Maybe if more people would like to voice their opinion on this, it would be easier to decide.

Whatever I did I didn't do it!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 18th Mar 2003 23:01
While I'm at it, I might as well post - Challenge 2: - gravity simulator -
-basic maths and very(!) basic 2d challenge

Gravity is used in most games, so its important to be able use this.
Your mission, should you choose to accept it, is to create a world with adjustable gravity (if you were able to this in real life you'd be rich )
Basically, make 2 spheres, 1 big, 1 small. The big one symbolises the planet.
The small one symbolises a character. The character can move around the planet, i.e move along the world's edges using the arrow keys (left and right). Pressing the spacebar will make it jump. If its on top, it will jump up. If its at the side, it will jump horizontally etc. The gravity can be adjusted using the + and - keys (+ increases gravity, - decreases it). Obviously, the greater the gravity, the less higher the character is going to be able to jump, and vice versa. This is a step on from the last one, requiring somewhat more maths insight and programming skills. Feel free to participate
And above all, good luck

Cheers
Kentaree

Whatever I did I didn't do it!
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 19th Mar 2003 00:05
Ok, done that one, polar coordinates to the rescue. It's not commented or anything, I just wrote it straight from my head in about 2 minutes.



You can remove the line which limits g#, this produces an odd effect (the ball flies off the planet). There's no limit to tangential movement, you can still move left and right while in the air.

Once I was but the learner,
now, I am the Master.
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 19th Mar 2003 00:48
lol my post was a challenge..but ive initialisated it..just do it better than that ... especially for the speed ..its really slow..my rorating ..image..
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 20th Mar 2003 19:31
Cool Darthster. I works really well . Maybe it's useful to know that
if inkey$()="+" and if inkey$()="-"
produce the same effects as the keystate commands you used, just makes it a tiny bit more readable, and it scans for both + and - keys, so you wont have to check seperately for both of them.

To Chiwawa: Ok, cool , It would be nice to have more challenges like this, I'll have a look at your challenge tonight to see if I can solve it

Whatever I did I didn't do it!
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 20th Mar 2003 20:29
ok
aw2050
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: United Kingdom
Posted: 21st Mar 2003 23:24
... don't u have €s in Ireland?

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 22nd Mar 2003 01:05
Yep But as this is a UK-based forum, I just used pounds and pence as an example.

To Chiwawa: Havent had the time to look at your prog yet, but I'll have a look when I have the time.

Whatever I did I didn't do it!
LLX
21
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 26th Mar 2003 23:58
Well workign with a outside modeler i have encountered 3 things that could use mini programs to speed up productivity and im sure everyon could use um two

"frame checker"
This program returns a number telling you exactly (Acordingto DB) how many frams are in the 3d object animation.

the file can either be change in DB in the lod object field "" or in the EXE via a file search (your choice)

second
there seems to be a big problem apending objects so a program that (again either via file search or in the code), once run, created a txt file with the corect usage of tutorial 10 from the manual edited for the particular 2 models.
aka a program that would retur na TXT that properly apended a walk to a idle and play idle code snipit for use in DB.

3: Again outside models are tricky things and if you wantto change a limb you need to find a way to know which is which, a prgram that displayed on a loaded model a hovering number next to each limb so you knew exact which number was which limb would be very useful.

Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 28th Mar 2003 23:50
Ok, good idea. Lol, it reminds me of a program I made myself, it can do all those things already (except for the text file but thats easy ) Anyone willing to try?

Whatever I did I didn't do it!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 31st Mar 2003 22:17
Here's another challenge suggested to me by a user:

Make a tennis game using 2D primitives but front-view, but acting lik 3d. You'd have to create your own Z axis and scale the ball/rectangle using it...
This could range from a simple "hit the ball when it looks big enough" or move left and right around the net hitting the ball... or move in full 3D, but using only 2D code.

Whatever I did I didn't do it!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 14th Apr 2003 17:01
Ok, I'll have one more try to see if people are interested .
Another couple of challenges suggested to me by someone:

#1 really simple one

Write a program that uses a for next loop to print all the letters of the alphabet in a row.

#2 another simple one

Write a program that takes a users name and prints it backwards

#3

Write the game "Stones". How you play it is there are 25 stones on the table. There are two players. Each player has the choice of picking up 1, 2 or 3 stones the last player to pick up the last stone wins.

Here is how you need to write the program. Have it draw 25 circles and have it print which player's turn it is. Have three buttons on screen that the player can click it choose how many stones to take away.

For more off a challenge add AI to "Stones"

#4

Write a transposition cipher.

Here's how it works, have the user enter a phrase to encrypt lets say for example "and the fork ran away with the spoon"
Have the program make it into a square like this:

A N D _ T H
E _ F O R K
_ R A N _ A
W A Y _ W I
T H _ T H E
_ S P O O N

The _ represent the spaces

If the sentence does not make a perfect square then add a space and then random letters to the end until it does. Now read it back into a string starting from the top left corner and reading from top to bottom. So it will say this:

AE WT N RAHSDFAY P ON TOTR WHOHKAIEN

Also write a program to decrypt it.

Whatever I did I didn't do it!
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 14th Apr 2003 19:09 Edited at: 14th Apr 2003 19:27
im almost done ur 4th challenge there kentaree

EDIT: k im done get it at http://galileo.spaceports.com/~rochon/demos/encrypter.exe
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 14th Apr 2003 19:30 Edited at: 14th Apr 2003 19:37
k wow none of my links are working

gimme a sec

Edit: try this one http://galileo.spaceports.com/~rochon/demos/index.html
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 14th Apr 2003 20:27
lol.......post the code..
if not..we cant ..say who have the better algoritme...
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 14th Apr 2003 20:45
k


actually i dont have any algorithms i dont think
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 15th Apr 2003 00:59
Yeah, very good. However, I would alter the printstring subroutine somewhat to:



This uses the ~ character instead of the Z character as it is very unlikely to be used, and also adds to the last subroutine so the string is returned to its original format without the ~ and the _ in between. Maybe you could also add a decryptor for it, so you can enter encrypted strings which are then decrypted.

Cheers,
Kentaree

Whatever I did I didn't do it!
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 15th Apr 2003 01:58
i would do the challenges but im not good enough yet but when i am ill try em too kentaree.

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp

http://www.apollo-design.com
Great Knight
21
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 15th Apr 2003 10:57
I know a challeng Lets see who can make a small midi player.

AMD Atherlon 2400+ XP, 380 DDr memeory, ATI Radeon 9000 64 DDR.

And a Katana.
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 15th Apr 2003 14:34
IcFcfan: The point of these challenges is to actually improve your programming, and if you attempt a challenge and get really stuck, you can look at other people's codes to see how they tackled the same problem. Challenges like make a program to print all the letters of the alphabet or that print your name backwards arent hard, anyone can attempt them.

Great_Knight:
Woohoo, I can, I can, lol


(As you can probably guess I'm bored )

Whatever I did I didn't do it!
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 15th Apr 2003 21:20
i tried the stones game i didn't use buttons to specify the number of stones to pick up though!

'You were born crying while people around you smiled'
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 19th Apr 2003 01:05
Yeah, good, now try to integrate AI in it so you can play VS the computer.

Also, yet another proposed challenge: Make a TIC-TAC-TOE game which learns from previous games, i.e, it saves every losing combination it encounters and in the end it wont lose a single match.

Whatever I did I didn't do it!
k0shi
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: Cyberspace
Posted: 19th Apr 2003 04:57
i made a tic-tac-toe game thats imposible to beat.
lol

im the only one thats normal in this world.
everyone else is weird.
EightYearRecoil
21
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 19th Apr 2003 12:25
Well, I did the 1 and 2 of your 4 challenges, If I had more time I'd try the other two. BTW, I think this topic is a great idea.

REM #1
for a = 65 to 65 + 25
print chr$(A) + " ";
next a

REM #2
input "Name", name$
name = len(name$)
for a = 1 to name
name1$ = name1$ + right$(name$, 1)
name$ = left$(name$, len(name$)-1)
next a
print name1$

Eight Year Recoil

PS. A little off topic, but coud someone please tell me how to put the code in a snippet?
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 19th Apr 2003 19:01
to put your code in a snippet press the code button once once, paste your code in and then press the code button again

or you could just use the code box below where you type you message

ARE YOU A 3D MODELER??? IF SO WE NEED YOU!!!
EMAIL mynameisnoneofyourbuinsess@hotmail.com to work on the new Star Strike project!!!

Login to post a reply

Server time is: 2024-11-24 11:15:41
Your offset time is: 2024-11-24 11:15:41