diff options
| author | Jed Barber <jjbarber@y7mail.com> | 2014-05-07 02:06:41 +1000 | 
|---|---|---|
| committer | Jed Barber <jjbarber@y7mail.com> | 2014-05-07 02:06:41 +1000 | 
| commit | 1f9c9ee4864d90ddf6d726f99b5ea179f225d612 (patch) | |
| tree | bbfbd67d2a23eefe1e2aef2ff5d4106ceedd35c2 /src/Thue | |
| parent | 5044a550bdc0e50431f982d4f35ab3841f000252 (diff) | |
Exposed rule application order and version 2a parsing at command line
Diffstat (limited to 'src/Thue')
| -rw-r--r-- | src/Thue/Interpreter.hs | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/src/Thue/Interpreter.hs b/src/Thue/Interpreter.hs index c3bdde2..2b0461d 100644 --- a/src/Thue/Interpreter.hs +++ b/src/Thue/Interpreter.hs @@ -1,4 +1,6 @@  module Thue.Interpreter ( +    Choice(..), +      thue,      extractInfix,      nextInRange @@ -18,14 +20,15 @@ data Choice = Random StdGen -thue :: ThueProgram -> IO ThueState -thue program = +thue :: ThueProgram -> Maybe Choice -> IO ThueState +thue program order =      let rules = thueRules program          state = thueInitialState program          version = thueVersion program          gen = mkStdGen 4 --chosen by fair dice roll, guaranteed to be random +        choice = if (isJust order) then fromJust order else Random gen -    in interpret version rules (Random gen) state +    in interpret version rules choice state | 
