Skip to main content

Questions tagged [state-machine]

A state machine is a model for designing systems which change based upon their current state and what input they receive.

22 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
0 answers
352 views

STTCL FSM framework based on the GoF State Pattern, Part I: The basic interfaces

Preface I have decided to let my pet project created some years ago to undergo a code review here. The review will be broken into parts according to meta question Multiple reviews or one big review?...
πάντα ῥεῖ's user avatar
6 votes
0 answers
197 views

Character-based transitions (part of a lexer)

As part of my prep for the Code Review community-challenge (which looks like it will be Write your own programming language), I've been working on an LL(1) lexer generator in Rust. Yes, lexer ...
CAD97's user avatar
  • 1,944
5 votes
0 answers
2k views

Reducing complexity in NSView event handling code in Swift

My Cocoa event code always tends to descend into madness, I need to advice on how to reduce complexity. I've spend a few hours putting this example together. CanvasView is a layer hosting subclass of ...
boyfarrell's user avatar
4 votes
0 answers
721 views

Finite Automata stub in Rust

I wrote a finite automata implementation in C years ago. C's access to mutable, unsafe, raw pointers made it quite simple for me to link/relink the states of a finite automata. I read the official ...
John's user avatar
  • 323
4 votes
0 answers
1k views

C++ Finite State Machine - follow-up

This question is a follow-up from Object Oriented Finite State Machine. I vastly improved commenting and followed the suggestions from the answer. Additionally, I improved my tests and did some more ...
Justin's user avatar
  • 3,295
3 votes
0 answers
107 views

static macro-based State Machine implementation

While learning Rust for the past couple of weeks, I set out to use the type-system to build a static State Machine implementation in Rust. The goals: program in idiomatic Rust no runtime overhead ...
JeanMertz's user avatar
  • 131
3 votes
0 answers
93 views

Finite State Machine to segment Thai syllables

I am developing a FSM to segment Thai syllables with the following rules: Here are my util functions: ...
erip's user avatar
  • 926
3 votes
0 answers
62 views

"Academic interest" implementation of a Finite State Machine

Context I'm playing around the concept of a Finite State Machine. While I understand the basic principles behind it, I want to implement a simple, yet generic class which could be reused in the ...
Igor Soloydenko's user avatar
3 votes
0 answers
62 views

STTCL FSM framework based on the GoF State Pattern, Part II: Abstraction of asynchronous/concurrency features

Preface I have decided to let my pet project created some years ago to undergo a code review here. The review will be broken into parts according to meta question Multiple reviews or one big review?...
πάντα ῥεῖ's user avatar
3 votes
0 answers
440 views

Linear finite state machine in ES6

I would love some feedback on my linear finite state machine. I say linear, as it can only handle one state at a time. I am also giving my method of how I -work- with the state machine, as I would ...
bitten's user avatar
  • 181
3 votes
0 answers
40 views

Backbone.model based state machine

I have created a class to keep track of some internal states. You can see it as a very simple implementation of a state machine ...
Anthony Kong's user avatar
3 votes
0 answers
125 views

Extracting dynamic behaviors of state machines to modules

This is my initial class. (I am not trying to reinvent state-flows again, just practicing) As you can see straight forward, it dynamically generates methods like .recommend,.recommend!, ....
roxxypoxxy's user avatar
2 votes
0 answers
54 views

Deterministic and nondeterministic finite automata in scheme

This is the implementation of both Deterministic Finite Automata (DFAs) and Nondeterministic Finite Automata (NFAs) on r7rs scheme, using only SRFI 1. The file automata.scm contains the implementation ...
phillbush's user avatar
  • 864
2 votes
0 answers
37 views

define a lisp function, that takes fsm , a transition and state-index and return the state obtained by the transition from the state

The state machine has the below specifications (defparameter *test-machine* (make-fsm :alphabet '(a b) :table '((2 1) (0 2) (1 0)) :initial 0 :accepting '(2))) ...
Ssunsshine's user avatar
2 votes
0 answers
148 views

Lock-free state machine

I've written a lock-free state machine in go and I would love to receive some feedback on it. Writing this library my main concerns are keeping it lock-free and very light-weight (no bells and ...
Eyal's user avatar
  • 309
2 votes
0 answers
139 views

Knuth Morris Pratt substring search algorithm

Below you can find a Kotlin based implementation of the Knuth-Morris-Pratt substring search algorithm. ...
gil.fernandes's user avatar
2 votes
0 answers
67 views

Time-dependent state machine with two outputs

Given a class BasicDataFeed whose purpose is to feed questions and answers into an artificial neural network, which is tested in a non-negotiable manner as follows: ...
Seanny123's user avatar
  • 1,527
2 votes
0 answers
92 views

STTCL FSM framework based on the GoF State Pattern, Part III: Policy based design of higher level State Machine constructs

Preface I have decided to let my pet project created some years ago to undergo a code review here. The review will be broken into parts according to meta question Multiple reviews or one big review?...
πάντα ῥεῖ's user avatar
2 votes
0 answers
80 views

String matching

I recently came across a lecture on DFA. I tried to use it to determine whether a given 'search string' is found in the 'input string'. Please tell me if there is a better way. ...
Rajesh Bhat's user avatar
1 vote
0 answers
192 views

Self Running iterable state machine with Enums in Java

During development I needed to design a state machine with decision which runs to completion and performs state transition without the need to wait for events. So i come up with the following ...
Makis Papapanagiotou's user avatar
1 vote
0 answers
148 views

Finite State Machine

I'm beginner in rust. I would ask code review of my finite state machine. Main feature : static (event, state and transition) support pushdown It is the first step, second step is to use macro ...
Vaillant Etienne's user avatar
1 vote
0 answers
66 views

Simple Unity program for a research experiment

I'm developing a small C# Unity application to display stereoscopic images as part of a wider research study. Since the experiment consists of unique stages (Start, during a trial, between trials, ...
Richard Robinson's user avatar