views:

364

answers:

2

Hi there,
Consider a game similar to pac-mac that we want to represent it with an FSA graph. We have a maze (table) and there are berries into it in random positions. The goal is to eat all the berries in the maze. The commands we have to consider for the control are the following:
GOAHEAD, LEFT, RIGHT, CHECKBERRY(that checks if there is a berry in FRONT of pac man), EAT and OFF-MAZE.
We need maximum 10 stages... And keep in mind we can't have more than one gaps in a row. Thank you

EDIT: alt text

ok then. I created the graph but i can't find a way to overpass gaps. For example: On the maze after a certain row of berries all of a sudden there is a gap in front and the next berry is right down the gap. So I am not sure how my graph will look like as even if I turn left or right the checkberry command won't return TRUE value. So there has to be a way for the pac man to move to the gap square without eating but how will it decide whether to move to the one in front or to others?

+1  A: 

If you are looking for help from Stackoverflow on this kind of question; you obviously need look at what you are doing. Your question needs to be more specific. Are you having a problem with a specific coding problem, or do you not know where to start? Is this meant to be a trivial excersise or full blown project?

Try making a mind map of what you want to do and see where you can go from there with the skills you currently have. Come back once you run into an actual problem.

Jonno_FTW
This is a tutorial exercise, not a project!!! There is no coding in this part. Its just a representation using a finite state machine. I just need to create a transition graph (there are many different ways to represent it according to anyones opinion). The question is simple. I am going to upload a photo of a sample of what i have done soon to give you a taste. I don't know if its possible cause i am using this forum for the first time.
Ok, sorry, it seems i didn't know what you wanted. I guess you want a 'mind-map' of what the program does.
Jonno_FTW
+1  A: 

If you're designing a state diagram, try to first figure out what kind of states that your state machine will have, instead of numbering the states.

Here is a simple example, your "pac man" needs to be walking, checking and eating. So there are three states IS_WALKING, IS_CHECKING and IS_EATING. The diagram for traversing straight forward and eating could be something like the figure below. I'm not sure what kind of diagram notation you're using though I hope it'll clear some things out for you.

                     GO_AHEAD
       +------------------------------------+
       |                                    |
       v                                    |
+----------------+      false            +------------+
| IS_CHECKING    |---------------------->| IS_WALKING |
+----------------+                       +------------+
| E: CHECK_BERRY |                          ^
+----------------+                          |
       |                                    |
       | true                               |
       v                                    |
 +-----------+               EAT            |
 | IS_EATING |------------------------------+
 +-----------+

The transitions are more natural and easier to figure out once you have appropriate names for the states. Example of a good name for state is one that spells out quite clearly what the state machine is doing at one particular moment.

Spoike