The most important thing in football tactics should be a player's run, and the running of all players should comply with the OBServer mode. Because the Pass member of the Subject is not only to send a message to the team members, but also to change the running method of all players (OBSERVERS). The way the broadcast should be divided into two cases: push and pull. The team members pass the ball are the way to receive, guiding his running route directly by the passing of the passers. Other team members are the way to receive pulse, and they determine their own running by visual accepted the ball and passing the passenger route. The code is as follows: Class No ballist {public: virtual ~ observation (); Virtual Void running (passing team member * pass route) = 0; protected: observation ();
Class Passage {public: Virtual ~ Pass message ();
Virtual void prepares the ball (no ball *); Virtual Void continues to bring the ball (no ball *); Virtual Void pass ();
Protected: Pass message (); private: list
Void pass message :: Prepare the ball (non-ballist * object) {_ no ballist -> Start observation (object);}
Void Pass News :: Continuing to Ball (Women's * Object) {_ Women -> Stop Running;}
Void Pass message :: Pass () {Listiterator
The formation of the formation requires MEMENTO mode, especially two side guards, and the last AC Milan is lost to Petuj, mainly because the defenders are not returned to the place. Here, Memento is mainly like the use of Contra, and if the players are inadequate, or the defensive task is too arduous, so that you should not use this model. Here is the algorithm of the coach prior exercise, from a virtual Caretaker from the offensive need to send a request to the front guard (ORIGINATOR), generate a virtual Memento, front-sighted, anti-attack, defensive while guards because of the request of Caretaker's defensive required, return Go to the location of MEMENTO. The code is as follows: Class side guard {public: defensive position * Create a defensive position (); Void setting defensive position (const defensive position *); private: Location * _ position;};
Class defensive position {public: virtual ~ defensive position (); pivate: Friend class side guard; defensive position ();
Void setting position (location *); location * Get position (); private: position * _ position;};