Questions tagged [finite-state-machine]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
2answers
189 views

Designing a builder as a compile-time state machine

I'm working on a text GUI library which comes with builders for UI components (Buttons, Panels, etc). I have a base class for these builders which I'd like to redesign so that meaningless component ...
1
vote
1answer
84 views

What is a good technique to process an event stream to ensure sequential or transactional consistency

I am trying to improve an event-driven processing system, which is having a few problems because the events are not guaranteed to arrive in the correct chronological sequence. This is due to batching ...
2
votes
2answers
102 views

Hierarchical State Machine (HSM) superstate and substate sharing event

I am learning HSMs and I can see a problem that I don’t know how to address. The problem is shown in the image bellow. Inside S1, substates S11 and S12 are continuously changing in reaction to ...
0
votes
0answers
73 views

Linear “steps” of operations considered a state machine?

I have a set of tasks I perform to complete some larger operation. These tasks must be executed in linear order, and you cannot proceed onto the next task until the previous completes. For the most ...
1
vote
1answer
187 views

Problem in creating a correct finite-state-machine for a given short text

I like to create a finite-state machine for the given text below. While solving this, I came accross with several problems I listed at the bottom. (This example is in terms of testing (where you later ...
1
vote
0answers
40 views

Byzantine Failures - Client Voter and Replica on Same Processor

I need help understanding the following text from section 4.2 on this paper: Implementing Fault-Tolerant Services Using the State Machine Approach: A Tutorial Dependent-Failures Output ...
-1
votes
1answer
106 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
543 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
469 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
139 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
166 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
349 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
110 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
87 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
66 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
245 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
289 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
3k 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
1k 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
133 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
43 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
107 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
3k 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. ...
2
votes
1answer
1k 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
84 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 ...
4
votes
2answers
552 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
827 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
250 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
153 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
631 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
311 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
1k 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 ...
4
votes
2answers
3k 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
1k 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
470 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
838 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
115 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
874 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 ...
3
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
176 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 '...
8
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. ...
4
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
2k 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
326 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
825 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
218 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
137 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
674 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
484 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 ...