npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

orion-lionet

v1.7.0

Published

based-component state machine engine, suitable for games and simulation

Downloads

370

Readme

lionet

based-component state machine engine, suitable for games and simulation

Principle

模型体系包含2种组件:Atomic和Coupled, Coupled组件由若干Atomic和Coupled组成。

  • 每个组件都是一个状态机,包含若干输入事件端口(Inport)、输出事件端口(Outport)和状态(Phase)
  • 组件在若干状态之间变换,当状态发生变化时,可以向外发送事件
  • 当组件接受到输入事件时,可以根据事件来决定下一步动作,继续保持当前状态或者切换状态
  • 每个状态都有一个生命时间Sigma,当生命耗尽时,触发动作决定下一个状态
  • 组件可以通过不断组合,形成十分复杂的Coupled组件

Install

  npm install orion-lionet

Usage

Lionet.Atomic

Atomic组件基类,什么也不做,用于派生出Atomic组件模型 需要实现的接口函数:

  • initialize() 用于组件初始化
  • deltext(delta, msg) 外部事件处理回调函数,当接受到外部事件时触发
  • deltint() 内部状态转换回调函数,当状态的生命时间Sigma耗尽时触发
  • output() 生成当前状态的输出事件,例如更新状态、发送通知等

示例代码

import Lionet from ‘orion-lionet'

class Simple extends Lionet.Atomic {
  constructor(config){
    super(config)
    this.__step__ = config.step
    this.__msgid__ = 0
  }

	initialize(){
    this.addInport('in')
    this.addOutport('out')
    this.holdIn(Lionet.Utils.devs.state.Passive, this.__step__)
  }

	deltext(delta, msg){
    if (msg) {
      for(let content of msg.contents()){
        if (content.port === 'in') {
          console.log('receiving event: ' + content.event.toJson())
        }
      }
    }
    this.resume(delta)
  }

	deltint(){
    this.holdIn(Lionet.Utils.devs.state.Passive, this.__step__)
  }

	output(){
    let msg = new Lionet.Message()
    let evt = new Lionet.Event()
    evt.setParam('Number', this.__msgid__++)
    msg.setContent('out', evt)
    return msg
  }
}

AtomicSimulator

Demo

TODO

  • 增加状态修改接口,由仿真器传递到各个Atomic模型中
  • 增加与决策引擎联通接口,仿真引擎修改黑板,决策引擎生产决策Action

Release Notes

v1.1 实现引擎克隆接口