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 / Genetic algorythm that finds the best way between waypoints

Author
Message
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 19th Feb 2004 20:43
Hmm.. the code is in twenty lines, but it could be in less than ten if I didn't use type entype for an array and if I wrote more commands per line.. In most lines, there are far less commands than 25, but if in a line I made an error and wrote more, just paste the 19th after the 18th

What does this program do ? first, you place waypoints, then you tell how many critters you want to have.. Please, choose more than one waypoint, and more than one pet.
Then, it is easy : the program make an adn for each pet. The dna stocks the waypoints in a random order. Each pet has its own dna, so they're all differents.
Then, the program look the length each critter has to walk to reach all the waypoints and to come back at its first position.
The one who walks the more is killed. If it is a dog, I kill him myself, if not, the program kill him.
Then, the program make a copy of the dna of a random alive critter, and change the place of two waypoints. The new pet may have a longer way than its "father" (and will be killed the next loop) or a smaller one (and the father will be killed).

The problem is that there are many possible ways. I don't know the name of the function that give the number f possibilities in English. In french, it is "factoriel", and its symbol is "!".
How does it works ?
5! = 5 * 4 * 3 * 2 * 1
n! = n * (n-1) * (n-2) * (n-3) * ... * 3 * 2 * 1
So, for example, if you place 10 waypoints, you will have 3628800 possibilities. with 15, you'll have 1307674368000...
I tried to find a path for 17 waypoints (355687428096000 possibilities) in only ~1600 generations ^^
Only using random paths cannot work, it would take too much time, but butchering pets works far better ^_^

Please, do not try to do the same with real pets nor with your sister !

The sleeper must awaken !
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 19th Feb 2004 23:45
can you make an exe file?? I have DB

CURRENT PROJECT: RETRO PAC-MAN
Cryptoman
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 20th Feb 2004 19:22
Doesn't seem to do anything at all. What version of Pro you using?
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 20th Feb 2004 21:02 Edited at: 20th Feb 2004 21:06
hmm.. I don't understand ; I could run the code without any problem, and now, you're right, it doesn't works, even for me

by luck, I saved the compressed version, so I post again.. and I try to write it in the (code)(/code) too



Here's an executable
http://sensai.free.fr/attreid/short_way.zip

The sleeper must awaken !
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 20th Feb 2004 21:31
the zip file doesn't open

CURRENT PROJECT: RETRO PAC-MAN
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 20th Feb 2004 22:10 Edited at: 20th Feb 2004 22:33
crénom, that's odd, I can open it without any problem...
but because I'm a very kind guy, I'll modify it to make it work with DBC

for DBC (not in twnty lines .. I'm not in a mood to fold it ^^)


it's about ten time slower in DBC than in DBP, so don't put too many waypoints (10 and less are enough, but you can put more - if you've enough time ^^)

The sleeper must awaken !
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 20th Feb 2004 22:46
Thanks! and sorry for disturbed you

CURRENT PROJECT: RETRO PAC-MAN

Login to post a reply

Server time is: 2024-11-21 16:18:46
Your offset time is: 2024-11-21 16:18:46