Post Reply 
Little explorations with HP calculators (no Prime)
04-04-2017, 12:22 PM (This post was last modified: 04-04-2017 12:25 PM by pier4r.)
Post: #117
RE: Little explorations with the HP calculators
I hope to finish this simulation quickly, since I miss solving some brilliant problems, they were a more intense but smaller endeavor and moreover pushed in different directions with a lot of math.

So now for the swiss tournament format (or also the knockout format) I need to shuffle a list. For my searches I did not find anything for it on the AUR or on this forum.

The first idea that I have is the following:

- given a list
- go through it with the STREAM command using the following program
-- get the previous element and the new element from the list
-- get a random number, the new element would be on the stack L1 if the random number is less than 0.5, otherwise on L2, while the previous element on L1.

So it would be like a bubble sort, but actually being a bubble shuffle.


Second idea, using the - for me difficult to visualize and therefore possibly chaotic - stack operations.

- given a list
- explode it
- save the number of elements
- for a certain number of iterations, take a random integer between 1 and the number of elements in the list, then execute ROLL (or ROLLD)
- build back the list.

Does someone knows if better implementations were already done in userRPL? If yes, links or clues would be appreciated.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with the HP calculators - pier4r - 04-04-2017 12:22 PM



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