This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def suits = ['❤️', '♠️', '♣️', '♦️'] | |
| def cards = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] | |
| def deck = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [cards, suits].combinations().each { | |
| deck << it.join() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Collections.shuffle(deck) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| println "Shuffled deck--> ${deck}" | |
| def hands = [ [], [], [], [], [], [], [], [] ] | |
| def cardsPerPlayer = 2 | |
| (0..cardsPerPlayer-1).each { | |
| hands.each { | |
| it << deck.remove(0) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // community cards | |
| def communityCards = [] | |
| def burnPile = [] | |
| def deal = { int c = 0 -> | |
| burnPile << deck.remove(0) | |
| (0..( c - 1 )).each { | |
| communityCards << deck.remove(0) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shuffled deck--> [8♣️, 9♦️, 6♣️, 8♠️, 3♠️, 7♠️, 5♦️, K♠️, 2♠️, 3♦️, 6♠️, K♣️, 5♣️, 4❤️, 7❤️, 3❤️, 4♣️, 9❤️, Q♦️, A♦️, 6❤️, Q❤️, 2♣️, 7♣️, 4♦️, K❤️, 2♦️, 5❤️, 5♠️, A♣️, 7♦️, 2❤️, 9♠️, J♠️, 3♣️, 6♦️, 10♣️, 10♦️, K♦️, J♦️, 9♣️, A♠️, J❤️, 10❤️, J♣️, 10♠️, 4♠️, Q♠️, Q♣️, A❤️, 8❤️, 8♦️] | |
| Player hands--> [[8♣️, 2♠️], [9♦️, 3♦️], [6♣️, 6♠️], [8♠️, K♣️], [3♠️, 5♣️], [7♠️, 4❤️], [5♦️, 7❤️], [K♠️, 3❤️]] | |
| Flop --> [9❤️, Q♦️, A♦️] | |
| Turn --> [9❤️, Q♦️, A♦️, Q❤️] | |
| River --> [9❤️, Q♦️, A♦️, Q❤️, 7♣️] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| // put your setup code here, to run once: | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| // put your setup code here, to run once: | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define SENSOR A0 | |
| #define LED 9 | |
| #define BUZZER 11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| pinMode(SENSOR, INPUT); | |
| pinMode(LED, OUTPUT); | |
| pinMode(BUZZER, OUTPUT); | |
| Serial.begin(9600); | |
| } |
OlderNewer