Skip to content

Commit

Permalink
game-scores map
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanmai committed Aug 1, 2012
1 parent f382e03 commit dba1a73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/yuan/game/alpha_beta_pruning.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
(binding [*turn-fn* turn-fn
*eval-fn* eval-fn
*current-player* (trace :turn (turn-fn board))]
(let [f (opportunistic (comp (partial ab-get-rating-max 1 -1)
(let [f (opportunistic (comp (partial ab-get-rating-max
(game-scores :win)
(game-scores :lose))
limit-tree-depth))
ratings (trace :ratings (f tree))
best (apply max ratings)]
Expand Down
4 changes: 4 additions & 0 deletions src/yuan/game/game_tree.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

(def ^:dynamic *ai-level* 5)

(def game-scores {:win 1
:draw 0
:lose -1})

(defn game-tree
[make-move board]
{:board board
Expand Down

0 comments on commit dba1a73

Please sign in to comment.