state-machines

How to design a state machine in face of non-blocking I/O?

I'm using Qt framework which has by default non-blocking I/O to develop an application navigating through several web pages (online stores) and carrying out different actions on these pages. I'm "mapping" specific web page to a state machine which I use to navigate through this page. This state machine has these transitions; Connect, Log...

State Machine Implementation

I'm looking for some general Optimization Correctness Extensibility advice on my current C++ Hierarchical State Machine implementation. Sample variable isMicOn = false variable areSpeakersOn = false variable stream = false state recording { //override block for state recording isMicOn = true //here, only isMicOn is...

Finite State Machine and inter-FSM signaling

Recommendations for languages with native (so no FSM generation tools) support for state machine development and execution and passing of messages/signals. This is for telecoms, e.g implementation of FSMs of this level of complexity. I have considered Erlang, but would love some feedback, suggestions, pointer to tutorials, alternatives,...

Parsing wiki markup using a state machine

I would like to parse a simple grammar such as wiki markup using state machines. I have never written or played with one. I would like to lean how to implement a simple one. I am thinking of using Clojure for this. My question is can you point me to some good tutorials that are for complete newbies on this topic such as my self? ...

How can I access a collection of acts_as_state_machine states for a particular rails model?

Is it possible to access the collection of states for the given model: class Conversation include AASM aasm_initial_state :unread aasm_state :unread aasm_state :read aasm_state :closed aasm_event :view do transitions :to => :read, :from => [:unread] end aasm_event :close do transitions :to => :closed, :from => [:read, :unrea...

How to write state machines with c#?

I need to write state machines that run fast in c#. I like the Windows Workflow Foundation library, but it's too slow and over crowded with features (i.e. heavy). I need something faster, ideally with a graphical utility to design the diagrams, and then spit out c# code. Any suggestions? Thanks! ...

Create a diagram HTML5 HTML parsing algorithm

HTML5 describes an algorithm for parsing HTML. It is based on state machines. What is the best way to create a diagram for this algorithm? ...

What's the best(when performance matters) way to implement a state machine in C#?

I came up with the following options: Using the goto statement: Start: goto Data Data: goto Finish Finish: ; using the switch statement: switch(m_state) { case State.Start: m_state = State.Data; break; case State.Data: m_state = State.Finish; break; case State.Finish: break; } using goto and switch toge...

C state-machine design

I am crafting a small project in mixed C and C++. I am building one small-ish state-machine at the heart of one of my worker thread. I was wondering if you gurus on SO would share your state-machine design techniques. NOTE: I am primarily after tried & tested implementation techniques. UPDATED: Based on all the great input gathered o...

Can a finite state machine transition to a previous state?

I know that a FSM can transition to the next state and even to the current state, i.e. a state that transitions to itself, but is it legal to have a state transition to a previous state (state C transition to state B)? ...

State based testing(state charts) & transition sequences

Hello I am really stuck with some state based testing concepts... I am trying to calculate some checking sequences that will cover all transitions from each state and i have the answers but i dont understand them: Now the answers i have are : I dont understand it at all. For example say we want to check transition a/x from s1, wo...

Rails error handling with AASM state machine

I'm using the rubyist-aasm state machine for handling the different states in my Event object (event initialized, event discussed, event published, etc.). I added guards to prevent state changes when certain conditions aren't met. This all works fine but it doesn't show any errors when a state change was rejected by the guard. Any idea...

Encapsulating a (pure Ruby) Ragel parser for infinite streams?

I want to parse a continuous stream of bytes (from a socket) with a state machine using Ragel However, all the Examples I have found are either parsing a complete file in one pass (like the Gherkin lexer or are using Ragels C Target (like the mongrel HTTP1.1 Parser) I'm looking for some advice or examples on how to instantiate a Ragel ...

Best Practice for Transitioning From Nested State to Nested State (see diagram)

I am trying to wrap my mind around the best way to implement nested state transitions in a single threaded programming language (Actionscript). Say I have a structure like this behavior tree: Now imagine that each leaf node is a destination point on a website, like an image in a gallery, or a comment nested in a post view nested in a ...

Does Model-View-Controller Play Nicely with Artificial Intelligence and Behavior Trees?

I come from an MVC background (Flex and Rails) and love the ideas of code separation, reusability, encapsulation, etc. It makes it easy to build things quickly and reuse components in other projects. However, it has been very difficult to stick with the MVC principles when trying to build complex, state-driven, asynchronous, animated a...

Python state-machine design

Related to this SO question (C state-machine design), could you SO folks share with me (and the community!) your Python state-machine design techniques? Update3: At the moment, I am going for an engine based on the following: class TrackInfoHandler(object): def __init__(self): self._state="begin" self._acc="" #...

High-Level Pattern for Dynamic Status Progression?

Have you ever encountered a situaton like this, and if so, how did you solve it? We have a record which goes through multiple stages of progression, such as: submission -> preliminary evaluation -> final review -> active The order of progression for these main status types is guaranteed. However, there are factors which complicate t...

Help on custom state transitions and persistance using "StateLess"

I am in the process of rewriting a data driven application in ASP.NET MVC and i am struggling to solve the following problem. The application allows the user to create one or more documents are to be reviewed by a chain of different type of reviewers. The reviews are done by users of different roles (Reviewer, Manager, FinanceApprover...

What problems have you solved using a Workflow Engine?

I'd like to know about specific problems you - the SO reader - have solved using Workflow Engines and what libraries/frameworks you used if you didn't roll your own. I'd also like to know when a Workflow Engine wasn't the best choice and if/how you chose something simpler, like a TaskList/WorkList/Task-Management type application using ...

A Simple State Machine using a Static class in C# to notify other subscribers via Events

I've been trying to write a simple Static-class State Machine for my application to notify other controls and code when the system state changes. And I think I almost have it, but I'm running into a small issue that I'm not sure how to work around. Here's the code: // An enum denoting the 3 States public enum Status { Error = -1, Work...