horace {l Wrote}:i have a question about shortcuts. are shortcuts really supposed to be shorter? wouldn't everyone always take the shortcut then? or should shortcuts be shorter but much more difficult to drive? how should this be balanced?
horace {l Wrote}:how does the ai decide which driveline it takes? random with probability 0.5?
asciimonster {l Wrote}:Hiker however, is not having any problems. I'm not quite sure how the two observations can be different for the same source code...
int indx = rand() % next.size();
int indx = (int)((float)rand()*(float)next.size()/(float)RAND_MAX);
acme_pjz {l Wrote}:I think you shouldn't write random select code in this way, because rand's internal implementation is usually mulitiply-add pseudo-random number generator. So usually the result of rand() is odd,even,odd,even... so if next.size()==2 ,then indx is 1,0,1,0... completely not random. Instead, you should write code like this:
acme_pjz {l Wrote}:
- {l Code}: {l Select All Code}
int indx = rand() % next.size();
I think you shouldn't write random select code in this way, because rand's internal implementation is usually mulitiply-add pseudo-random number generator. So usually the result of rand() is odd,even,odd,even... so if next.size()==2 ,then indx is 1,0,1,0... completely not random. Instead, you should write code like this:
Users browsing this forum: No registered users and 1 guest