File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 (>= (count @board-state) (* cells-horizontal cells-vertical)))
3232
3333(defn make-move! [player move-pos]
34- (if (gameplay/is-cell-occupied? @board-state move-pos)
34+ (if (or (gameplay/is-cell-occupied? @board-state move-pos)
35+ (gameplay/is-cell-outside-bounds? move-pos cells-horizontal cells-vertical))
3536 (println " Can't place move for player " player " on " move-pos)
3637 (swap! board-state conj (gameplay/create-move player move-pos))))
3738
Original file line number Diff line number Diff line change 1111 (some true ? (for [cell board]
1212 (= (:pos cell) pos))))
1313
14+ (defn is-cell-outside-bounds? [[x y] w h]
15+ (not (and (<= x 0 )
16+ (<= y 0 )
17+ (< x w)
18+ (< y h))))
19+
1420(defn get-moves-for-player [board player]
1521 (filter #(= player (:player %)) board))
1622
You can’t perform that action at this time.
0 commit comments