To implement an FSM neatly, employ the State design pattern [1].
From a base class state, derive the different states that an object/agent may occupy (e.g. for a Pacman ghost these might be Flee and Chase). The agent is given a state variable that is typed as one of these state objects. Each time the agent's update() method is called, the state is tested to see if its transition conditions are met.
If the transition conditions are met, the state object must indicate to the agent whatever is appropriate as its next state. E.g. if Pacman eats a Power-Up and the ghost is in Chase state, a transition must be made by the ghost to the Flee state. The Chase state must notify the ghost of this desired transition. A disadvantage of this is that the states must be aware of at least one other state (the state to which they transition) introducing dependencies between classes. You might use C++ friend to allow the State objects to gain access to their agent's state variable.
[1] Gamma et al, "Design Patterns, Elements of Reusable Object-Oriented Software", Addison-Wesley, 1995
Sunday, March 21, 2010
Sunday, March 14, 2010
On von Neumann and computer architecture
From one of your friendly classmates...
Essentially the story is that the von Neumann architecture is based on a paper that von Neumann called "The first draft of the EDVAC". The paper was based on a proposal by John W. Mauchly and J. Presper Eckert.
Now the army Lt. who released the paper to the public by the name of Lt Herman Goldstine removed all mention of the names Mauchly and Eckert from the paper. He then distributed the paper to a number of von Neumann's associates.
Now Mauchly and Eckert were under the official secrets acts. ENIAC was patented in 1964, which was filed in 1947. They lost out on revenue patent. The patent was revoked in 1973 because of the public disclosure of Mauchly and Eckert's names on the first draft.
So most recognised that Mauchly and Eckert were the inventors of the von Neumann model, not von Neumann himself.
Monash actually teach all this in FIT1001.
IEEE computer society http://www.computer.org/portal/web/awards/entrepreneuereckert quote "Some computer historians—and Eckert himself—believed that the widely-adopted term "von Neumann architecture" should properly be known as the "Eckert Architecture," since the stored-program concept central to the von Neumann architecture had already been developed at the Moore School by the time von Neumann arrived on the scene in 1944-1945."
Essentially the story is that the von Neumann architecture is based on a paper that von Neumann called "The first draft of the EDVAC". The paper was based on a proposal by John W. Mauchly and J. Presper Eckert.
Now the army Lt. who released the paper to the public by the name of Lt Herman Goldstine removed all mention of the names Mauchly and Eckert from the paper. He then distributed the paper to a number of von Neumann's associates.
Now Mauchly and Eckert were under the official secrets acts. ENIAC was patented in 1964, which was filed in 1947. They lost out on revenue patent. The patent was revoked in 1973 because of the public disclosure of Mauchly and Eckert's names on the first draft.
So most recognised that Mauchly and Eckert were the inventors of the von Neumann model, not von Neumann himself.
Monash actually teach all this in FIT1001.
IEEE computer society http://www.computer.org/portal/web/awards/entrepreneuereckert quote "Some computer historians—and Eckert himself—believed that the widely-adopted term "von Neumann architecture" should properly be known as the "Eckert Architecture," since the stored-program concept central to the von Neumann architecture had already been developed at the Moore School by the time von Neumann arrived on the scene in 1944-1945."
Wednesday, March 3, 2010
Course commencement
Subscribe to:
Posts (Atom)