     (PUT url {:params {:actions actions}
               :format :json
               :handler game-deployed
+              :error-handler error-loading-action})))
+
+(defn- play-game
+  "Plays a game"
+  [ev]
+  (let [actions (or (state/get-state :current-actions) [])
+        game (state/get-state :original-game-data)
+        player-code (get-in game ["viewed-by" "player-code"])
+        token (state/get-state :token)
+        game-id (state/get-state :game-id)
+        url (str "http://api.orionsbelt.eu/game/" game-id "/turn?token=" token)]
+    (state/set-state :processing-action actions)
+    (PUT url {:params {:actions actions}
+              :format :json
+              :handler game-played
               :error-handler error-loading-action})))
 
 (defn- add-action

      (empty? (get-in state [:original-game-data "board" "stash" player-code])) "disabled"
      :else "")))

(defn- render-action-console
  "Renders the action management console"
  [state]

    (dom/input #js {:type "text" :id "newAction" :className "form-control"})
    (dom/button #js {:id "resetActionButton" :onClick reset-actions :className "btn btn-default"} "Reset")
    (dom/button #js {:id "addActionButton" :onClick add-action :className "btn btn-info" :disabled (add-action-disabled state)} "Add")
    (dom/button #js {:id "deployButton" :onClick deploy-game :className "btn btn-info" :disabled (deploy-disabled state)} "Deploy")
    (dom/button #js {:id "playButton" :onClick play-game :className "btn btn-info" :disabled (play-disabled state)} "Play")))

(defn- render-game
  "Renders the index page"
