 (defn- get-stash
   "Gets the current stash"
   [game]
-  (or
-    (get-in game ["battle" "stash" "p1"])
-    (get-in game ["battle" "stash" "p2"])))
+  (println game)
+  (if (empty? (get-in game ["battle" "stash" "p1"]))
+    (get-in game ["battle" "stash" "p2"])
+    (get-in game ["battle" "stash" "p1"])))
 
 (defn- game-stash
   "Shows the current stash if available"

        current-action (state/get-state :processing-action)
        new-actions (conj actions current-action)
        current-game (state/get-state :game-data)
        updated-game (assoc current-game "battle" (get data "board"))]
    (println updated-game)
    (state/set-state :game-data updated-game)
    (state/set-state :current-actions new-actions)

            [cljs.reader :as reader]
            [secretary.core :as secretary :refer-macros [defroute]]))

(defn- normalize-board
  "Uses p2-focused-board if present"
  [data]
  (println "--normalize-board")
  (println data)
  (if (data :p2-focused-board)
    (-> data
        (assoc :board (data :p2-focused-board))
        (dissoc :p2-focused-board))
    data))

(defn- game-loaded
  "After game was loaded"
  [data]
  (state/set-state :loading-game nil)
  (state/set-state :player-code (get-in data ["viewed-by" "player-code"]))
  (let [final-data (normalize-board data)]
    (state/set-state :original-game-data final-data)
    (state/set-state :game-data final-data)))

(defn- error-loading
  "Error loading game"
