amycherven

56 Reputation

2 Badges

16 years, 301 days

MaplePrimes Activity


These are answers submitted by amycherven

thank you all so much! i think i finally have it! once again thanks for all your help!

ok i tried to but that into my program and i set T equal to {op(map(x->[x,Occurrences('x',rolls)],rolls))}; then i put sort(T,(a,b)->a[2]>b[2]); next and the output for the sort is the same as the output for T

example:

>rolls := ['rand(1..6)'()$5];

                  rolls := [4, 5, 4, 5, 1]

>T:= {op(map(x->[x,Occurrences('x',rolls)],rolls))};

                  T:= {[1, 1], [4, 2], [5, 2]}

>sort(T,(a,b) -> a[2] > b[2]);

                  {[1, 1], [4, 2], [5, 2]}

not sure what's going on??

ok i tried to but that into my program and i set T equal to {op(map(x->[x,Occurrences('x',rolls)],rolls))}; then i put sort(T,(a,b)->a[2]>b[2]); next and the output for the sort is the same as the output for T

example:

>rolls := ['rand(1..6)'()$5];

                  rolls := [4, 5, 4, 5, 1]

>T:= {op(map(x->[x,Occurrences('x',rolls)],rolls))};

                  T:= {[1, 1], [4, 2], [5, 2]}

>sort(T,(a,b) -> a[2] > b[2]);

                  {[1, 1], [4, 2], [5, 2]}

not sure what's going on??

ok i tried to but that into my program and i set T equal to {op(map(x->[x,Occurrences('x',rolls)],rolls))}; then i put sort(T,(a,b)->a[2]>b[2]); next and the output for the sort is the same as the output for T

example:

>rolls := ['rand(1..6)'()$5];

                  rolls := [4, 5, 4, 5, 1]

>T:= {op(map(x->[x,Occurrences('x',rolls)],rolls))};

                  T:= {[1, 1], [4, 2], [5, 2]}

>sort(T,(a,b) -> a[2] > b[2]);

                  {[1, 1], [4, 2], [5, 2]}

not sure what's going on??

ok i have more questions!

I've written the code:

> rolls := ['rand(1..6)'()$5];

rolls := [1, 4, 6, 6, 5]

> {op(map(x->[x,Occurrences('x',rolls)],rolls))};

{[1, 1], [4, 1], [5, 1], [6, 2]}

which simulates a random roll then gives the occurrence of the different numbers that come up. i can't figure out how to take this and have the program choose the number  that came up the most to set aside then reroll the remaining dice.

i think that if i can figure that out then i can just create a loop that would take the saved dice and put it together with the rerolled dice and then do the occurrences thing again to determine which had the most come up then save and reroll again.

does this make sense and how should i go about doing this?

help!

yes thank you very much. i'll look it over and try to mess around with it a little and if i have anymore questions i'll post again! thanks again!

ok but how would i get the program to tell me how many rolls it would take to get yahtzee?

Page 1 of 1