Re: TIB: "Weighting" Dice on TI-85


[Prev][Next][Index][Thread]

Re: TIB: "Weighting" Dice on TI-85




Notice the parenthesis?  There is a reason they are there.  There was one
little thing wrong with it (the way I used it anyway), but I fixed that.

I used  the following
:(int(rand*SIZE-WEIGHTF)+int(rand*WEIGHTF+WEIGHTF)+1)->RROLL
:If RROLL>SIZE:Then:RROLL->SIZE:End:
:If RROLL<1:Then:RROLL->0:End

WEIGHTF being the weight factor.  The higher it is the greater the weight
differential. If it's 0, it all cancels down to the standard
(int(rand*SIZE))+1.  It starts producing a lot of the highest values if the
WEIGHTF variable approaches too close to the RROLL variable (or 1's if
WEIGHTF is too close, but opposite), but it works pretty well as long as
WEIGHTF is a reasonable value.  I have some more code in the program that
works it in so that the user can enter a percentage and it will act
similarly with any size die.  Try it out.  It works.

J

>> >Try this formula:
>> >:int(rand*sides-2)+int(rand*2+1)+1->die1
>
>Errhh...Come again? Try reducing this, using simple algebra:
>
>= int(rand*sides)+int(rand*2)-2+1+1
>= int(rand*sides)+int(rand*2)
>Try this with 6 sides
>= {0,1,2,3,4,5} *join* {0,1}
>Which yields:
>P(0) = 1/12
>P(1) = 2/12
>P(2) = 2/12
>P(3) = 2/12
>P(4) = 2/12
>P(5) = 2/12
>P(6) = 1/12
>
>Let's say you eliminate all zeros.
>I see 6 coming up half as often as every other possibility...
>
>> >it isn't as accurate as defining ranges, but this will weight the die in
>> favor
>> >of higher numbers.  I assume that the numbers start with 1, not 0.
>> Depending
>> >on how you store the die values, you could put this into a for loop for
the
>> >number of die.  I'm not sure what you want to do with them, so i'll just
>> leave
>> >it like this.
>> > Paul Chase II
>
>Tell me you wrote the wrong thing and that you actually didn't do it
>like this, and Jeremy, tell me you didn't use it without checking... :-/
>
>--
>          Rene Kragh Pedersen
>------------------------------------------------------------------
>man: Why did you get a divorce?
>man:: Too many arguments.


Follow-Ups: