4

Does anyone have a solution for a basic, compact Finite state machine/automata written in Objective-C code?

I am interested in reusable components so that the FSM have states added and actions defined that use reusable state classes.

Brock Woolf
  • 46,656
  • 50
  • 121
  • 144

5 Answers5

2

I've found a good solution. This is the best choice for Objective-C I have ever seen. Enjoy ;) https://github.com/est1908/SimpleStateMachine

rickerbh
  • 9,731
  • 1
  • 31
  • 35
Radislav
  • 2,892
  • 7
  • 38
  • 61
0

I've just posted a Class-based Objective-C Finite State Machine on Github. It's not so much that it has reusable classes, as it provides protocols and abstract classes for you to reuse other classes. I'm currently using this in a project that already has network REST API objects that really needed to be organized as a state machine. I changed the superclasses from NSObject to inherit from the state machine and the state and a few other methods and I could reorganize the code as a Deterministic Finite Automata.

https://github.com/StCredZero/SCZ-ObjC-StateMachine

StCredZero
  • 464
  • 3
  • 13
0

I did this in Java. Might be ported... In addition to the reusable components, the state machine itself can be defined in an array (as data), which makes it really easy to use.

http://code.google.com/p/state-machine/

If you wanted to try to port it, I could probably help.

Bill K
  • 62,186
  • 18
  • 105
  • 157
  • Excellent. I have already written one in C++ for a university game that I wrote. I'll take a look at yours. – Brock Woolf Jul 10 '09 at 17:37
  • Okay it looks like a big project. In that case I am busy for the next few days I will have to take a look at it afterwards. – Brock Woolf Jul 10 '09 at 17:40
0

What you want is a rules engine... oddly, I was able to find only one for objective-C (BDRuleEngine) and that is rather out of date:

http://eschatologist.net/bDistributed.com/index.html

It might be the best starting point though, unless you want to port something.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
  • Nope, not looking for a rules engine. A basic FSM with reusable classes is what I want. I wrote one in about 200 lines of C++ in about 3 classes. Hoping someone had one already coded in Obj-C. looks like ill have to do it myself. – Brock Woolf Jul 12 '09 at 15:13
  • 3
    Why is the one answer you said was totally off the mark the checked one? And why did you not come back and update this with what you ended up doing? (Kind of makes its value significantly less here.) – Rob Oct 28 '13 at 22:36
0

take a look here http://www.sinelabore.com It translates UML state charts into Objective-C (beside C/C++).

Peter

Besi
  • 22,579
  • 24
  • 131
  • 223