I'm trying to wrap my head around how to architect this project. I've got
some functional programming experience (with Haskell), but am pretty new to
Lisps, and feel a bit lost without the type system.

So. The project is a chess AI. Now the nice thing is, there's a protocol for
interacting with a chess AI, and a UI built on top of that protocol. So one
thing I know I want to do is write an implementation of that protocol, so
that my AI can be interacted with using the UI. Great.

This is where it gets tricky for me. I very much want the ability to be able
to try things out with different engines. So I want to be able to write
something like:

(ns my.namespace (:use [winboard]))

(def engine ...)

(def main (run-winboard engine))

Seems straightforward enough. My difficulty though comes in trying to figure
out how to write the winboard bit. I know how to do the IO stuff, that's
pretty trivial. But, let's say I'm ready to ask the engine what move to make
in a particular position. The engine itself should provide a function that
takes a position and returns a move. But...and this is where my old OO
mindset is probably kicking in...there's no way to do something like
engine.getMove(position), and it does have "its own" functions.

There is only one way I can think of: engine is itself a function. When run,
it returns a map. One key in the map is, e.g., :get-move. The value at that
key is the desired function. But...this seems rather hackish. I'm sure
there's some obvious clojure-ish/lisp-ish way of doing this, and it's just
not coming to me. Any suggestions?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to