Giter VIP home page Giter VIP logo

act-r-client's Introduction

ACT-R-Client (under development)

This library makes an ACT-R Client available for .NET (>= 4.5) projects. It needs ACT-R Version 7.6 (currently in beta) or higher since this is the first version with the new JSON-RPC interface called dispatcher. I highly recommend to read the ACT-R RPC Interface Documentation for a better understandig how the ACT-R dispatcher works.

How to use the ACT-R Client

You can install the library to your project via Nuget:

Install-Package ACT-R-Client

Afterwards you can create an ActRClient object:

// since ActRClient implements IDisposal it can be used in an using block
using (ActRClient actr = new ActRClient("127.0.0.1", 2650)) // change host and port to your needs
{
  // do what you need to do
}

With this object you can interact with the ACT-R dispatcher.

Add / Remove Command to the dispatcher

For adding commands to the dispatcher you have to create an AbstractAddCommandRequest instance and send it to the dispatcher:

// add command
AbstractAddCommandRequest addCommandRequest = new AddCommandRequest(KeyPressAction, "published-name",
  "private-name", "Documentation");
actr.AddDispatcherCommand(addCommandRequest);

// remove command
actr.RemoveDispatcherCommand(addCommandRequest);
// or
actr.RemoveDispatcherCommand("private-name");

The AddCommandRequest is a implementation of the abstract class AbstractAddCommandRequest, which uses a simple delegate for command evaluations. Of course you can implement your own AbstractAddCommandRequest class to handle the evaluation requests from the dispatcher as you want to.

Add / Remove Monitor to the dispatcher

Adding a command monitor is very similar to adding a command:

// add monitor
MonitorRequest dispatcherMonitor = new MonitorRequest("command-to-monitor", "command-to-call");
actr.AddDispatcherMonitor(dispatcherMonitor);

//remove monitor
actr.RemoveDispatcherMonitor(dispatcherMonitor);
// or
actr.RemoveDispatcherMonitor("command-to-monitor", "command-to-call");

Evaluate a command by the dispatcher

There are about 100 implemented "ready to use" methods for the most common ACT-R functions, like load-act-r-model, reset, run, ...

// load model
actr.LoadActrModel("ACT-R:tutorial;unit2;demo2-model.lisp");
// reset ACT-R scheduler and model
actr.Reset();
// open experiment window
Window window = actr.OpenExpWindow("Letter difference", true);
// add text to experiment window
actr.AddTextToWindow(window, "A", 125, 150);
// install device
actr.InstallDevice(window);
// run model
actr.Run(10, true);

At the moment only a few are tested, so erros can be occure (please let me know if you found one and i will fix it). If you want to make a different request you have to implement the abstract class AbstractEvaluationRequest, adding all necessary parameter to the given parameterList within the AddParameterToList method. This AbstractEvaluationRequest can then be send to the dispatcher.

// example AbstractEvaluationRequest implementation for the "my-command"
public class MyCommand : AbstractEvaluationRequest
{
  public MyCommand(int intPara, bool boolPara, string stringPara, string model = null) : base("my-command", model)
  {
    IntPara = intPara;
    BoolPara = boolPara;
    StringPara = stringPara;
  }
  public int IntPara { set; get; }
  public bool BoolPara { set; get; }
  public string StringPara { set; get; }

  public override void AddParameterToList(List<object> parameterList)
  {
    parameterList.Add(IntPara);
    parameterList.Add(BoolPara);
    parameterList.Add(StringPara);
  }
}

// let the dispatcher evaluate my-command
AbstractEvaluationRequest myCommandRequest = new MyCommand(0, false, "StringParameter");
Result result = SendEvaluationRequest(myCommandRequest);

Example

The Example Project contains some implementations of the ACT-R tutorials.

act-r-client's People

Contributors

nyctico avatar

Stargazers

Sina S avatar

Watchers

James Cloos 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.