All Downloads are FREE. Search and download functionalities are using the official Maven repository.

alloy-ggp-base.0.0.15.source-code.sample_gamer.clj Maven / Gradle / Ivy

The newest version!
(ns gamer_namespace
  (:import [org.ggp.base.player.gamer.statemachine StateMachineGamer]
           [org.ggp.base.util.statemachine.implementation.prover ProverStateMachine]))

;; An implementation of a sample random gamer in Clojure.
;; -Sam Schreiber
(defn SampleClojureGamer []
  (proxy [StateMachineGamer] []
    ;; NOTE: the implicit 'this symbol is bound to the local class.

    (getInitialStateMachine []
      (ProverStateMachine.))

    (stateMachineSelectMove [timeout]
      (let [state-machine (.getStateMachine this)
            current-state (.getCurrentState this)
            role          (.getRole this)
            random-move   (.getRandomMove state-machine
                                          current-state
                                          role)]
        random-move))

    (stateMachineMetaGame [timeout]
      (println "SampleClojureGamer metagame called"))

    (stateMachineAbort []
      (println "SampleClojureGamer abort called"))

    (stateMachineStop []
      (println "SampleClojureGamer stop called"))))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy