Code Monkey home page Code Monkey logo

agents-experiment's Introduction

agents

Toy language to simulate beer consumption, derived after too many beers with Stefan.

Usage

$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal configure
$ cabal run
Linking dist/build/agents/agents ...
                         _       
                        | |      
   __ _  __ _  ___ _ __ | |_ ___ 
  / _` |/ _` |/ _ \ '_ \| __/ __|
 | (_| | (_| |  __/ | | | |_\__ \
  \__,_|\__, |\___|_| |_|\__|___/
         __/ |  Version 0.0                 
        |___/   Type :help for help               

Agents> :help
:run          Run the loaded program
:reload       Run the active file
:show         Dump the AST of active file
:load <file>  Load a program from file

Agents> :load simple.world
Loading simple.world

Agents> :run
[Tick] Start 1
[Entity] station
[Cond] Gte (Var "timer") (Const 10) ==> Fl
[Action] INC: timer 1
[Entity] tourist
[Action] DEC: health 1
[Cond] Eq (Var "health") (Const 0) ==> Fl
[Cond] And (Lt (Var "health") (Const 5)) (Not (Var "thirsty")) ==> Tr
[Action] SET Tag "thirsty"
[Cond] And (Gt (Var "health") (Const 5)) (Var "thirsty") ==> Fl
[Cond] Var "beer" ==> Fl
[Tick] Finished 1
...

Agents> :show
[ ObjectDecl
    Object
      { _name = "restaurant"
      , _measure = [ Measure { _mname = "beer" , _mval = 100 } ]
      , _tags = fromList []
      , _actuators = []
      }
, ObjectDecl
    Object
      { _name = "station"
      , _measure = [ Measure { _mname = "timer" , _mval = 1 } ]
      , _tags = fromList []
      , _actuators =
          [ Actuator
              (If (Gte (Var "timer") (Const 10)))
              [ Create "tourist" , Zero "timer" ]
          , Actuator Always [ Inc "timer" 1 ]
          ]
      }
...

Agents> ^D
Goodbye.

agents-experiment's People

Contributors

sdiehl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.