 (ns gobanbot.flow
   (:require [clojure.string :as s]
             [clojure.set :as ss]
+            [clojure.tools.logging :as log]
             [gobanbot.storage :as storage]))
 
 (defn moves-to-mvc [moves] (zipmap (map :mv moves) (map :color moves)))

            (cond (not wid) :wid
                  (not bid) :bid))))

(defn decide-move 
  [{:keys [moves bid wid ended started] :as game} uid mv]
  (let [bwid (next-bwid game uid)
        color (cond (= bwid :bid) "b" (= bwid :wid) "w")]
    {:bwid bwid
     :color color
     :status
     (cond 
       (not game) :no-game
       (not color) :not-a-player
       (= started 0) :not-started

(defn is-move? [size value]
  (let [max-letter (-> size (+ 96) char str)]
  (if-not (empty? value)
    (re-find (re-pattern
               (str
                 "^[a-"
                 max-letter
                 "]{2}$|^pass$|^resigni$"))
             value))))

(defn next-bwid [{:keys [bid wid handicap]} uid]
