Advertisement

how to describe the logic

Started by October 02, 2003 01:03 PM
1 comment, last by sravan 21 years, 1 month ago
Dear Users, I am working on VC++ using OpenGL API.In my project i have to describe the logic between states.When ever an event is performed there should be a state transition and an action.Like this there are many states and many state transitions. Can anyone suggest me a good logic for implementing this.Are there any free libraries for doing this. can anyone please give links where i can get code relevant to this. Your comments and suggestions will be much appreciated. Thanks in advance Shravan
Such systems are known as finite state machines (FSM). The logic for a given FSM is dependent on its domain of use. Thus, you need to design the state transitions yourself. One way to do this is to get a couple of pieces of butcher''s paper, lay them out on the floor and start drawing small circles on it. Each circle represents a state, or substate that the agent can be in (encompass substates within larger states in your drawing, if you can). Where you want to be able to have a transition between states, draw a directed arc (line+arrow) between the two states. Note beside the arc - near its source - the conditions that must be met for the transition to occur. Make sure that, given any starting state, any path through your state circles traverses only one arc at a time (unless there are multiple independent substates... but you probably dont need to worry about this sort of thing).

Now, this drawing, also called a ''map'' or ''state diagram'' or a ''state graph'' is the thing that you need to code. There are several decent implementations of FSMs available for free. Just search Google for FSM code.

Good luck,

Timkin
Advertisement
Dear friend,

I will explain you this in a clear way with a example.
Lets assume that the task is to create a display in a car.
The display can be used in following ways.

1.Radio
2.Map for traveeling
3.Music system

etc etc
This display contains some buttons below it.
By clicking the buttons we can switch to rado,map,music system etc etc
Suppose we are in radio mode There are some buttons now to increase the volume decrease the volume,etc etc.
Here it needs some logic to switch to Radio,map and music system and also with in radio mode also we need some logic to connect different states.

For achieving this i am using VC++ and open GL API.I have developed a package for doing all these things.

Using this package i have to build applications like the one described above.

Now my problem is how to describe the states and logic to connect them.

If my task is only building one application like above one i can code it separately but using my package i am creating many applications like above so for each one i want some logic to be described internally.But i dont know how to do this.
So i want a good concept for doing this....................
I hope u understood my problem now.
Are there any code implemented in this way or any tools or libraries that will be helpful for doing this.

Thanks in advance.
sravan

This topic is closed to new replies.

Advertisement