Пример #1
0
// Generic algorithm for axes display: width height in device coordinate
void ShowAxes(HDC hDC, int width, int height)
{
	POINT corner[2];

	// display axes for the area [10, 10, width-10, height-10]
	corner[0].x = 10;
	corner[0].y = 10;
	corner[1].x = width - 10;
	corner[1].y = height - 10;

	// covert to logical coordinate
	DPtoLP(hDC, corner, 2);

	// we need to display a 10x2 point arrow, convert to device coordinate, then to logical
	SIZE s = { 10, 2 };
	PointToDevice(hDC, s);
	DeviceToLogical(hDC, s);

	// X-axis
	Arrow(hDC, min(corner[0].x, corner[1].x), 0, 
		       max(corner[0].x, corner[1].x), 0, s.cx, s.cy);

	// Y-axis
	Arrow(hDC, 0, min(corner[0].y, corner[1].y), 
		       0, max(corner[0].y, corner[1].y), s.cx, s.cy);
}
Пример #2
0
void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
    std::auto_ptr<cArrowEntity> Arrow(new cArrowEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0)));
    if (!LoadProjectileBaseFromNBT(*Arrow.get(), a_NBT, a_TagIdx))
    {
        return;
    }

    // Load pickup state:
    int PickupIdx = a_NBT.FindChildByName(a_TagIdx, "pickup");
    if (PickupIdx > 0)
    {
        Arrow->SetPickupState((cArrowEntity::ePickupState)a_NBT.GetByte(PickupIdx));
    }
    else
    {
        // Try the older "player" tag:
        int PlayerIdx = a_NBT.FindChildByName(a_TagIdx, "player");
        if (PlayerIdx > 0)
        {
            Arrow->SetPickupState((a_NBT.GetByte(PlayerIdx) == 0) ? cArrowEntity::psNoPickup : cArrowEntity::psInSurvivalOrCreative);
        }
    }

    // Load damage:
    int DamageIdx = a_NBT.FindChildByName(a_TagIdx, "damage");
    if (DamageIdx > 0)
    {
        Arrow->SetDamageCoeff(a_NBT.GetDouble(DamageIdx));
    }

    // Store the new arrow in the entities list:
    a_Entities.push_back(Arrow.release());
}
Пример #3
0
void	Arrow( const VectorR3& tail, const VectorR3& head )
{
	float t[3];
	float h[3];
	tail.Dump( t );
	head.Dump( h );
	Arrow( t, h );
} 
Пример #4
0
void drawAxes(GLdouble length)
{
    glPushMatrix();
    glTranslatef(-length,0,0);
    Arrow(0,0,0, 2*length,0,0, 0.2);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(0,-length,0);
    Arrow(0,0,0, 0,2*length,0, 0.2);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(0,0,-length);
    Arrow(0,0,0, 0,0,2*length, 0.2);
    glPopMatrix();
}
Пример #5
0
//主函数==============================================================================================
int main()
{
    p_in=&in;
    p_out=&out;
    system("mode con cols=80 lines=22");
    CODE();//输入密码
    if(!shut)
    {
        Menu(4);//打印界面
        Menu(1);//打印选项
        Arrow();//打印光标
        gotoxy(0,0);
    }
    while(!shut)
    {
        while(!shut)
        {
            shut=0;
            MOVE();
            if(chos_in==1&&chos_out==1)
            {
                //转换进制并输出
                turn(p_in);
                turn(p_out);
                Trans(in,out);
                getch();
                //重置开关及界面等待下一次操作
                chos_in=chos_out=0;
                SPRD(3,13,50,15,19);
                Menu(1);
                break;
            }
        }
    }
    gotoxy(50,20);
    return 0;
}
Пример #6
0
LRESULT CALLBACK WindowFunc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam )
{
  HDC hDC, hMemDC, hMemDCLogo;
  PAINTSTRUCT ps;
  BITMAP bm;
  static INT W = 0, H = 0, k = 1, r = 290;
  static HBITMAP hBm, hBmLogo;
  SYSTEMTIME st;
  POINT c;
  CHAR chr;

  switch (Msg)
  {
  case WM_CREATE:
    SetTimer(hWnd, 4, 10, NULL);
    hBmLogo = LoadImage(NULL, "clockface.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    break;
  case WM_CHAR:
    chr = (CHAR) wParam;

    if (chr == 27)
      DestroyWindow(hWnd);
    else if (chr == '+')
      k++;
    else if (chr == '-')
      k--;
    else if (chr == 'f' || chr == 'F')
      FlipFullScreen(hWnd, 1);
    else if (chr == 'g' || chr == 'G')
      FlipFullScreen(hWnd, 0);
    return 0;
  case WM_ERASEBKGND:
    return 1;
  case WM_SIZE:
    W = LOWORD(lParam);
    H = HIWORD(lParam);
    hDC = GetDC(hWnd);
    if (hBm != NULL)
      DeleteObject(hBm);
    hBm = CreateCompatibleBitmap(hDC, W, H);
    ReleaseDC(hWnd, hDC);
    return 0;
  case WM_PAINT:
    hDC = BeginPaint(hWnd, &ps);
    hMemDC = CreateCompatibleDC(hDC);
    SelectObject(hMemDC, hBm);

    SetDCBrushColor(hMemDC, RGB(255, 255, 255));
    Rectangle(hMemDC, 0, 0, W, H);
    
    GetObject(hBmLogo, sizeof(bm), &bm);/**/

    hMemDCLogo = CreateCompatibleDC(hMemDC);
    SelectObject(hMemDCLogo, hBmLogo);
    BitBlt(hMemDC, max(W / 2 - PIC_CX, 0), max(H / 2 - PIC_CY, 0), W, H, hMemDCLogo, 0, 0, SRCCOPY);
    c.x = PIC_CX + max(W / 2 - PIC_CX, 0);
    c.y = PIC_CY + max(H / 2 - PIC_CY, 0);

    GetLocalTime(&st);
    Arrow(hMemDC, c, k * 2 * M_PI * (st.wHour/* % 12*/ + st.wMinute / 60.0 + st.wSecond / 3600.0 + st.wMilliseconds / 3600000.0) / 12 - M_PI / 2, r, 7, RGB(255, 0, 0));
    Arrow(hMemDC, c, k * 2 * M_PI * (st.wMinute + st.wSecond / 60.0 + st.wMilliseconds / 60000.0) / 60 - M_PI / 2, r, 4, RGB(0, 255, 0));
    Arrow(hMemDC, c, k * 2 * M_PI * (st.wSecond + st.wMilliseconds / 1000.0) / 60 - M_PI / 2, r, 2, RGB(0, 0, 0));
                           
    BitBlt(hDC, 0, 0, W, H, hMemDC, 0, 0, SRCCOPY);
    DeleteDC(hMemDC);
    DeleteDC(hMemDCLogo);
    EndPaint(hWnd, &ps);
    return 0;
  case WM_TIMER:
    InvalidateRect(hWnd, NULL, 0);
    break;
  case WM_DESTROY:
    DeleteObject(hBm);
    DeleteObject(hBmLogo);
    PostQuitMessage(0);
    KillTimer(hWnd, 4);
    return 0;
  }

  return DefWindowProc(hWnd, Msg ,wParam, lParam);
}
Пример #7
0
	/// <summary>
	/// 矢印型のポリゴンを作成します。
	/// </summary>
	/// <param name="line">
	/// 矢印の線
	/// </param>
	/// <param name="thickness">
	/// 矢印の太さ
	/// </param>
	/// <param name="headSize">
	/// 矢印の三角形部分の大きさ
	/// </param>
	/// <returns>
	/// 矢印型のポリゴン
	/// </returns>
	inline Polygon Arrow(const Line& line, double thickness, const Vec2& headSize)
	{
		return Arrow(line.begin, line.end, thickness, headSize);
	}
Пример #8
0
//移动===============================================================
void MOVE()
{
    char c;
    c=getch();
    switch(c)
    {
    case 72://上
    {
        if(y>7) {
            gotoxy(x0,y);
            printf(" ");
            y--;
            Arrow();
        }
        break;
    }
    case 80://下
    {
        if(y<11) {
            gotoxy(x0,y);
            printf(" ");
            y++;
            Arrow();
        }
        break;
    }
    case 77://右
    {
        if(x0==15)
        {
            gotoxy(x0,y);
            printf(" ");
            x0=45;
            Arrow();
            no_TXT(10,30,5,12);
            TXT(40,60,5,12);
            gotoxy(0,0);
        }
        break;
    }
    case 75://左
    {
        if(x0==45)
        {
            gotoxy(x0,y);
            printf(" ");
            x0=15;
            Arrow();
            no_TXT(40,60,5,12);
            TXT(10,30,5,12);
            gotoxy(0,0);
        }
        break;
    }
    case 13:
    case 32:
    {
        if(y==11)shut=1;
        if(x0==15&&y!=11)
        {
            Menu(2);
            CLR(2);
            gotoxy(x0+2,y);
            puts(txt[y-7]);
            CLR(3);
            chos_in=1;
            in=y-7;
        }
        else if(y!=11)
        {
            Menu(3);
            CLR(2);
            gotoxy(x0+2,y);
            puts(txt[y-7]);
            CLR(3);
            chos_out=1;
            out=y-7;
        }
        break;
    }
    }
}
Пример #9
0
#else
const bool FullscreenUI::k_enabledDefault = false;
#endif // defined(__ANDROID__) || defined(__IOS__)
const float32 FullscreenUI::k_arrowScale = 0.15f;
const float32 FullscreenUI::k_arrowScaleSmall = 0.075f;
const float32 FullscreenUI::k_arrowSpacing = 0.005f;
const float32 FullscreenUI::k_arrowTestX =
    FullscreenUI::k_arrowScale + FullscreenUI::k_arrowSpacing;
const float32 FullscreenUI::k_arrowParticleParameterX =
    FullscreenUI::k_arrowTestX + FullscreenUI::k_arrowScale +
    FullscreenUI::k_arrowScaleSmall + FullscreenUI::k_arrowSpacing;

Arrow FullscreenUI::s_arrows[] = {
    // Test selection arrows.
    Arrow(Arrow::e_angleRight, FullscreenUI::k_arrowScale,
    b2Vec2(1.0f - FullscreenUI::k_arrowTestX, 0.0f),
    e_SelectionTestNext, &b2Vec2_zero, &b2Vec2_zero),
    Arrow(Arrow::e_angleLeft, FullscreenUI::k_arrowScale,
    b2Vec2(-1.0f + FullscreenUI::k_arrowTestX, 0.0f),
    e_SelectionTestPrevious, &b2Vec2_zero, &b2Vec2_zero),
    // Particle parameter selection arrows.
    Arrow(Arrow::e_angleRight, FullscreenUI::k_arrowScaleSmall,
    b2Vec2(1.0f - FullscreenUI::k_arrowParticleParameterX, 0.0f),
    e_SelectionParameterNext, &b2Vec2_zero, &b2Vec2_zero),
    Arrow(Arrow::e_angleLeft, FullscreenUI::k_arrowScaleSmall,
    b2Vec2(-1.0f + FullscreenUI::k_arrowParticleParameterX, 0.0f),
    e_SelectionParameterPrevious, &b2Vec2_zero, &b2Vec2_zero),
};
const uint32 FullscreenUI::k_numArrows = B2_ARRAY_SIZE(FullscreenUI::s_arrows);

FullscreenUI::FullscreenUI()
Пример #10
0
void main()
{
	srand(time(NULL));
	
	// dynamic memory allocation
	// creates an array of instances of the Cell class with a dynamic size.
	// this is setup in a way so that you could ask the user for an array size and it would allocate the required amout of memory.
	Cell* cell;
	cell = new Cell[16];

	// calls the function that creates the grid to be used as the game map defined as a 4 x 4 grid stored inside the dynamic cell array.
	createGrid(4, cell);

	// creates a varible to be used as a text file.
	fstream gameSave;

	// makes a bool variable used to define the default win condition as false until changed when certain criteria is met.
	bool winCondition = false;

	// creates an instance of the Player class named player defined as the constructor function.
	Player player = Player();

	// creates an instance of the Scanner class name scanner defined as the constructor function.
	Scanner scanner = Scanner();

	// creates an instance of the Gold class named gold defined as the constructor function.
	Gold gold = Gold();

	// creates an instance of the Wumpus class named wumpus defined as the constructor function.
	Wumpus wumpus = Wumpus({ RNG(4),RNG(4) });

	cout << "Wumpus location: " << wumpus.location.x << " = x, " << wumpus.location.y << " = y" << endl;
	cout << "\n";

	// creates an array of instances of the Pit class.
	Pit pits[4] = { Pit({1,1}), Pit({ 1,3 }), Pit({ 3,0 }), Pit({ 3,3 }) };

	// creates an instance of the Arrow class name arrow defined as the constructor function.
	Arrow arrow = Arrow();

	// displays instructions for the user to the console.
	cout << "Type your input then press enter to do actions" << endl;
	cout << "Use 'w','a','s','d' as the arrow keys to move." << endl;
	cout << "Use 'f' to draw your bow then 'w','a','s','d' to shoot in a direction ." << endl;
	cout << "Use 'r' to check your scanner." << endl;
	cout << "Use 'q' to save, and 'e' to load a save" << endl;
	cout << "\n";
		
	cout << "You enter the cave of the Wumpus monsters in search of gold..." << endl;
	cout << "\n";
	
	cout << "Which direction do you want to go?" << endl;
	cout << "\n";

	// starts the game loop.
	do
	{
		// makes a char variable used to store user input to be used in the movement switch case statements.
		char input;

		// takes in the users input to be check against the switch/case statments.
		cin >> input;
		cout << "\n";

		// tells the user that the wrong input was entered and lists the correct inputs if the wrong input was entered.
		if (!(input == 'w' || input == 'a' || input == 's' || input == 'd' || input == 'q' || input == 'e' || input == 'f' || input == 'r'))
		{
			cout << "That is not a valid input..." << endl;
			cout << "Use 'w','a','s','d' as the arrow keys to move." << endl;
			cout << "Use 'f' to draw your bow then 'w','a','s','d' to shoot in a direction ." << endl;
			cout << "Use 'r' to check your scanner, you only have 2." << endl;
			cout << "Use 'q' to save, and 'e' to load a save." << endl;
			cout << "\n";
		}

		// creates a switch/case statment thats accepts the character variable "input".
		switch (input)
		{
			// adds 1 to the players "y" cooridinate if 'w' was the input.
		case 'w':
			player.location.x, player.location.y += 1;
			cout << "You moved to the North..." << endl;
			cout << "Your X, Y position is: " << player.location.x << ", " << player.location.y << endl;
			cout << "\n";
				break;

			// subtracts 1 from the players "y" cooridinate if 's' was the input.
		case 's':
			player.location.x, player.location.y -= 1;
			cout << "You moved to the South..." << endl;
			cout << "Your X, Y position is: " << player.location.x << ", " << player.location.y << endl;
			cout << "\n";
				break;

			// subtracts 1 to the players "x" cooridinate if 'a' was the input.
		case 'a':
			player.location.x -= 1, player.location.y;
			cout << "You moved to the West..." << endl;
			cout << "Your X, Y position is: " << player.location.x << ", " << player.location.y << endl;
			cout << "\n";
				break;

			// adds 1 to the players "x" cooridinate if 'd' was the input.
		case 'd':
			player.location.x += 1, player.location.y;
			cout << "You moved to the East..." << endl;
			cout << "Your X, Y position is: " << player.location.x << ", " << player.location.y << endl;
			cout << "\n";
				break;

			// calls the useScanner function to scan the area if 'r' was the input.
		case 'r':
			scanner.useScanner(scanner, player, pits, wumpus, gold);
			scanner.charge -= 1;
			break;

			// calls the shootArrow function to shoot an arrow in the direction of the user input.
		case 'f':
			if (arrow.shootArrow(arrow, player, wumpus) == true)
			{
				wumpus.alive = false;
				cout << "You have killed the Wumpus monster!" << endl;
				cout << "\n";
			}

			else
			{
				cout << "You didnt hit anything..." << endl;
				cout << "\n";
			}
				break;

			// saves the players data to a file if 'q' was the input.
		case 'q':

			gameSave.open("gameSave.txt", ios_base::out);
	
			gameSave << player.location.x << "\n" <<  player.location.y << "\n" << player.gold << "\n" << wumpus.alive;

			gameSave.close();
				
			cout << "Game has been saved." << endl;
			cout << "\n";
				break;

			// loads the players data from a file if 'e' was the input.
		case 'e':
		
			gameSave.open("gameSave.txt", ios_base::in);
				
			gameSave >> player.location.x >> player.location.y >> player.gold >> wumpus.alive;
			
			gameSave.close();
				
			cout << "Game has been loaded." << endl;
			cout << "\n";
			cout << "Your X, Y position is: " << player.location.x << ", " << player.location.y << endl;
			cout << "\n";
				break;
			
		default:
				break;
		}
	
		if ((player.location.x == pits[0].location.x) && (player.location.y == pits[0].location.y))
		{
			player.alive = false;
			cout << "You fall in a giant pit and are trapped forever..." << endl;
			cout << "\n";
		}

		if ((player.location.x == pits[1].location.x) && (player.location.y == pits[1].location.y))
		{
			player.alive = false;
			cout << "You fall in a giant pit and are trapped forever..." << endl;
			cout << "\n";
		}

		if ((player.location.x == pits[2].location.x) && (player.location.y == pits[2].location.y))
		{
			player.alive = false;
			cout << "You fall in a giant pit and are trapped forever..." << endl;
			cout << "\n";
		}

		if ((player.location.x == pits[3].location.x) && (player.location.y == pits[3].location.y))
		{
			player.alive = false;
			cout << "You fall in a giant pit and are trapped forever..." << endl;
			cout << "\n";
		}

		// displays a message to the console that you have died if the Player's "x" or "y" coordinate is not on the game map grid it sets the Alive bool of the Player to false.
		if ((player.location.x == -1) ||
		(player.location.x == 4) ||
		(player.location.y == -1) ||
		(player.location.y == 4))
		{
			player.alive = false;
			cout << "You fall of a ledge to your death..." << endl;
			cout << "\n";
		}

		// displays a message to the console that you have died if the players "x" and "y" coordinates are equal to that of the Wumpus it sets the alive bool of the Player to false.
		if ((player.location.x == wumpus.location.x) && (player.location.y == wumpus.location.y) && (wumpus.alive == true))
		{
			player.alive = false;
			cout << "A Wumpus monster bites your head off.." << endl;
			cout << "\n";
		}

		// if the Player's "x" and "y" coordinates are equal to that of the Gold it sets the Gold bool of the Player to true.
		// dislplays a message to the colse to tell the play that they have picked up the gold and must leave the cave.
		if ((player.location.x == gold.location.x) && (player.location.y == gold.location.y) && (gold.onGround == true))
		{
			player.gold = true;
			gold.onGround = false;
			cout << "You have found the gold, now you must escape the Wumpus cave" << endl;
			cout << "\n";
		}

		// if the players alive bool is false it sets the winCondition bool to false.
		if (player.alive == false)
		{
			winCondition = false;
		}
			
		// if the players "x" and "y" coordinates are equal to the start position (0,0) and the gold bool is true it sets the winCondition to true.
		if ((player.gold == true) && (player.location.x == 0) && (player.location.y == 0))
		{
			winCondition = true;
		}

		// while the winCondition bool is false and the players alive bool is true continue to execute this loop.
	} while ((winCondition == false) && (player.alive == true));
	
	//if the winCondtion bool is true and the players alive bool is true display to the console that they have won the game.
	if ((winCondition == true) && (player.alive == true))
	{
		cout << "\n";
		cout << "\n";
		cout << "Congradulations you escaped the cave with the gold!" << endl;
		cout << "\n";
		
		// clears the save game file if the winCondition bool is true.
		gameSave.open("gameSave.txt", ios_base::out);
		
		gameSave.close();
	}
	
	// deallocates the dynamic memory of the Cell array.
	delete[] cell;

	system("pause");
}
void GlyphStringRenderer::layout()
{
    int width = 0;
    int height = 0;
    int lineHeight = 0;
    int x = 0;
    int y = 0;

    prepareGeometryChange();
    clear();

    if (mGlyphString->state() < GlyphString::LaidOut)
        return;

    for (int i = 0; i < mGlyphString->lineInfos().size(); ++i) {
        width = qMax(width, mGlyphString->lineInfos()[i].width);
        lineHeight = qMax(lineHeight, mGlyphString->lineInfos()[i].height);
        height += mGlyphString->lineInfos()[i].height;
    }
    width += 10 * mPenWidth;

    QString paragraphText = mGlyphString->paragraphType() == FRIBIDI_PAR_RTL ?
                            QString("Paragraph base direction: RTL"):
                            QString("Paragraph base direction: LTR");
    QFontMetrics fontMetrics(mFont);
    width = qMax(width, fontMetrics.width(paragraphText + QString("****")));

    Arrow paragraphArrow;
    if (mGlyphString->paragraphType() == FRIBIDI_PAR_RTL)
        paragraphArrow.init(mFont, paragraphText, mPenWidth,
                            mPenWidth / 2, width - mPenWidth / 2, y, true);
    else
        paragraphArrow.init(mFont, paragraphText, mPenWidth,
                            mPenWidth / 2, width - mPenWidth / 2, y, false);

    if (mFlags & ParagraphArrow) {
        mArrows.push_back(paragraphArrow);
        y += paragraphArrow.height();
    }

    for (int i = 0; i < mGlyphString->lineInfos().size(); ++i) {
        const LineInfo &lineInfo = mGlyphString->lineInfos()[i];
        int levelArrowY = y;
        if (mFlags & LevelArrows)
            y += paragraphArrow.height();
        int runArrowY = y;
        if (mFlags & RunArrows)
            y += paragraphArrow.height();

        y += lineInfo.ascent;
        x = (width - lineInfo.width) / 2;
        x -= lineInfo.left;

        int offset = mGlyphString->reorderedIndex(lineInfo.startOffset);

        int lastRun = mGlyphString->run(offset);
        int lastRunX = x;
        int lastLevel = mGlyphString->level(offset);
        int lastLevelX = x;
        bool lastRunRTL = mGlyphString->runInfos()[lastRun]
                          .direction == HB_DIRECTION_RTL;
        bool lastLevelRTL = lastLevel & 1;

        for (int j = lineInfo.startOffset; j < lineInfo.endOffset; ++j) {
            offset = mGlyphString->reorderedIndex(j);
            const Geometry &geometry = mGlyphString->geometry(offset);
            QPoint p;
            p.setX(x + geometry.left + geometry.xOffset);
            p.setY(y - geometry.top - geometry.yOffset);

            if ((mFlags & RunArrows) && (lastRun != mGlyphString->run(offset))) {
                mArrows.push_back(Arrow(mFont, QString("%1").arg(lastRun), mPenWidth,
                                        lastRunX, x, runArrowY, lastRunRTL, mRunArrowColor));
                lastRun = mGlyphString->run(offset);
                lastRunX = x;
                lastRunRTL = mGlyphString->runInfos()[lastRun]
                             .direction == HB_DIRECTION_RTL;
            }

            if ((mFlags & LevelArrows)
                    && (lastLevel != mGlyphString->level(offset)))
            {
                mArrows.push_back(Arrow(mFont, QString("%1").arg(lastLevel), mPenWidth,
                                        lastLevelX, x, levelArrowY, lastLevelRTL, mLevelArrowColor));
                lastLevel = mGlyphString->level(offset);
                lastLevelX = x;
                lastLevelRTL = lastLevel & 1;
            }

            assert(p.x() >= 0);
            assert(p.x() + mGlyphString->image(offset).width() <= width);
            mImagePositions.push_back(p);
            mImageIndices.push_back(offset);
            x += geometry.xAdvance;
        }

        if (mFlags & RunArrows) {
            mArrows.push_back(Arrow(mFont, QString("%1").arg(lastRun), mPenWidth,
                                    lastRunX, x, runArrowY, lastRunRTL, mRunArrowColor));
        }

        if (mFlags & LevelArrows) {
            mArrows.push_back(Arrow(mFont, QString("%1").arg(lastLevel), mPenWidth,
                                    lastLevelX, x, levelArrowY, lastLevelRTL, mLevelArrowColor));
        }

        y -= lineInfo.ascent;
        y += lineHeight;
    }

    mBoundingRect = QRectF(0, 0, width, y);
    update();
}
Пример #12
0
/*Arc consistency use*/
void CSP::arcConsistency(const State state)
{
    updateDomain(state);
    queue<Arrow> q;
    for (int i=0; i<81; i++) {
        int row=i/9;
        int col=i%9;
        for (int j=0; j<9; j++) {
            if (j!=row) {
                Arrow temp=Arrow(i, 9*j+col);
                q.push(temp);
            }
            if (j!=col) {
                Arrow temp=Arrow(i,9*row+j);
                q.push(temp);
            }
        }
        int tempRow = row / 3 * 3;
        int tempCol = col / 3 * 3;
        for(int l = tempRow; l < tempRow + 3;l++){
            for(int k = tempCol; k < tempCol + 3; k++){
                if (l!=row&&k!=col) {
                    Arrow temp=Arrow(i, l*9+k);
                    q.push(temp);
                    }
                }
            }
        }
    //cout<<q.size()<<endl;
    while (!q.empty()) {
        Arrow arrow=q.front();
        q.pop();
        bool delete_sign=0;
        int row_tail=arrow.tail/9;
        int col_tail=arrow.tail%9;
        int row_head=arrow.head/9;
        int col_head=arrow.head%9;
        if (state.values[row_tail][col_tail]==0) {
            for (int x=0;x<variables[row_tail][col_tail].domain.size();x++)
            {
                int avail=0;
                for (int y=0;y<variables[row_head][col_head].domain.size();
                     y++) {
                    if (variables[row_tail][col_tail].domain[x]!=variables[row_head][col_head].domain[y]) {
                        avail=1;
                        break;
                    }
                }
                if ( avail==0) {
                    delete_sign=1;
                    variables[row_tail][col_tail].domain.erase(std::find(variables[row_tail][col_tail].domain.begin(), variables[row_tail][col_tail].domain.end(), variables[row_tail][col_tail].domain[x]));
                    x--;
                }

        }
        if (delete_sign==1) {
            for (int j=0; j<9; j++) {
                if (j!=row_tail) {
                    Arrow temp=Arrow( arrow.tail,9*j+col_tail);
                    q.push(temp);
                }
                if (j!=col_tail) {
                    Arrow temp=Arrow(arrow.tail,9*row_tail+j);
                    q.push(temp);
                }
                int tempRow = row_tail / 3 * 3;
                int tempCol = col_tail / 3 * 3;
                for(int l = tempRow; l < tempRow + 3;l++){
                    for(int k = tempCol; k < tempCol + 3; k++){
                        if (l!=row_tail&&k!=col_tail) {
                            Arrow temp=Arrow( arrow.tail,l*9+k);
                            q.push(temp);
                        }
                    }
                }
            }
        }
    }
}
}