5 Cents for today..

Featuring the Dragonfly web framework
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

5 Cents for today..

Post by newdep »

I posted some scripts again at http://nodep.nl/newlisp/index.html

If you like to see your PC work?! use the Latin Square script ;-)

Enjoy, Norman.
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Beautiful the latin square, even the fan in my Mac Mini came on trying a 9-square ;), playing with this thing is addictive.

Lutz

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

hehe..Its a load indeed... And im still running a Square 15..dont think that will finish today tough ;-)
-- (define? (Cornflakes))

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

Nice! ;-)

There is an interesting case:
Latin Square needs 'randomize' to return ALL possible variants of sequence, which means even the SAME sequence.

This case (and similar ones) will never get solved (infinite loop):

Code: Select all

--- Running!

(2 3 1)
(3 1 2)
Lutz - could we get optional parameter in 'randomize'?
=> (randomize '(1 2 3) true) => '(1 2 3)
=> returns ALL possible variants, INCLUDING the SAME sequence

... I feel kinda stupid now, when I proved that randomize (or shuffle :-) will sometimes return the same sequence, than we repaired it and now I would like to have a parameter to return the same sequence again :-)))

Fanda

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

ps: We could also vote if optional 'true' means ALL or (ALL except the SAME). If it's not too late...

Fanda

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

let's go with 'true' for randomizing with repetition

Lutz

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

So that means the current random functions are unique?

Cant we better change the 'seed behaviour instead?

Regards, Norman.
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Mmmm also intresting is that i dont have this (1 2 3) problem on my linux machine but i do have it on my windows XP machine....

???
-- (define? (Cornflakes))

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

Current 'randomize' never returns the same sequence (and you usually want this).

Try this test:

Code: Select all

; TEST for randomize
(setq L '(1 2 3))
(setq r '())
(dotimes (x 10000)
  (push (randomize L) r))

(setq r (unique r))

(println r)
(if (find L r)
  (println "ERROR!")
  (println "OK!"))
You shouldn't find '(1 2 3) in the result.

Fanda

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

This Unique random issue...Intresting because I have here a program that checks on UniqueNess inside my codebase and i failed so far ( that explains more then my assumption that the total of random occeurenances still had to come ;-)...

So when was this changed? (I like this unique option saves me some work..)

I first thought it was related to the 'Seed ..but its not..not even wehn you place a new 'seed inside the loop...Mmm funny that i did not notice this..

Happy that this was brought up...

By the way..it also fails on linux.. (correction on the above)

Regards, Norman.
-- (define? (Cornflakes))

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

I am not sure, if I understand...

The only thing is: 'randomize' function without that optional 'true' will mix the output list as long as it is the same as the input list - you always get something different than you started with.
If you use optional 'true' (useful only in the next version of newLISP) you get all the cases possible - even the same list you started with.

Fanda

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Ah yes I overlooked this in the manual
-> randomize will always return a sequence different from the previous one.
-- (define? (Cornflakes))

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

Now, just add the 'true' to randomize functions :)

Fanda

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The 'true' flag in 'randomize' is already there, see the manual ;)

Lutz

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

PS: My favorite game: http://www.planarity.net/

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Aaa nice... Lets have a look at it, seems intresting game ;-)

Yes the "true is in it ;-) Runs great now ;-) Thanks!
-- (define? (Cornflakes))

Locked