# 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.

### The 20 Line Challenge / [DBC] How old are you?

Message
Posted: 26th Jan 2007 21:23 Edited at: 20th Jul 2007 17:26
Edit: this can run on DBPro but you will need to add the sync command

This is a little fun program than can guess your age, all you have to do is answer a few questions accurately and it will calculate your age, it should be very accurate.

For those interested in how the program is able to guess ages, try figuring it out before you look at the code

Cheers
Data

PS: I believe it's a forum rule not to post your age here so please don't!

Remainder: The number that is left over in a division in which one quantity does not evenly go into another. A remainder is never a decimal number(unless the numbers you were dividing were decimal numbers).

#### Attachments

Posted: 26th Jan 2007 21:47 Edited at: 12th Jul 2007 22:29
For DBPro it needs sync commands:

It works for me.

Posted: 26th Jan 2007 22:00
good to know it works for you

Free sigs, email addresses and contests!
JimmyR.Co.Uk
Posted: 27th Jan 2007 03:55
Wow !!
Amazing !!
First i forgot what a remainder was and put in random answers but then
when i went back to my math book and found out i answered it right and it actually showed me the correct answer!

To save other peoples time a Remainder is the whole number left over after you try to divide it for ex. 35 divided by 4 is 8 and the remainder is 3. If u multiply 4 x 8 = 32 and 4 x 9 = 36 so 36 is too high so we use 32 and u subtract the number from 35 so 35 - 32= 3 and thats how u get ur remainder .. its basically the number u get left over after dividing by what the program says.
Posted: 27th Jan 2007 17:13

Free sigs, email addresses and contests!
JimmyR.Co.Uk
Posted: 27th Jan 2007 19:22
Nice, it worked for me too.

Posted: 27th Jan 2007 21:54
it should work for any age over 7 and below 104...

Free sigs, email addresses and contests!
JimmyR.Co.Uk
Posted: 1st Feb 2007 03:33
hmm it said im 36...im below 20

~Kieran
Posted: 1st Feb 2007 16:49
it worked well, rather cool!

Who wants a Lemon?

I love lemons... and cats
Posted: 2nd Feb 2007 04:58
Quote: "hmm it said im 36...im below 20"

are you sure you entered the information right? It seems to have worked for everyone else...

Free sigs, email addresses and contests!
JimmyR.Co.Uk
Posted: 3rd Feb 2007 21:54 Edited at: 3rd Feb 2007 21:54
well only one of my remainders isnt a 6.3333333333333 or a 2.435 which is 2.6

~Kieran
Posted: 8th Feb 2007 23:10
Remainders are all whole numbers...

Posted: 15th Feb 2007 09:06
so say i was 23 what would my remainders be (im not btw)

Posted: 16th Feb 2007 04:14
your remainders would be 2, then 3, and then 2 as

23/3=7 R2
23/5=4 R3
23/7=3 R2

Free sigs, email addresses and contests!
JimmyR.Co.Uk
Posted: 23rd Apr 2007 01:35
It guessed my age!(10)

I will Learn to rule 2d. Someday...
Posted: 23rd Apr 2007 04:10
It works, thats for sure!

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Posted: 27th Apr 2007 20:22
Can I remind people that this is the 20 Liners board and posting snippets on here that are greater than 20 lines long (Daemon?) are pointless.

Even more so if the required alterations are only a few seconds of extra work.

The whole point of the exercise is to show others how clever you are with how much you can cram into just 20 lines of code - not just post simple programs that really should be on the Code Snippets board.

TDK_Man

Posted: 6th May 2007 10:53
Guessed mine correctly which is 342.

And here is the DBP version in 20 lines since TDK isn't so happy about what was posted:

Posted: 7th May 2007 06:15
it doesnt work if your age is 105
Posted: 7th May 2007 18:54 Edited at: 7th May 2007 18:55
@TDK It was in 20 lines before. Remember the rules?
Quote: "7) You are free to use blank lines to space out your code for readability, they are not included in the 20 line maximum. The second a line has a command on it it's included."

Just reminding you
Posted: 9th May 2007 04:31
@draknir

That's true, there are a few rare numbers on whihc it won't work, inclduing really low number such as 0,1,2,3 and Im not sure about decimal numbers. However, it was made assuming hte people using and testing it will be between ages 10-100.

[url=www.web.mac.com/the_data]iDevelop[/url]
Posted: 19th May 2007 04:01
Nice progran. I first though it worked by getting the answers and eliminate all posible numbers. Nice, it guessed my age: 14 years.

Have a nice day
Posted: 24th May 2007 03:16
Awesome program, love it. INGENIUS.

E.D.

Posted: 25th May 2007 12:42
Quote: ""7) You are free to use blank lines to space out your code for readability, they are not included in the 20 line maximum. The second a line has a command on it it's included"

lol... I love when mods flame when their wrong

Posted: 26th May 2007 20:52
wow, I didn't expect so many people to like it, I'll make another version soon with a few new features!

[url=www.web.mac.com/the_data]iDevelop[/url]
Posted: 31st May 2007 00:10
Not to be rude, but what else could you add?

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Posted: 1st Jun 2007 03:28
well nothing more could be added to the core concept itself, but it could look nicer and I know a few similar tricks that also could be added.....
Posted: 1st Jul 2007 03:27 Edited at: 1st Jul 2007 03:29
Quote: "And here is the DBP version in 20 lines since TDK isn't so happy about what was posted:"

Why do people seem to think that I am unhappy? I'm only pointing out the blindingly obvious - that it makes no sense at all posting code snippets of more than 20 lines on a board specifically for programs of 20 lines or less! I didn't make the rule - I'm just repeating it - when I shouldn't really have to...

Quote: "@TDK It was in 20 lines before. Remember the rules?"

I do. If you read my post again, you'll see that it wasn't aimed at the poster of the original snippet but Daemon who posted the following 24 line snippet (and that's not counting the blank lines):

He obviously couldn't be bothered making it within the allowed 20 lines limit as it would have taken him what... all of 10 seconds to do so?

TDK_Man

Posted: 4th Jul 2007 16:10
Hehe. I can't help but find that funny.

@Data, great program!
Also, i noticed that if you type your full age in as the remainder it guesses that number

Posted: 4th Jul 2007 20:41
thanks for the comment Binary Coder, its apreciated
Posted: 5th Jul 2007 20:02
Quote: "lol... I love when mods flame when their wrong"

lol... I love when idiots claim mods are wrong when they are not...

TDK_Man

Posted: 5th Jul 2007 23:12
Quote: "lol... I love when idiots claim mods are wrong when they are not... "

I love when mods waste space on the boards for trivial reasons(like i'm doing now)

Not only have I gone to find myself; I have gone to find you to. If you see either one of us, keep us here.
Posted: 8th Jul 2007 00:14
I love it when people stop flaming, and get back on topic .

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Posted: 11th Jul 2007 03:24
Quote: "I love it when people stop flaming, and get back on topic ."

I love it when someone finally gets something right!
Posted: 16th Jul 2007 17:23
I think the whole 20 line thing is completely pointless. It doesn't teach you to write efficient code, just to write a jumble of crap.
I wont be entering anything here thank you very much.

I am king of the noobs!
Posted: 16th Jul 2007 20:59
erm, it doesn't work if you're 22

7.3333
4.4
3.1428571

I guess I'll never know my age...

I don't have a sig, live with it.
Posted: 19th Jul 2007 01:05 Edited at: 8th Aug 2007 17:06
Some of you really aren't understanding what a remainder is. I am quite surprised at this as most computing languages (not BASIC) include a command called MOD() which will return a remainder, and it can be very useful.
A remainder occurs when a number cannot be divided into another number evenly. The value of the remainder is the original number minus the nearest lower number that CAN be divided evenly.
For example:
15 cannot be divided evenly into 6; but 12 can.
so 15/6 = 2 (12/6) remainder 3 (15-12).

Is that any clearer?

Here is my function to give Remainders (You could even use it in this program if you want )
I haven't fully tested it but it seems to work, all the numbers must be real# or it will return 0. Don't know why but that caused me a lot of hassle

My code finds the remainder in a different way to my explanation. Although it is easier for the human brain to use the "next even divider" a computer can do this. So what i have done is to take the decimal from the division and multiply it by the second number, if you think of this in equation terms (im sure you've all balanced equations at school) this action puts the decimal back onto the left side of the equation.
Aaah i cant explain very well

decimal = 0.?? number less than 1.

Your signature has been erased by a mod because it was rubbish.
Posted: 20th Jul 2007 14:43
DBP contains a mod operator actually.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
Posted: 24th Jul 2007 02:21
@Data: Wow I love it I still can't figure out why it works, but it was fun to use

Posted: 27th Jul 2007 17:07
Thanks for the comment Sixty Squares, its actaully an old Japanese formula if you're wondering.

Your signature has been erased by a mod because it's larger than 600x120
Posted: 27th Jul 2007 21:00
Quote: "DBP contains a mod operator actually."

DBC doesn't. Don't know why, but it doesn't.

I am King of the noobs!
Posted: 5th Aug 2007 07:45 Edited at: 5th Aug 2007 07:58
Hi there!

I think my programme proves that the programme by Data works for ages ranging from 0(?) to 104

Try it.

gearce
(GRC)

LANG MEY YER LUM REEK