Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cards = [[1,2,3,4],[1,5,6,7],[1,8,9,10],[1,11,12,13],[2,5,8,11],[2,6,9,12],[2,7,10,13],[3,5,9,13],[3,6,10,11],[3,7,8,12],[4,5,10,12],[4,6,8,13],[4,7,9,11]]
num = [1..13].map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0])
cards[index] = card.map((a) -> num[a-1]).map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0]) for card,index in cards
cards = cards.map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0])
console.log card for card in cards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment