From 29bee36ad5f7ddd3462cd5118814b427bc70fcd1 Mon Sep 17 00:00:00 2001
From: Chris Kearney <chris@kearneymail.com>
Date: Sun, 14 Aug 2016 12:26:21 -0700
Subject: [PATCH] cards chat command

---
 .../creeper/bot/BotCommandFactory.java        |  6 +++-
 .../creeper/bot/commands/CardsCommand.java    | 33 +++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java

diff --git a/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java b/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java
index ef50a586..b6eb9077 100644
--- a/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java
+++ b/src/main/java/com/comandante/creeper/bot/BotCommandFactory.java
@@ -3,7 +3,10 @@ package com.comandante.creeper.bot;
 import com.comandante.creeper.bot.commands.*;
 import com.google.common.collect.Maps;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 public class BotCommandFactory {
 
@@ -17,6 +20,7 @@ public class BotCommandFactory {
         addCommand(new ImdbBotCommand(botCommandManager));
         addCommand(new ForecastCommand(botCommandManager));
         addCommand(new RandomRoomDescriptionCommand(botCommandManager));
+        addCommand(new CardsCommand(botCommandManager));
     }
 
     public BotCommand getCommand(String originalFullCmd) {
diff --git a/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java b/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java
new file mode 100644
index 00000000..1d216476
--- /dev/null
+++ b/src/main/java/com/comandante/creeper/bot/commands/CardsCommand.java
@@ -0,0 +1,33 @@
+package com.comandante.creeper.bot.commands;
+
+import com.comandante.creeper.blackjack.BlackJack;
+import com.comandante.creeper.blackjack.Deck;
+import com.comandante.creeper.bot.BotCommandManager;
+import com.google.api.client.util.Lists;
+import com.google.common.collect.Sets;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class CardsCommand extends BotCommand {
+
+    static Set<String> triggers = Sets.newHashSet("cards");
+    static String helpUsage = "cards";
+    static String helpDescription = "Some random cards.";
+
+    public CardsCommand(BotCommandManager botCommandManager) {
+        super(botCommandManager, triggers, helpUsage, helpDescription);
+    }
+
+    @Override
+    public List<String> process() {
+        Deck deck = new Deck();
+        deck.shuffle();
+        List<BlackJack.Card> cards = com.google.common.collect.Lists.newArrayList(deck.next(), deck.next(), deck.next(), deck.next(), deck.deal());
+        String asciiPlayingCardHand = BlackJack.getAsciiPlayingCardHand(cards);
+        ArrayList<String> resp = Lists.newArrayList();
+        resp.add(asciiPlayingCardHand);
+        return resp;
+    }
+}
-- 
GitLab