Dice roll results
05-24-2020, 04:05 PM
Post: #1
 Tonig00 Member Posts: 55 Joined: May 2016
Dice roll results
Hello

I am blocked. Any help welcome.

I want to put in a matrix the possible variations of throwing t dice of c sides.
For 3 dice of 3 sides will be something like (3^3 lines):
[[111][112][113][121][122][123][131][132][133][211]….[333]]

My initial aproach is:

EXPORT TossDice(toss,sides)
BEGIN
LOCAL i,j,k,f,c,p,r;
f:=sides^toss;
c:= toss;
MAKEMAT(f,c)▶r;
p:=1;

FOR i FROM 1 TO f DO

FOR j FROM c+1-p DOWNTO 1 DO

FOR k FROM 1 TO c DO

r[i+k-1,j]:=k;

END;

END;

END;

END;

It is a function similar to rolldie() in R software (prob package).

It does not work and it seems to me that I would have to nest a lot of "for" loops to get it. I do not think is the way to get it.
May be in the forum it has appeared before, if so tell me where.

Thanks very much for your help

Toni
 « Next Oldest | Next Newest »

 Messages In This Thread Dice roll results - Tonig00 - 05-24-2020 04:05 PM RE: Dice roll results - victorvbc - 05-24-2020, 06:02 PM RE: Dice roll results - ijabbott - 05-24-2020, 09:15 PM RE: Dice roll results - Carlos295pz - 05-24-2020, 11:28 PM RE: Dice roll results - Tonig00 - 05-25-2020, 06:28 PM RE: Dice roll results - pinkman - 05-25-2020, 10:04 PM RE: Dice roll results - pinkman - 05-25-2020, 10:08 PM RE: Dice roll results - Tonig00 - 05-26-2020, 11:05 PM RE: Dice roll results - lmmt61 - 05-28-2020, 07:03 AM RE: Dice roll results - Tonig00 - 05-30-2020, 03:31 PM

User(s) browsing this thread: 1 Guest(s)