Object Oriented Style: Here the states are strongly encapsulated with functions that operate on that state as objects.
The architecture for a Lunar Lander game in object oriented style is given as:
It has 3 encapsulations- the spacecraft, user interface and environment. Here, the interaction with the user is handled by a single object which performs both input and output functions.The GUI component can display the status of the spacecraft and get any information from spacecraft like burnRate.
The spacecraft component can set and get values of altitude, fuel, time, velocity and mass.
The environment simulator calculates the status of the spacecraft.
Rule Based Style: Here the inference engine parses user input and determines whether it is a fact/rule or query. It adds the entry to the knowledge base if it is a fact else it queries the knowledge base for applicable rules and attempts to resolve the query.
The designing of Lunar Lander requires thinking of the problem as one of maintaining a set of consistent facts about the spacecraft. E.g.the passage of one second of time demands that the facts regarding amount of remaining fuel, velocity of spacecraft and height of spacecraft be brought up to date consistently.
The architecture for a Lunar Lander game in rule based style is given as:
With regard to user interaction model, the user enters the value of burn rate as a fact- burn Rate. To see the status of spacecraft, user can switch to goal mode and ask whether spacecraft has landed safely. The inference engine queries the database to find the result. If the existing facts satisfy the conditions “altitude<=0” and “velocity< 3ft/s” then engine returns true to the user else it returns false.
Black Board Style: Here independent programs access and communicate exclusively through a global data repository known as blackboard.
The architecture for a Lunar Lander game in blackboard style is given as:
A single connector regulates access from the various experts in manipulating the information on the blackboard. The blackboard maintains the game state. The experts perform the independent tasks of
- Updating the engine burn rate depending upon the input from user
- Displaying to the user the current state of spacecraft
- Updating the game state based upon a time and physics model