Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [finite-state-machine]

The tag has no usage guidance.

0
votes
1answer
73 views

Will FSM be a good solution?

At work, we are creating an android app. We have a business logic module for talking to an API for CRUD operations. The app I'm working on, the UI module, speaks to the business logic module to create,...
1
vote
2answers
205 views

Can a state machine transition depend on the previous state?

I was wondering what the state machine for a video player would be like. I can think of two states : playing and paused. When the video is playing and the user clicks on a point in the progress ...
1
vote
1answer
45 views

What is the relationship between event driven design and state machines/charts?

I'm trying to understand event driven design better and have not picked up a book on it yet. But just from others explaining it to me it seems to be really similar to state machines/charts. What are ...
0
votes
2answers
122 views

How to handle state of an object? And how to enrich the state transition logic?

I am designing a class that has a state. I wonder if I should expose that state in the interface in view of allowing a decorator to enrich the state transition logic. Shall my design expose ...
0
votes
2answers
95 views

If a business's workflow steps can reside solely in a database, is there a reason to use a workflow engine to accomplish those steps?

I found various libraries in C#, PHP, Python, etc. for workflows. By workflow I mean something like an employee wants personal time and that request starts with the employee and finishes in some ...
4
votes
2answers
337 views

Why do I need a game loop with states, instead of init the next state in current state directly?

For example, it is common to see games with game loop and states: stateChanged(){ switch(state){ STATE.PLAYER_SELECT_CHARACTER: this.currentController=new PlayerSelectCharacterController()...
0
votes
0answers
59 views

Hierarchical state machine. Is there a term for the deepest nested state in a state configuration?

A flat state machine has one active state. In a hierarchical state machine (HSM), if the HSM is in a child state, it's also in it's parent state. So, an active state configuration of an HSM consists ...
0
votes
2answers
76 views

Can my state machines use state that is derived from model data?

I'm putting together some ideas and personal conventions on how to configure state machines when using a language specific library. Because I'm adding state machines to existing model classes in my ...
2
votes
1answer
60 views

Using state machines when managing remote resources

So I’ve got a service I’m trying to clean up. It responds to requests by starting a stopped server on Amazon EC2, waiting for it to come online, then configures a 3rd party piece of software on the ...
-2
votes
1answer
159 views

Finite State Machine odd number of bc at the end

I had this question in a school test: Design a non-deterministic FSM that receives all words over {a,b,c} that: Start with cc. Contain at least 1 ab or aca. Ends with an odd number of (...
1
vote
1answer
200 views

Why are next-state function and output functions of an FSM combinational functions?

From my understanding, combinational logic is dependent solely on input, and sequential logic involves state--memory. When explaining a finite state machine (FSM), however, it is said that an FSM ...
1
vote
4answers
2k views

So what exactly is a final state of a finite state machine?

I am playing around the state machine concept trying to better understand the best areas of their application. The formal definition of an FSM contains the following elements: finite non-empty set of ...
0
votes
1answer
1k views

Finite State Vending Machine Diagram

In class, we are asked to draw a finite state machine with the following instructions: Design a finite state machine to model a vending machine that accepts only quarters and gives a container of ...
1
vote
1answer
547 views

State machine with database records

I was re-learning about state diagrams this weekend, and realized that I may have been using them for years without realizing it. Suppose i have an order record, with a bunch of fields including ...
2
votes
2answers
106 views

How to model a statemachine in this case

I have a system where lot of messages come and go over network, each message to be sent or received goes through several states, state change occurs based on external events for example if the linked ...
0
votes
0answers
35 views

How do I know the depth of “k” for characterising set when testing FSM?

I am supposed to design the tests for state machine software. I have covered all states and all transitions. The last step is to detect the hidden states (states that look the same but internally ...
0
votes
0answers
80 views

Design for consuming list items for a state machine like structure

I'm trying to improve this document parser and there is one main loop that goes over all of the main elements (let's call them Nodes). Each step (Step) can either Consume or Ignore the Node that it is ...
4
votes
4answers
2k views

How should state machines handle exceptions in actions?

State machines, for example UML state machines, statecharts or other finite state machines, allow actions to be executed when a state machine takes a transition between states or is within a state. ...
3
votes
1answer
758 views

How does one combine the state pattern and the component pattern?

Suppose we have a class Player with classes PhysicsComponent, InputComponent and StandingState, DuckingState. The class Player itself does not have an input function, the InputComponent does. But ...
0
votes
1answer
57 views

Do I have to state the value of elapsed time in state-charts?

I am modelling a system that requires a state-chart before implementation. Given These Images: Main Questions: Can I use the word "Elapsed Time" if I do not know how long it will take to finish the ...
5
votes
2answers
429 views

A simple GUI app: states

I'm making a Windows Forms app: It is client-server. Authorization, then load some data from server, then send back some statistics from time to time. You should go through a bootstrapping procedure, ...
7
votes
2answers
601 views

How to store and validate data between state transitions?

I'm developing a largeish application that will have custom finite state machines. That is, the admin users of the application will be able to create their own state machines, limited by little pieces ...
3
votes
1answer
195 views

UML “direct substate” vs “transitively nested substate”

I am reading through Wikipedia's page on UML state machines. I don't understand where it says: A nested state is called a direct substate when it is not contained by any other state; otherwise, ...
3
votes
1answer
149 views

In OOP which object is common to update the state of an object when working with State Machines?

I'm about to implement my first State Machine and I'm left with one question, which is the acceptable coding form on who should change the state of the object/entity? Should the StateMachine change ...
4
votes
2answers
492 views

Trouble with circular dependency in state machine design

I am trying to develop the structure for a basic state machine that can also take in input and produce output. I've hit a bit of a mental block in trying to figure out how to model the relationship ...
2
votes
1answer
308 views

Is state pattern a wise architecture for a diagram application?

I'm designing a vector drawing app. I need to implemente copy and paste, shapes insertion, deletion and transforming while still being capable of including new tools with easy in the future. The way ...
3
votes
1answer
830 views

State machine with additional variable

When implementing a state machine and it comes to the fact that a transition depends on an external boolean a, or an enum value b which can be one out of three (which are set somewhere else in the ...
3
votes
2answers
2k views

Language to describe Finite State Machine

I'm doing a lot of code analysis using lexer and finite state machine. For time being I'm using table to describe FSM: | token | current state | target state | +-------+---------------+--------------+...
1
vote
2answers
934 views

State Design Pattern

I've come across the following State Design Pattern which seems extremely logical and simple to implement: class CeilingFanPullChain { private State m_current_state; public ...
0
votes
1answer
352 views

How do I manage a large state graph when building a scaleable finite state machine?

Lately I've been working on a project that involves parsing a toy domain-specific-language. While building it out, I realized that an efficient way to handle parsing tokens would be to represent the ...
6
votes
3answers
690 views

Can a generic piece of C code be converted to an FSM?

I understand that any language worth its salt can encode a Finite state machine. My question is the opposite, is it possible to convert an arbitrary piece of code ( say in C ) to a functionally ...
2
votes
4answers
114 views

How to explain to a vendor that when erroneous data is deleted/deactivated the application future state should be as if the data was never entered?

A major application we use has a bug that the vendor is calling (a swear word in our business) "working as designed". As a programmer / system analyst this is a bug - and against all I have been ...
7
votes
1answer
725 views

Finite state machine menu design

I'm creating an FSM in python (it's a step sequencer and sample pad based on a Raspberry Pi 2). Right now there are two states and the third is the Menu. This is handled by a class System which ...
2
votes
1answer
2k views

What is the alternative design pattern of a state machine that may have recursive state change?

I have a state machine like code, which has state A,B and C, with a function changeState(char i) which can change the state of a system, and each state can also call changeState(char i) to switch the ...
2
votes
2answers
174 views

Is there a well defined notion of 'before' and 'after' in finite state machines?

When working with finite state machines, is there or can there be a well defined concept of 'before' and 'after'. The ordering would, for example, tell me that one state is always considered to be '...
7
votes
4answers
2k views

How is a state machine different from any other computer program?

I have seen several implementations of "State Machines" on github. As far as I understand, a state machine takes input that may or may not transform its state into one of a finite set of other states. ...
3
votes
1answer
1k views

Should I use the State Design pattern for only two states? Also, what if one object's state is affected by another state?

If you only have two states for an object, is it worth it to still use the State Design pattern? The context is a multi-player, turn-based game environment where there are Game "Tables" that a player ...
3
votes
2answers
1k views

Should I use multiple state machines for a layered protocol?

When implementing a layered communications protocol are layers commonly implemented as state machines? I have an implementation of PMBus I am currently working on for an embedded device. I have a ...
2
votes
0answers
292 views

Finite State Machine user input tree

I'm drawing a Finite State Machine (which I'll have to implement later on) which is semi-automatic, i.e. some transitions require user input, some are decided on internal value. The problem is that ...
3
votes
1answer
742 views

Model of simple traffic simulation [closed]

I want to write a simple traffic simulation with one road intersection. First I thought of a cellular automata in the model but it should not be limited by an underlying discrete grid system so the ...
3
votes
2answers
212 views

Is there a good way (pattern) for adding a state to a finite state machine

So I'm working on a roguelike, and planning to represent the monsters using a finite state machine spot PC wander------------------->move ^ ^ | | \ ...
0
votes
1answer
132 views

How should I design a wizard for generating requirements and documentation

I'm currently working in an industry where extensive documentation is required, but the apps I'm writing are all pretty much cookie cutter at a high level. What I'd like to do is build an app that ...
1
vote
1answer
652 views

Implementing state-driven agents within an Entity-Component-System approach

A state-driven agent is an agent that performs an action based on its current state. The logic can be implemented through the use of a D-FSM that changes state depending on the Agent's "perception" ...
3
votes
1answer
475 views

How to process document state transition?

Imagine there is an application (ASP.NET MVC) that processes some documents. The document must be revised several times by different group of users. state/role rules: simple user can only publish ...
2
votes
0answers
475 views

State Pattern Code for embedded device - Dependency Injection of Device Objects in Context and State Classes

I'm wrestling with some code and I think I've finally gotten some state pattern code working with my events. I've got a simplified system that will work like this: This is my first go with State ...
5
votes
1answer
154 views

How to Recover from Inconsistent Job State without Database Polling

I'm working on scaling an application which is currently polling a mySQL database to send async jobs to a background processing system. A state machine is being used to keep track of the entities ...
5
votes
1answer
5k views

How to Implement a Parallel Workflow

I'm trying to implement a parallel split task using a workflow system. I'm using .NET but my process is very simple and I don't want to use WF or anything heavy like that. I've tried using Stateless. ...
2
votes
2answers
2k views

Dependency injection with Finite State Machines and the Interface Segregation Principle

I am trying to figure out what is the best way to setup a FSM and also keep my interfaces clean and use an IOC container to use DI. Let's just visit the Head First design pattern textbook example of ...
4
votes
2answers
577 views

Can all business logic be decomposed as a (declarative) state diagram on simple crud operations and conditionals?

This seems an extreme question probably but I'm wondering anyhow: Can all business logic be decomposed as a (declarative) state diagram on simple crud operations and conditionals? Already a lot of ...
1
vote
1answer
214 views

Converting a DFA to an NFA

I have an assignment to convert various language descriptions into NFAs and DFAs. Having graduated with my CompSci B.S. years ago and not touching the topic until my M.S. program, I am racking my ...