source: scenarios/GerminationX/oak/src/oak/spirit.clj @ 900

Revision 900, 1.6 KB checked in by dave, 10 years ago (diff)

added spirit.clj

Line 
1;; Copyright (C) 2010 FoAM vzw
2;; This program is free software: you can redistribute it and/or modify
3;; it under the terms of the GNU Affero General Public License as
4;; published by the Free Software Foundation, either version 3 of the
5;; License, or (at your option) any later version.
6;;
7;; This program is distributed in the hope that it will be useful,
8;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10;; GNU Affero General Public License for more details.
11;;
12;; You should have received a copy of the GNU Affero General Public License
13;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
15
16(ns oak.spirit
17  (:use
18   oak.vec2
19   oak.remote-agent
20   oak.forms)
21  (:require
22   clojure.contrib.math))
23
24(defrecord spirit
25  [tile
26   pos
27   name])
28
29(defn make-spirit [remote-agent]
30  (println (str "creating spirit for " (remote-agent-name remote-agent)))
31  (spirit.
32   (make-vec2 0 0)
33   (make-vec2 0 0)
34   (remote-agent-name remote-agent)))
35 
36(defn spirit-update [spirit remote-agent]
37  (comment println (:name spirit))
38  (println (map
39            (fn [emotion]
40              (if (= (:tag emotion) :Mood)
41                (list "Mood" (:content emotion))
42                (let [e (:attrs emotion)]
43                  (list (:type e) (:cause e)))))
44            (:content (remote-agent-emotions remote-agent))))
45  (comment println
46   (map
47    (fn [relation]
48      (list (:tag relation)
49            (map
50             (fn [chunk]
51               (list (:tag chunk) (:content chunk)))
52             (:content relation))))
53    (:content (remote-agent-relations remote-agent))))
54  spirit)
Note: See TracBrowser for help on using the repository browser.