main_8c-source.html
来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 219 行 · 第 1/2 页
HTML
219 行
00122 iMinLogLevel = iMaxLogLevel = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00123 iMaxLogLevel = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00124 <font class="keywordflow">if</font>( iMaxLogLevel == 0 && iMinLogLevel != 0 )00125 iMaxLogLevel = iMinLogLevel; <font class="comment">// if no max is supplied</font>00126 <font class="keywordflow">break</font>;00127 <font class="keywordflow">case</font> <font class="charliteral">'m'</font>: <font class="comment">// mode int</font>00128 str = &argv[i+1][0];00129 iMode = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00130 <font class="keywordflow">break</font>;00131 <font class="keywordflow">case</font> <font class="charliteral">'n'</font>: <font class="comment">// number in formation int</font>00132 str = &argv[i+1][0];00133 iNr = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00134 <font class="keywordflow">break</font>;00135 <font class="keywordflow">case</font> <font class="charliteral">'o'</font>: <font class="comment">// output file log info</font>00136 os.open( argv[i+1] );00137 bSuppliedLogFile = <font class="keyword">true</font>;00138 <font class="keywordflow">break</font>;00139 <font class="keywordflow">case</font> <font class="charliteral">'p'</font>: <font class="comment">// port</font>00140 str = &argv[i+1][0];00141 iPort = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00142 <font class="keywordflow">break</font>;00143 <font class="keywordflow">case</font> <font class="charliteral">'r'</font>: <font class="comment">// reconnect 1 0</font>00144 str = &argv[i+1][0];00145 iReconnect = <a class="code" href="classParse.html#d1">Parse::parseFirstInt</a>( &str );00146 <font class="keywordflow">break</font>;00147 <font class="keywordflow">case</font> <font class="charliteral">'s'</font>: <font class="comment">// serverconf file</font>00148 <font class="keywordflow">if</font>( ss.<a class="code" href="classServerSettings.html#a2">readValues</a>( argv[i+1], <font class="stringliteral">":"</font> ) == <font class="keyword">false</font> )00149 cerr << <font class="stringliteral">"Error in reading server file: "</font> << argv[i+1] << endl;00150 <font class="keywordflow">break</font>;00151 <font class="keywordflow">case</font> <font class="charliteral">'t'</font>: <font class="comment">// teamname name</font>00152 strcpy( strTeamName, argv[i+1] );00153 <font class="keywordflow">break</font>;00154 <font class="keywordflow">case</font> <font class="charliteral">'v'</font>: <font class="comment">// version version</font>00155 str = &argv[i+1][0];00156 dVersion = <a class="code" href="classParse.html#d0">Parse::parseFirstDouble</a>( &str );00157 <font class="keywordflow">break</font>;00158 <font class="keywordflow">default</font>:00159 cerr << <font class="stringliteral">"(main) Unknown command option: "</font> << argv[i] << endl;00160 }00161 }00162 }00163 00164 00165 <font class="keywordflow">if</font>( bInfo == <font class="keyword">true</font> )00166 cout << <font class="stringliteral">"team : "</font> << strTeamName << endl <<00167 <font class="stringliteral">"port : "</font> << iPort << endl <<00168 <font class="stringliteral">"host : "</font> << strHost << endl <<00169 <font class="stringliteral">"version : "</font> << dVersion << endl <<00170 <font class="stringliteral">"min loglevel : "</font> << iMinLogLevel << endl <<00171 <font class="stringliteral">"max loglevel : "</font> << iMaxLogLevel << endl <<00172 <font class="stringliteral">"mode : "</font> << iMode << endl <<00173 <font class="stringliteral">"playernr : "</font> << iNr << endl <<00174 <font class="stringliteral">"reconnect : "</font> << iReconnect << endl ;00175 00176 <font class="keywordflow">if</font>( bSuppliedLogFile == <font class="keyword">true</font> )00177 Log.<a class="code" href="classLogger.html#a15">setOutputStream</a>( os ); <font class="comment">// initialize logger</font>00178 <font class="keywordflow">else</font>00179 Log.<a class="code" href="classLogger.html#a15">setOutputStream</a>( cout ); 00180 Log.<a class="code" href="classLogger.html#a7">setMinLogLevel</a>( iMinLogLevel );00181 Log.<a class="code" href="classLogger.html#a9">setMaxLogLevel</a>( iMaxLogLevel );00182 Log.<a class="code" href="classLogger.html#a4">restartTimer</a>( );00183 00184 <a class="code" href="classFormations.html">Formations</a> fs( strFormations, <a class="code" href="SoccerTypes_8h.html#a249a201">FT_INITIAL</a>, iNr-1 );<font class="comment">// read formations file</font>00185 <a class="code" href="classWorldModel.html">WorldModel</a> wm( &ss, &ps ); <font class="comment">// create worldmodel</font>00186 <a class="code" href="classConnection.html">Connection</a> c( strHost, iPort, <a class="code" href="SoccerTypes_8h.html#a6">MAX_MSG</a> ); <font class="comment">// make connection with server</font>00187 <a class="code" href="classActHandler.html">ActHandler</a> a( &c, &wm, &ss ); <font class="comment">// link actHandler and worldmodel</font>00188 <a class="code" href="classSenseHandler.html">SenseHandler</a> s( &c, &wm, &ss, &ps ); <font class="comment">// link senseHandler with wm</font>00189 <a class="code" href="classPlayer.html">Player</a> p( &a, &wm, &ss, &ps, &fs, strTeamName, dVersion, iReconnect );00190 <font class="comment">// create player</font>00191 00192 pthread_create( &sense, NULL, sense_callback , &s); <font class="comment">// start listening</font>00193 00194 <font class="keywordflow">if</font>( iMode > 0) <font class="comment">// only listen to standard input when not playing match</font>00195 pthread_create( &listen, NULL, stdin_callback, &p); 00196 00197 <font class="keywordflow">if</font>( iMode == 0 )00198 p.<a class="code" href="classPlayer.html#a2">mainLoop</a>();00199 <font class="keywordflow">else</font> <font class="keywordflow">if</font>( iMode == 1 )00200 p.<a class="code" href="classPlayer.html#a8">test_only_update</a>();00201 00202 c.<a class="code" href="classConnection.html#a4">disconnect</a>();00203 os.close();00204 }00205 <a name="l00208"></a><a class="code" href="main_8C.html#a1">00208</a> <font class="keywordtype">void</font> <a class="code" href="main_8C.html#a1">printOptions</a>( )00209 {00210 cout << <font class="stringliteral">"Command options:"</font> << endl <<00211 <font class="stringliteral">" c(lientconf) file - use file as client conf file"</font> << endl <<00212 <font class="stringliteral">" f(ormations) file - file with formation info"</font> << endl <<00213 <font class="stringliteral">" he(lp) - print this information"</font> << endl <<00214 <font class="stringliteral">" h(ost) hostname - host to connect with"</font> << endl <<00215 <font class="stringliteral">" i(nfo) 0/1 - print variables used to start"</font> << endl <<00216 <font class="stringliteral">" l(oglevel) int[..int] - level of debug info"</font> << endl <<00217 <font class="stringliteral">" m(ode) int - which mode to start up with"</font> << endl <<00218 <font class="stringliteral">" n(umber) int - player number in formation"</font> << endl <<00219 <font class="stringliteral">" o(utput) file - write log info to (screen is default)"</font> << endl <<00220 <font class="stringliteral">" p(ort) - port number to connect with"</font> << endl <<00221 <font class="stringliteral">" r(econnect) int - reconnect as player nr"</font> << endl <<00222 <font class="stringliteral">" s(erverconf) file - use file as server conf file"</font> << endl <<00223 <font class="stringliteral">" t(eamname) name - name of your team"</font> << endl;00224 }</pre></div><hr><address><small>Generated on Thu Mar 7 00:37:42 2002 for UvA Trilearn 2001 by<a href="http://www.doxygen.org/index.html"><img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.12 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?