1,760 questions
316
votes
22
answers
363k
views
Simple state machine example in C#?
Update:
Again thanks for the examples, they have been very helpful and with the following, I don't mean
to take anything away from them.
Aren't the currently given examples, as far as I understand ...
188
votes
4
answers
44k
views
What is an actual difference between redux and a state machine (e.g. xstate)?
I am working on investigation of one front-end application of medium complexity. At this moment it is written in pure javascript, it has a lot of different event-based messages connecting few main ...
104
votes
6
answers
33k
views
Is a Markov chain the same as a finite state machine?
Is a finite state machine just an implementation of a Markov chain? What are the differences between the two?
82
votes
8
answers
168k
views
state machines tutorials [closed]
I am just wondering if anyone know of some good tutorials on the Internet for developing state machines. Or ebooks?
I am starting working on state machines and just need something general to get me ...
70
votes
8
answers
157k
views
How to implement a FSM - Finite State Machine in Java
I have something to do for work and I need your help.
We want to implement a FSM - Finite State Machine, to identify char sequence(like: A, B, C, A, C), and tell if it accepted.
We think to implement ...
64
votes
1
answer
2k
views
Akka finite state machine instances
I am trying to leverage Akka's finite state machine framework for my use case. I am working on a system that processes a request that goes through various states.
The request here is the application ...
53
votes
12
answers
59k
views
Python state-machine design
Related to this Stack Overflow question (C state-machine design), could you Stack Overflow folks share your Python state-machine design techniques with me (and the community)?
At the moment,...
51
votes
3
answers
6k
views
Why does this take so long to match? Is it a bug?
I need to match certain URLs in web application, i.e. /123,456,789, and wrote this regex to match the pattern:
r'(\d+(,)?)+/$'
I noticed that it does not seem to evaluate, even after several minutes ...
41
votes
16
answers
16k
views
Is there a programming language with built-in state machine construct?
I am just curious if there is a programming language which has state machines (similar to boost::statechart) as primary language construct.
Analogies - c# has delegates where java uses the observer ...
36
votes
2
answers
62k
views
Workflow engine in Javascript [closed]
Does anybody know a workflow engine (such as Spring WebFlow) for Javascript? We have a home-made framework that allows us to guide site navigation using JSON, but its quality is far from good.
Edit ...
35
votes
9
answers
44k
views
Java enum-based state machine (FSM): Passing in events
I'm using several enum-based state machines in my Android application. While these work very well, what I am looking for is a suggestion for how to elegantly receive events, typically from registered ...
32
votes
3
answers
4k
views
Algorithm for implementing C# yield statement
I'd love to figure it out myself but I was wondering roughly what's the algorithm for converting a function with yield statements into a state machine for an enumerator? For example how does C# turn ...
32
votes
4
answers
29k
views
What is the difference between state machine and workflow?
I want to learn what is the difference between "State machine" and "workflow", and how is it any different from "State machine workflow"?
31
votes
5
answers
20k
views
How to Make a Basic Finite State Machine in Objective-C
I am attempting to build an FSM to control a timer in (iphone sdk) objective c. I felt it was a necessary step, because I was otherwise ending up with nasty spaghetti code containing pages of if-then ...
28
votes
4
answers
13k
views
implementing a state machine using the "yield" keyword
Is it feasible to use the yield keyword to implement a simple state machine as shown here. To me it looks like the C# compiler has done the hard work for you as it internally implements a state ...
23
votes
6
answers
57k
views
Mealy v/s. Moore
What is the difference between Mealy & Moore type of finite state machines?
22
votes
6
answers
7k
views
Validation before persistance on state_machine gem
What is the correct syntax for performing a validation on before a transition in the state_machine gem?
I've tried the following,
before_transition :apple => :orange do
validate :validate_core
...
21
votes
1
answer
14k
views
Basic State Machine setup using Stateless
I have some fairly simple state needs (for now). I think I would like to model these using the Stateless api. (But I don't really know much about state machines, so I could be wrong.)
But I am ...
20
votes
5
answers
8k
views
Passing variables to Rails StateMachine gem transitions
Is it possible to send variables in the the transition? i.e.
@car.crash!(:crashed_by => current_user)
I have callbacks in my model but I need to send them the user who instigated the transition
...
20
votes
5
answers
13k
views
.NET Workflow Engine Suggestions [closed]
I came across stateless, a hierarchical state machine framework based on Simple State Machine for Boo, but configured using C# 3.0
It is easy to configure and use, I will probably use it soon.
But I ...
19
votes
9
answers
24k
views
State machines in C
What is the best way to write a state machine in C?
I usually write a big switch-case statement in a for(;;), with callbacks to re-enter the state machine when an external operation is finished.
Do ...
19
votes
2
answers
19k
views
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 ...
18
votes
1
answer
4k
views
What is the purpose of IAsyncStateMachine.SetStateMachine?
Interface IAsyncStateMachine can be used only by compiler, and is used in generating state machine for async methods. Interface has SetMachineState - configures the state machine with a heap-allocated ...
17
votes
4
answers
8k
views
Rails: How to test state_machine?
Please, help me. I'm confused. I know how to write state-driven behavior of model, but I don't know what should I write in specs...
My model.rb file look
class Ratification < ActiveRecord::Base
...
16
votes
2
answers
9k
views
What's the difference of Petri Nets and Finite State Machines? [closed]
Both of them represent the different states a system can take. So what is the difference of Petri Nets and Finite State Machines? When do I use Petri Nets, and when do I use Finite State Machines?