Skip to content

Instantly share code, notes, and snippets.

@pelensky
Last active August 11, 2017 10:20
Show Gist options
  • Save pelensky/c8f05423fc8d7152b96e90991ebeff3a to your computer and use it in GitHub Desktop.
Save pelensky/c8f05423fc8d7152b96e90991ebeff3a to your computer and use it in GitHub Desktop.
All functions required for Network Computer Player Lambda
(ns computer
(:gen-class
:methods [[handler [networkplayer.BoardObject] Long]]) )
(declare negamax)
(def starting-depth 0)
(def starting-colour 1)
; Code removed
(defn choose-space [board-state]
(let [board (get-board board-state)]
(if (> 2 (count board))
(if (.contains board 4) 0 4)
(negamax board-state starting-depth starting-colour (find-computer-marker board-state)))))
(defn -handler [this board-object]
(let [board-state (read-string (.getBoardState board-object))]
(choose-space board-state)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment