Skip to content

Commit

Permalink
feat: use update where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesreprise committed Dec 11, 2023
1 parent 03c6d35 commit 20f5950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions server/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:license {:name "GNU AGPL v3"
:url "https://www.gnu.org/licenses/agpl-3.0.en.html"}
:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/core.async "1.6.673"]
[org.clojure/core.incubator "0.1.4"]
[org.clojure/tools.logging "1.2.4"]
[ch.qos.logback/logback-classic "1.4.11"]
Expand Down
4 changes: 2 additions & 2 deletions server/src/mfc/game.clj
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
([game double-info]
(cond (>= 3 (:count double-info)) (move-current-player-to game -1)
:else (roll game))
(when (:doubles double-info) (take-turn game {:doubles true :count (inc (:count double-info))}))))
(when (:doubles double-info) (take-turn game (update double-info :count inc)))))

(defn increment-turn-counter [game]
(update game :turn + 1))
(update game :turn inc))

(defn next-player [game]
(assoc game :current-player (mod (+ 1 (:current-player game)) (count (:order game)))))
Expand Down

0 comments on commit 20f5950

Please sign in to comment.