当前位置: 首页>>代码示例>>C++>>正文


C++ MoveList::init方法代码示例

本文整理汇总了C++中MoveList::init方法的典型用法代码示例。如果您正苦于以下问题:C++ MoveList::init方法的具体用法?C++ MoveList::init怎么用?C++ MoveList::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MoveList的用法示例。


在下文中一共展示了MoveList::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readGame

void Game::readGame(int maxp, int size)
{
	int cntmove = 1;
	int cntPiece = 0;

	// 1. Version of the file
	short version = rGameFile.readShort();	// # Version (short)

	// 2. Header
	short typeOfData = rGameFile.readShort();	// # DATA_HEADER
	rGameFile.readShort();										// # Header version

	short width = rGameFile.readShort();		// # Width (short)
	short height = rGameFile.readShort();		// # Height (short)
	int seed = rGameFile.readInt();					// # Seed (int)
	int level = rGameFile.readByte();				// # Level (byte)
	int preview = rGameFile.readByte();			// # Preview (byte)
	int piece1 = rGameFile.readByte();      // # Piece1 (byte)
	int piece2 = rGameFile.readByte();      // # Piece2 (byte)

	Board board(width, height, 0, 0);
	Board htmlBoard(width+8, height+5, 0, 0);
	Piece dummy(&board, piece1);					// Initialize static members for width x height.
	MoveList *moveList = board.getMoveList(level);

	htmlBoard.copyWithWalls(&board, preview-1);

	wHtml << "<html>\n"
		    << "<head>\n"
				<< "  <title>Test.</title>\n"
				<< "</head>\n"
				<< "<body>\n"
				<< "  <table border=1>\n";

	while (piece2 != END_PIECE)
	{
		Piece htmlPiece1(&htmlBoard, piece1);
		Piece htmlPiece2(&htmlBoard, piece2);
		htmlPiece1.setPiece(0, 10, 1, width);

		if (level > 1)
			htmlPiece2.setPiece(0, 1, 1, width);
		
		Piece piece(&board, piece1);

		int length = rGameFile.readShort();		// # Number of legal moves.
		int pieceV = rGameFile.readByte();		// # V
		int pieceX = rGameFile.readShort();		// # X
		int pieceY = rGameFile.readShort();		// # Y

		moveList->init(level, preview, board.getMaxEquity());

		if (length == 0)
			break;


		wHtml << "    <tr>\n"
					<< "      <td>\n"
					<< "        <table border=0 cellspacing=0 cellpadding=0>\n"
					<< "        <!-- Board -->\n";

		// 1. Board
		for (int y=0; y<height+5; y++)
		{
			wHtml	<< "          <tr><td>";

			for (int x=0; x<width+8; x++)
			{
				int p = htmlBoard.get(x, y);
				char c = Piece::getHtmlChar(p);

				if (width == 10 && y==height+3)
				{
					if (x==6)
						wHtml << "<IMG src=img/Wdigits.gif height=" << size << ">";
					else if (x >=7 && x<=width+6)
						continue;
				}

				wHtml << "<IMG src=img/" << c << ".gif height=" << size << " width=" << size << ">";
			}

			wHtml	<< "</td></tr>\n";
		}

		wHtml	<< "        </table>\n"
					<< "      </td>\n";


		// 2. Equity list header
		wHtml	<< "      <td>\n"
					<< "        <table border=0>\n"
					<< "        <!-- Equity list -->\n"
					<< "          <tr>\n"
					<< "            <td colspan=2 align=left><font face=Arial size=1>"
					<< cntmove << ".&nbsp;"
					<< Piece::getChar(piece1) << Piece::getChar(piece2)
					<< "</font></td>\n"
					<< "          </tr>\n"
					<< "          <tr>\n"
//.........这里部分代码省略.........
开发者ID:tengstrand,项目名称:tetrisanalyzer,代码行数:101,代码来源:Game.cpp


注:本文中的MoveList::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。