View Single Post
Old 20 June 2010, 14:27   #334
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by meynaf View Post
True random ? Tables will NEVER provide true random. A table is NOT random by nature.
A table is random if the source of the numbers is random, for the simple reason that the table can not be remade from scratch. This is what www.random.org does. It produces tables of random numbers based on radio static. When you say that even such a table isn't random, than you're saying radio static isn't random
Quote:
Originally Posted by meynaf View Post
Sounds like utility.library/GetUniqueID().
I don't know about the functions in utility.libary, I wrote mine from scratch. This one uses a hardware counter as it's source (your idea ), not a table (the one megabyte data block is only that large for testing):
Code:
; Random sequence test.
;
start
	lea	tab,a0
	move.l	#2^8,d0
	bsr	rnd.sequence
	rts
;------------------------------------------------------------------------------------
rnd.sequence
;
; Generates random number sequences with unique numbers from 0 to (2^x)-1.
; Keep values lower than x^28, or remove safety check.
;------------------------------------------------------------------------------------
;in:	d0=Sequence size (numbers 0 to d0-1).
;	a0=Sequence table (long word entries).
;------------------------------------------------------------------------------------
	movem.l	d0-d2/d6-d7/a1,-(sp)

	move.l	a0,a1
	subq.l	#1,d0

.init_table
	move.l	d0,d7
	moveq	#-1,d1
.loop_x
	move.l	d1,(a1)+
	dbra	d7,.loop_x

.make_sequence
	lea	$bfd800,a1	;Counter from time of day clock.
	move.l	d0,d6
	lsl.l	#4,d6
	move.l	d0,d7
.loop_y
	add.b	(a1),d1
	rol.l	#4,d1

	move.l	d1,d2
	and.l	d7,d2

	subq.w	#1,d6		;Safety check in case the loop takes too long.
	beq.s	.end

	tst.l	(a0,d2*4)
	bge.s	.loop_y

	move.l	d0,(a0,d2*4)
	dbra	d0,.loop_y
.end
	movem.l	(sp)+,d0-d2/d6-d7/a1
	rts	
;------------------------------------------------------------------------------------
	section	data,data_f
tab
	dcb.b	1024*1024
Note: With this 'random' number method you can probably leave out the safety check. And besides, this check is probably too crude anyway. I only put it in while I was experimenting with different simple ways of generating the numbers.

Also, there's a small mistake in here, namely the stupid DBRAs
Quote:
Originally Posted by meynaf View Post
In a computer, only time is random because the user has very variable reaction times (when expressed in a small enough time units).
This is most certainly not random, because in theory the numbers can be reproduced. While this is extremely difficult, it's still possible with the right equipment. This is because what you're using as a base for your RNG isn't random to begin with. Time is not random.
Quote:
Originally Posted by meynaf View Post
My random generator is based on time counters - like every random generator should be. It IS more random than a dice, and i've thrown enough of them to know that !
You have not thrown enough dice to know this, because you'd have to throw them tens of thousands of times and preferably more often than that.
Quote:
Originally Posted by meynaf View Post
Once again, a table is NOT random !!!
Ok, it might be statistically balanced. But it's not unpredictable, and true random must be.
A table based on a true random source is unpredictable. If you can predict the numbers in a table generated using radio static, or based on radio active decay, then you're not a human, but an omnipotent being

I urge you to visit www.random.org, generate a table, and try to predict the numbers. It's not humanly possible
Quote:
Originally Posted by meynaf View Post
Depending on what i want, it certainly is bad.
Okay, then what do you want?
Quote:
Originally Posted by meynaf View Post
You never designed/wrote an AI, did you ?
Nope
Quote:
Originally Posted by meynaf View Post
An AI has to be somewhat complex anyway ; adding more complexity for little benefit isn't good.
It depends only on what you want wether it's good or bad.
Quote:
Originally Posted by meynaf View Post
Beginners will also complain that AIs are too strong.
Beginners will often complain about something being too difficult, so that's not a good reason. Having difficulty levels solves this.
Quote:
Originally Posted by meynaf View Post
You weren't talking about "a little bit".
Yes, I was. All I was trying to say is that what you said in the beginning was too simple, that's all.
Quote:
Originally Posted by meynaf View Post
On the other hand, as i already pointed, is it necessary for the ai to be smart ?
Depends on what you want, and we clearly want different things from games like this.
Quote:
Originally Posted by meynaf View Post
If you look at old civi1 ai and compare it to freeciv ai, you'll see that the latter is much smarter. Yet it makes it a pain in the arse, a real plague : okay, the game is more difficult - but it also becomes less enjoyable (not to mention much much slower and i really mean it).
Than they didn't do a very good job. I don't know if I could do any better, but it still seems that they could have.
Quote:
Originally Posted by meynaf View Post
An ai that's constantly pestering you, takes advantage of your slightest mistake and never seems to understand that it has lost, isn't enjoyable - especially when it takes ages to make its decisions.
Then the AI is simply too strong for the game, or you need difficulty levels. Balance is extremely important. An AI that makes all the mistakes in the book is equally bad, because there's no challenge at all.
Quote:
Originally Posted by meynaf View Post
Game play is important. Don't overlook it.
Indeed

Last edited by Thorham; 20 June 2010 at 19:00.
Thorham is offline  
 
Page generated in 0.04892 seconds with 11 queries