Giter Club home page Giter Club logo

automata's Issues

Validate user opts to the `use Automaton` macro.

Let's add required fields validation, error handling
for user_opts in Automaton.Config.Parser using the Ecto.Schema validation protocol

The NodeTypeError for user_opts[:node_type] is just a string message now, we should make some real error types.

Turn WorldConfig into a struct.

In lib/automata/automata.ex.

So we can use embedded schema without a database, and eventually probably also make automaton_config a struct too

Create an `assets/` directory

  1. Move all images from the root dir into an assets dir

  2. Search and replace all links to images and replace with new assets/ path

Add Factories / Fixtures

It would be nice to have Factories similar to FactoryBot for ruby/rspec. Is there a good library for elixir? If not, can we setup fixtures?

Tick/Update tree runs out of order

Right now with the else clause here commented out, when you run iex -S mix, the tree runs once in the correct order, but when you uncomment the else clause, it runs out of order. I am assuming this is because Process.send_after runs async. But this will not work with BT updates

Should we forget about ticking the entire tree(subtree) and just store the currently running node somewhere as recommended in some BT literature, or should we try to get this working so we have more fine grained control of subtree tick frequencies? One could imagine scenarios in which a control node should update at a high or low frequency relative to others.

Write Tests for AutomatonServer

We need tests for this as it is one of the trickier logics. Not great for beginners but good first issue for a senior dev.

Define protocols and data flows for control processes

right now lib/core/control/behavior.ex has the basic API.

TODO:

  1. what are the functions that the user will have to define and/or override? Can we get away with just having them define the update function.

  2. Once we know this we can decide how the params will be passed, perhaps as a map or keyword list.

Run a basic mock tree and tick and update the nodes.

Does the NodeSupervisor become the root source of the tick traversal? Or is it in the root user-defined node?

Is it feasible to have a per node tick_freq rather than a tick_freq for the entire user-defined tree? Seems doable but we need to think through all implications and determine if this is the way to go.

Performance Audit

  1. Determine best way to increase performance by starting subtree nodes as needed or some other such mechanism to avoid starting the whole BT on application start.

  2. Determine the best way to prevent ticking the whole tree when started and running. Perhaps a zipper tree can be used to store the tree at the root and only update currently running node as long as it is running otherwise re-update entire tree.

Set up project to be able to perform dialyzer and docs mix tasks

It is desirable to be able to run both the dialyzer and docs mix tasks after every change to automata. They should be run before a PR for a change is requested.

To effect this, dialyxer and ex-doc needs to be added as dependencies to mix.ex

See issues #6, #7 and #9

This should probably be done earlier than later in the project's life. It is my understanding that in a couple of weeks (end of Feb?) there might be some significant changes to automata although this should not affect changing automatas dependencies.

Please read the online help for Elixir's dialyzer and docs. tasks.

setup basic unit testing for `lib/core/control/automaton.ex`

Setup a good skeleton with elixir testing best practices would be a big step forward for the project.

See the BTSK (behavior tree starter kit) for examples of whats important to test for the abstract stuff in the API. That would be a great starting point.

Convert all start_link calls to use SHA hashes as names, via the Registry "via tuple".

Using atoms as name option in start_link is bad for scalability. Since these are not garbage collected, using them will eventually cause the BEAM to run out of memory. Lets use unique SHA hashes as names using the via tuple contract provided by Registry.

Use unique content hashes for names of nodes and eventually Distributed Hash Tables for resource discovery (like kademlia). SHA hashes provide versioning and avoid name collisions. For example, reusing an action would be unique from another version even though the user used the same module. Two versions of same module can do different things also. Each version runs in separate process. No namespace collisions. One could have thousands of the same module running as processes. This is a very good thing for programming large systems.

Handle user update asynchronously

Find a way to pass a function to state in user-defined update function so that the update can be run async as a Task so subsequent ticks will return :bh_running until the task completes (which sets the resulting status). This makes the agent reactive. Or is there a better more elixir way to do this? I'm thinking similar to this:

  def handle_cast({:run, fun}, state) do
    Task.async(fun) # sends a message back to the automaton when completed
    {:noreply, state}
  end

  # handle_info/2 receives generic messages from the Task processes
  def handle_info({_task, {:ok, result}}, state) do
    new_state = %{state | status: result}
    {:noreply, new_state}
  end

  def handle_info({_task, {:error, reason}}, state) do
    state = %{state | status: :bh_failure, fail_reason: reason}
    {:noreply, state}
  end

First Test for the Mock Sequence

Create simple behavioral test for the MockSeq1. Test that it runs all of it's children, one after the other in time, where no successor runs before a predecessor (since we aim to be fully async).

We can either use espec or the elixir builtin testing library. We can setup the TestMockSeq1 to have more children (simple actions would be best) for now until we get factories or fixtures.

Typespecs for currently defined functions.

In order to provide type checking we should go through and add typespecs for the currently defined functions so we get nice compiler errors and extra documentation from them.

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.