viewer that reads code from the DB
authorJoachim Breitner <mail@joachim-breitner.de>
Sun, 17 May 2009 21:23:00 +0000 (23:23 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Sun, 17 May 2009 21:23:00 +0000 (23:23 +0200)
src/dbclient.hs [new file with mode: 0644]

diff --git a/src/dbclient.hs b/src/dbclient.hs
new file mode 100644 (file)
index 0000000..bd99c72
--- /dev/null
@@ -0,0 +1,15 @@
+import Lseed.Data
+import Lseed.DB
+import Lseed.Grammar.Compile
+import Lseed.Grammar.Parse
+import Lseed.Logic
+import Control.Applicative
+
+getGarden = spread <$> map (either (error.show) compileGrammarFile . parseGrammar "" . dbcCode)
+                  <$> getCodeToRun
+  where spread gs = zipWith (\g p -> Planted ((p + 0.5) / l) g (Stipe () 0 [])) gs [0..]
+         where l = fromIntegral (length gs)
+
+main = do
+       garden <- getGarden
+       runGarden garden