Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN

Shuf shuf shuffled

shuf perm pok winner n nTrials ex|
[ winner := pok deal: perm. ] on: Exception do: [ :e | 
    Transcript show: 'Exception on input:'; cr; show: perm; cr.
    Transcript show: e description; cr; show: 'Breaking...'; cr.
    n := nTrials + 1.
    ex := true.
].
(ex not) & (winner class ~= Array) ifTrue: [ 
    Transcript show: 'On input:'; cr; show: perm; cr.
    Transcript show: 'You returned: '; cr; show: winner.
    Transcript show: ' ('; show: (winner class); show: ')'; cr.
    Transcript show: 'Output must be an Array. Breaking...'; cr.
    n := nTrials + 1.   
    ex := true.
]. 
(ex not) & (winner size ~= 5) ifTrue: [ 
    Transcript show: 'On input:'; cr; show: perm; cr.
    Transcript show: 'You returned: '; cr; show: winner; cr.
    Transcript show: 'Output Array must contain five elements'; cr.         Transcript show: 'Breaking...'; cr.
    n := nTrials + 1.   
    ex := true.
]. 
(ex not) ifTrue: [ 
    winner do: [ :e | e class ~= ByteString ifTrue: [ ex := true. ]].
    ex ifTrue: [  
        Transcript show: 'On input:'; cr; show: perm; cr.
        Transcript show: 'You returned: '; cr; show: winner; cr.
        Transcript show: 'Output Array must contain ByteStrings'; cr.           Transcript show: 'Breaking...'; cr.
        n := nTrials + 1.   
    ].
].
n := n + 1.
Copyright © 2009-2023 UrgentHomework.com, All right reserved.