|
For those not familiar with state machines, I'd go read up on them quickly. Has anyone found a good use in programming for states? Outside of robot design (ai specifically), I haven't found a real good use for states and was wondering if you guys have any good examples. Obviously there are states at a small level in that a key is pressed or not and stuff. I'm talking about high level design. Edit: I should elaborate that I do realize most programming breaks down to a huge set of states with broad input (ie proboards actions = states and thread IDs = input)
Last Edit: Feb 24, 2011 17:47:06 GMT by Chris
|
|
|
|
|
Entities in game use them extensively. I'm also using a primitive state machine in my UI for an app I'm developing.
|
|
|
|
|
Entities in game use them extensively. I'm also using a primitive state machine in my UI for an app I'm developing. Got any examples in games? Nothing comes to mind just thinking of them.
|
|
|
|
|
Game AI, mostly. I'd imagine its very similar to robot AI. A door in a game might have 4+ states, open,closed,closing,opening,locked,unlocked
Last Edit: Feb 24, 2011 17:49:47 GMT by Simie
|
|
|
|
|
Game AI would be a good example as well. I relate that to robot AI which I mentioned above, but also a reasonable thing. I don't consider a door to be a state machine by the original definition I was taught... I consider it just a standard class with properties: class Door { locked = false closed = false } Something like that. (Pseudo-code ftl.) However, I can see where that makes sense. I was talking more along the lines of where a large portion of the code switches based on the state. Web-apps are the best example (which is why I mentioned PB) in that action is the state and thus they switch the entire program based on that. I didn't think to look at small pieces of code as a state machine though, so doors are a good example.
|
|
|
|
|