Post Reply 
HHC 2015 RPN programming Contest is now open
10-02-2015, 05:22 PM (This post was last modified: 10-02-2015 06:05 PM by C.Ret.)
Post: #71
RE: HHC 2015 RPN programming Contest is now open
(10-02-2015 01:01 PM)David Hayden Wrote:  See if you can put this into RPL:
input: stack levels 1-5 contain the values of the 5 die in the roll
output: level 1 is 0 if there is a small straight, a non-zero number otherwise.

On HP-49/50g, I would have preferred a list of the 5 dices as an input on level 1: only.
The output remains the same; level 1: contains values 1. or 0. respectively when no or one small straight is present in the list.

Code:

« 2. SWAP ^ R→B « OR » STREAM BIN →STR "1111" POS NOT »


Note that this code is not limited to only 5 dices. List of any size are acceptable.
As well as dice values not limited from 1 to 6. Any values from 0 up to 63 are possible. A small straight is found as soon as (at least a set of) 4 integers are contiguous.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2015 RPN programming Contest is now open - C.Ret - 10-02-2015 05:22 PM



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