|
@@ -1,23 +1,10 @@
|
|
(ns bombnet.core
|
|
(ns bombnet.core
|
|
(:gen-class)
|
|
(:gen-class)
|
|
- (:require [bombnet.game :refer :all]))
|
|
|
|
-
|
|
|
|
-(defn print-state [state]
|
|
|
|
- (let [{:keys [board players bombs explosion]} state
|
|
|
|
- coords (fn [{[x y] :pos}] [y x])
|
|
|
|
- coords2 (fn [[x y]] [y x])
|
|
|
|
- draw-players (fn [board] (reduce #(assoc-in % (coords %2) "@") board players))
|
|
|
|
- draw-bombs (fn [board] (reduce #(assoc-in % (coords %2) "Q") board bombs))
|
|
|
|
- draw-explosion (fn [board] (reduce #(assoc-in % (coords2 %2) "X") board explosion))
|
|
|
|
- board2 (-> board
|
|
|
|
- draw-explosion
|
|
|
|
- draw-bombs
|
|
|
|
- draw-players)
|
|
|
|
- string (reduce #(str % "\n" (reduce str %2)) "" board2)]
|
|
|
|
- (println string)))
|
|
|
|
|
|
+ (:require [bombnet.console :refer :all]
|
|
|
|
+ [bombnet.game :refer :all]))
|
|
|
|
|
|
(defn -main
|
|
(defn -main
|
|
- "I don't do a whole lot ... yet."
|
|
|
|
|
|
+ "I don't do a whole lot ... yet"
|
|
[& args]
|
|
[& args]
|
|
(-> (new-game [{:id 1 :name "Thomas"}])
|
|
(-> (new-game [{:id 1 :name "Thomas"}])
|
|
(queue-action 1 {:type "bomb" :timer 1})
|
|
(queue-action 1 {:type "bomb" :timer 1})
|