Football Tact -> Combination Offense Composite

zhaozj2021-02-11  189

Connect to:

http://www.9cbs.net/develop/read_article.asp?id=11120

The most effective offensive method is a few players into Composite to attack, this Composite can be combined with other players and Composite into new Composite, so recursive ... Composite mode simplifies the command of the coach, because he doesn't have to consider A offensive module is a single player or Composite, and it is easy to join the newly added player or Composite, but you don't want to have a team member or a combination of a team, you can't limit them. Only flexible use in the game. The code is as follows: Class combination;

Class component {public: Virtual combination * Get a combination () {return 0;}};

Class combination: public component {public: Void Add (component *); Virtual combination * Get a combination () {Return THIS;}};

Class player: public component {};

Combination * a combination = new combination; team members * a players = New players;

Component * a component; combination * TEST;

A component = a combination; if (Test = A component -> get a combination ()) {test-> added (New team);}

a component = a player;

IF (Test = A Components -> Get a combination ()) {Test-> Add (New player);}

Note: Components are a combination or player.

转载请注明原文地址:https://www.9cbs.com/read-5231.html

New Post(0)