classformations.html

来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 524 行 · 第 1/2 页

HTML
524
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Formations class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>Formations  Class Reference</h1><code>#include &lt;<a class="el" href="Formations_8h-source.html">Formations.h</a>&gt;</code><p>Collaboration diagram for Formations:<p><center><img src="classFormations__coll__graph.gif" border="0" usemap="#Formations__coll__map" alt="Collaboration graph"></center><map name="Formations__coll__map"><area href="classFormationTypeInfo.html" shape="rect" coords="50,96,167,115" alt=""><area href="classVecPosition.html" shape="rect" coords="14,13,91,32" alt=""><area href="classPlayerTypeInfo.html" shape="rect" coords="117,13,213,32" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classFormations-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a0">Formations</a> (const char *strFile=NULL, <a class="el" href="SoccerTypes_8h.html#a249">FormationT</a> ft=FT_ILLEGAL, int iNr=1)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a1">show</a> (ostream &amp;os=cout)</td></tr><tr><td nowrap align=right valign=top><a class="el" href="classVecPosition.html">VecPosition</a>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a2">getStrategicPosition</a> (int iPlayer, <a class="el" href="classVecPosition.html">VecPosition</a> posBall, double dMaxXInPlayMode)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a3">readFormations</a> (const char *strFile)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a4">setFormation</a> (<a class="el" href="SoccerTypes_8h.html#a249">FormationT</a> formation)</td></tr><tr><td nowrap align=right valign=top><a class="el" href="SoccerTypes_8h.html#a249">FormationT</a>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a5">getFormation</a> () const</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a6">setPlayerInFormation</a> (int number)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a7">getPlayerInFormation</a> () const</td></tr><tr><td nowrap align=right valign=top><a class="el" href="SoccerTypes_8h.html#a248">PlayerT</a>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#a8">getPlayerType</a> () const</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classFormationTypeInfo.html">FormationTypeInfo</a>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#o0">formations</a> [MAX_FORMATION_TYPES]</td></tr><tr><td nowrap align=right valign=top><a class="el" href="SoccerTypes_8h.html#a249">FormationT</a>&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#o1">curFormation</a></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classFormations.html#o2">iPlayerInFormation</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class is a container for all different Formation Types: it contains the information of all the formation types. Furthermore it contains two other values: the current formation type that is used by the agent and the role of the agent in the current formation. These two values fully specify the position of this player in the formation. <p><p>Definition at line <a class="el" href="Formations_8h-source.html#l00164">164</a> of file <a class="el" href="Formations_8h-source.html">Formations.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2><a name="a0" doxytag="Formations::Formations"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> Formations::Formations </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>strFile</em> = NULL, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="SoccerTypes_8h.html#a249">FormationT</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>curFt</em> = FT_ILLEGAL, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iNr</em> = 1</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This is the constructor for the Formations class and needs as arguments a formation configuration file, the current formation and the number of the agent in this formation (normally at start-up this equals the player number). <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>strFile</em>&nbsp;</td><td>string representation of the formation configuration file </td></tr><tr><td valign=top><em>curFt</em>&nbsp;</td><td>current formation type (default FT_ILLEGAL) </td></tr><tr><td valign=top><em>iNr</em>&nbsp;</td><td>number of the agent in this formation (default 1) </td></tr></table></dl><p>Definition at line <a class="el" href="Formations_8C-source.html#l00443">443</a> of file <a class="el" href="Formations_8C-source.html">Formations.C</a>.<p>References <a class="el" href="Formations_8h-source.html#l00167">curFormation</a>, <a class="el" href="SoccerTypes_8h-source.html#l00329">FormationT</a>, <a class="el" href="Formations_8C-source.html#l00534">readFormations</a>(), and <a class="el" href="Formations_8C-source.html#l00652">setPlayerInFormation</a>().    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="a5" doxytag="Formations::getFormation"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> <a class="el" href="SoccerTypes_8h.html#a249">FormationT</a> Formations::getFormation </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the current formation. <dl compact><dt><b>Returns: </b><dd>current formation </dl><p>Definition at line <a class="el" href="Formations_8C-source.html#l00643">643</a> of file <a class="el" href="Formations_8C-source.html">Formations.C</a>.<p>References <a class="el" href="Formations_8h-source.html#l00167">curFormation</a>, and <a class="el" href="SoccerTypes_8h-source.html#l00329">FormationT</a>.<p>Referenced by <a class="el" href="Player_8C-source.html#l00182">Player::deMeer5</a>(), and <a class="el" href="Player_8C-source.html#l00278">Player::deMeer5_goalie</a>().    </td>  </tr></table><a name="a7" doxytag="Formations::getPlayerInFormation"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Formations::getPlayerInFormation </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the role number of the agent in the current formation <dl compact><dt><b>Returns: </b><dd>player number for this agent in the current formation </dl><p>Definition at line <a class="el" href="Formations_8C-source.html#l00660">660</a> of file <a class="el" href="Formations_8C-source.html">Formations.C</a>.<p>References <a class="el" href="Formations_8h-source.html#l00168">iPlayerInFormation</a>.<p>Referenced by <a class="el" href="Player_8C-source.html#l00434">Player::getStrategicPosition</a>(), and <a class="el" href="Player_8C-source.html#l00058">Player::Player</a>().    </td>  </tr></table><a name="a8" doxytag="Formations::getPlayerType"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> <a class="el" href="SoccerTypes_8h.html#a248">PlayerT</a> Formations::getPlayerType </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the player type for the agent in the current formation <dl compact><dt><b>Returns: </b><dd>player type for the agent in the current formation </dl><p>Definition at line <a class="el" href="Formations_8C-source.html#l00667">667</a> of file <a class="el" href="Formations_8C-source.html">Formations.C</a>.<p>References <a class="el" href="Formations_8h-source.html#l00167">curFormation</a>, <a class="el" href="Formations_8h-source.html#l00166">formations</a>, <a class="el" href="Formations_8h-source.html#l00168">iPlayerInFormation</a>, and <a class="el" href="SoccerTypes_8h-source.html#l00316">PlayerT</a>.<p>Referenced by <a class="el" href="Player_8C-source.html#l00092">Player::mainLoop</a>(), and <a class="el" href="Player_8C-source.html#l00058">Player::Player</a>().    </td>  </tr></table><a name="a2" doxytag="Formations::getStrategicPosition"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> <a class="el" href="classVecPosition.html">VecPosition</a> Formations::getStrategicPosition </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iPlayer</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classVecPosition.html">VecPosition</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>posBall</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>double&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>dMaxXInPlayMode</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the strategic position for a player. It calculates this information by taking the home position of the current role in the current formation and combines this with the position of the ball using the attraction values for the current player type. The attraction values defines the percentage of the ball coordinate that is added to the home position of the current player type. So when the x coordindate of the home position is 10.0, x coordinate ball is 20.0 and x attraction is 0.25. The x coordinate of the strategic position will become 10.0 + 0.25*20.0 = 15.0. When this value is smaller than the minimal x coordinate or larger than the maximal x coordinate, the coordinate is changed to this minimal or maximal coordinate respectively. Also when the behind ball value is set, the x coordinate of the strategic position is set to this ball coordinate. Furthermore when the strategic position is in front of the supplied argument dMaxXInPlayMode, the x coordinate is adjusted to this value. During normal play mode the supplied value is often the offside line. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iPlayer</em>&nbsp;</td><td>player number in formation of which strategic position should be determined. </td></tr><tr><td valign=top><em>posBall</em>&nbsp;</td><td>position of the ball </td></tr><tr><td valign=top><em>dMaxXInPlayMode, max</em>&nbsp;</td><td>x coordinate allowed in current play mode. </td></tr></table></dl><p>Definition at line <a class="el" href="Formations_8C-source.html#l00488">488</a> of file <a class="el" href="Formations_8C-source.html">Formations.C</a>.<p>References <a class="el" href="Formations_8h-source.html#l00167">curFormation</a>, <a class="el" href="Formations_8h-source.html#l00166">formations</a>, <a class="el" href="Formations_8C-source.html#l00151">PlayerTypeInfo::getAttrX</a>(), <a class="el" href="Formations_8C-source.html#l00177">PlayerTypeInfo::getAttrY</a>(), <a class="el" href="Formations_8C-source.html#l00241">PlayerTypeInfo::getBehindBall</a>(), <a class="el" href="Formations_8C-source.html#l00217">PlayerTypeInfo::getMaxX</a>(), <a class="el" href="Formations_8C-source.html#l00197">PlayerTypeInfo::getMinX</a>(), <a class="el" href="Geometry_8C-source.html#l00542">VecPosition::getX</a>(), <a class="el" href="Geometry_8C-source.html#l00558">VecPosition::getY</a>(), and <a class="el" href="SoccerTypes_8h-source.html#l00076">PITCH_WIDTH</a>.<p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?