Skip to content

Commit e41c2ad

Browse files
committed
Better ai function
1 parent 5e5dc68 commit e41c2ad

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/gomoku/stupid_ai.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
[x y]))
66

77
(defn is-cell-occupied? [state pos]
8-
(some true? (for [cell state]
9-
(= (:pos cell) pos))))
8+
(contains? (set (map :pos state)) pos))
109

1110
(defn get-move [state board-width board-height]
1211
(let [all-positions (get-all-positions board-width board-height)

0 commit comments

Comments
 (0)