Python
import random def pounts(p): if p == 1: return 1000 else: return p*100 def greed(): d=sorted(random.choices(range(1,7),k=5)) print(d) dice = 1 p = 0 while len(d) > 0: if d.count(dice) >= 3: p += pounts(dice) del d[:4] elif (d[0] == 1 or d[0] == 5) and (dice == 5 or dice == 1): if d.count(1) == 2 or d.count(5) == 2: p += int(100 if d[0] == 1 else 50) * 2 del d[:2] else: p += int(100 if d[0] == 1 else 50) d.pop(0) dice += 1 else: if d[0] == dice and d.count(dice) == 1: d.pop(0) elif d[0] == dice and d.count(dice) == 2: del d[:2] dice += 1 return p
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python