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 / Have I just proved the theory of 'fate' with DB ?!

Author
Message
Xlimun
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 8th May 2003 03:11
This code sets a 'RANDOM' position for a 'food source' and dots are sent out one by one onto 'RANDOM' positions. When a dot 'finds' the 'food' it prints the position it was found at, simple enough right? That's what I thought.

However, EVERY TIME I run the program the 'food' is placed in EXACTLY the same places in EXACTLY the same order as the last run. Not only that bu it appears that the dots 'find the food' at EXACTLY the same time as the last run(I would include a timer with the code but I don't know how).

So what the hell is going on? Does the rnd(x) command not actually mean that it picks a random number, but instead follows a pattern?

I'm realy confused on this, plese tell me it's just my coding.

Here's that wacky code:



I'm quite new to programming and i've been over it alot of times and I can't see why it is happening.

Um....Help?
Try not to become a man of success, but rather try to become a man of value.
--Albert Einstein
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 8th May 2003 03:19
Yes random isnt so random in DB You need to randomize a timer and use that This has been mentioned in a few previous topics.

RPGamer

Current Project: Eternal Destiny
Tech Demo - Colan Island: Currently 716 Lines
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 8th May 2003 04:05
Xlimun:

randomize timer()

"Gentlemen, we are about to short-circuit the Universe!"
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th May 2003 15:13
Background...

Randomising functions in virtually every system and application are based on a set of 32,000 random, but fixed, numbers (or thereabouts) held in the system ROM. Every time you request a random number, it takes the next one in sequence.

To truly randomise, you need to pick a seed (starting point) at random first. The easiest way to do this, as Rich has demonstrated, is to base it on the timer. This is 99.9% foolproof, it could only become predicatble again if a program was started automatically at exactly the same millisecond every day, and nothing else within the application's environment changed.

To take it a step further, you should pick a new seed at various intervals in your program, preferably triggered by some other unpredictable event. Otherwise, you only have 32,000 sequences, and these obviously overlap one another.

Thanks in advance.
All the Best,
StevieVee
Cras
22
Years of Service
User Offline
Joined: 15th Oct 2002
Location: United Kingdom
Posted: 8th May 2003 15:25
i find that just having it once works fine. i didnt know to randomise timer when i first started. I used to make an array and each time the program ran, add one to it and load it. that way it would never be the same but it means external files, something which im now strongly against. Im currently making programs to convert all media into source. animated 3d models are proving to be quite tricky. just kidding i havent even tried them. im really focusing on 2d.
Xlimun
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 8th May 2003 17:01
wow, thanks guys. It's not very putting a command like that in a language (it could give someone a heart attack). Thanks for the timer info, much appreciate.

Right, next it's time to crack open the tutorials on arrays and storing data in external files.:S

As you can see, I'm quite new to programming so this is realy killing me. I'm trying to build a brain (yes, a brain). I know a computer is kind of based on a brain anyway but I am after (C)onsciousness (that old chestnut) and essentialy (U)nconsciousness. Because I belive/know that there can't be any C without U and creating U has got to be easier than creating C, right?

I know I'm gong to need at least the most powerful super-computer in the world to come anywhere close to a human brain. So i've decided to go for a simple brain (simple output and input), if I try to set it an ultimate goal, be it pro-creation or 'finding food/knowledge' then keep a sea of random events running in the background (maybe input being sorted into combinations and patterns and stored) then I am hoping that in the adaption part of the program, it will start to think for its self.

I'm not going to get too excited as I know a few top pragrammers are already working on the same kind of thing and am sure they are yet to disclose anything real hairy on the matter.

....I'ts just a matter of trial and error but I have alot of ideas so I have alot to be getting on with.

...Just imagine if it works out! Nowhere near the matrix scenario but it would be cool. The hardest thing would be teaching it how to communicate with words but I'll give it a try...Just think it will eventually start reading as much as memory will allow on the internet and maybe go even places it shouldn't be . It would demanding more memory off of you, can you imagion that? Your computer begging you for more power and memory. It will do anything for you becuse after all, you would be the master.


...I realise that it may not work but hey, it's a real good fantasy, right? Even if I get something which is remotely like it I will be quite proud.

Try not to become a man of success, but rather try to become a man of value.
--Albert Einstein
Yarbles
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Toronto
Posted: 9th May 2003 06:27
"Yes random isnt so random in DB" .. not just DB, all computing actually!

The Yellow Jester does not play but gently pulls the strings
And smiles as the puppets dance in the court of the Crimson King.
Xlimun
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 9th May 2003 16:35
Damn, then most of my theories wont work.

Try not to become a man of success, but rather try to become a man of value.
--Albert Einstein
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th May 2003 05:27
SGI the company spent a lot of money to demonstrate true random events a long time ago.


One test was to point a camera at a lava lamp then calculating all the colours into a seed at that current moment in time.

another one counted yellow cars passing out of a bridge.

An External source would be a good implementation,You may have seen some web pages with a wiggle your mouse within this box.

this is recording the points your mouse is at and generating a seed.

anything is possible but you have to think differently sometimes to get around limitations.

Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 10th May 2003 19:29
Ahem... those aren't truly random IMO because nothing really is . But it's nice finding interesting things that you're sure are likely to be almost random...

If you were sure your program would never be used by the same user twice, you could grab random values from the pattern of their iris .

--Mouse

Famous Fighting Furball
Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 04:58
You wont be able to model a human brain on the most powerful super computer in the world (Cray 4 still isn't it?). It's not powerful enough.

Unless of course you consider the brain to actually be the most powerful super computer on the world. Afterall nerves are just electrical impulses right?

However there's some dubious samples around this forum so you need to be choosy when picking your model brain .

Pneumatic Dryll

Login to post a reply

Server time is: 2025-05-17 09:47:59
Your offset time is: 2025-05-17 09:47:59