⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.~cpp

📁 运用回溯法编写了国际跳棋的程序.并且考虑了对称性快速得出所有答案.
💻 ~CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#include <stdio.h>
#include <string>
using namespace std;

#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
struct point
  {int x,y; };
int i,j,k,count1;
int s[7][7];
point way[31][2];

//---------------------------------------------------------------------------
void tiaoqi(int n);
void changecolor(int a);
void qipancolor(void);
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void changecolor(int a)
{
 switch(a)
   {
   case 13: if (Form1->Shape13->Brush->Color==clWhite)
                   Form1->Shape13->Brush->Color=clYellow;
                else Form1->Shape13->Brush->Color=clWhite;
                Form1->Shape13->Repaint();
                break;
   case 14: if (Form1->Shape14->Brush->Color==clWhite)
                   Form1->Shape14->Brush->Color=clYellow;
                else Form1->Shape14->Brush->Color=clWhite;
                Form1->Shape14->Repaint();
                break;
   case 15: if (Form1->Shape15->Brush->Color==clWhite)
                   Form1->Shape15->Brush->Color=clYellow;
                else Form1->Shape15->Brush->Color=clWhite;
                Form1->Shape15->Repaint();
                break;
   case 23: if (Form1->Shape23->Brush->Color==clWhite)
                   Form1->Shape23->Brush->Color=clYellow;
                else Form1->Shape23->Brush->Color=clWhite;
                Form1->Shape23->Repaint();
                break;
   case 24: if (Form1->Shape24->Brush->Color==clWhite)
                   Form1->Shape24->Brush->Color=clYellow;
                else Form1->Shape24->Brush->Color=clWhite;
                Form1->Shape24->Repaint();
                break;
   case 25: if (Form1->Shape25->Brush->Color==clWhite)
                   Form1->Shape25->Brush->Color=clYellow;
                else Form1->Shape25->Brush->Color=clWhite;
                Form1->Shape25->Repaint();
                break;
   case 31: if (Form1->Shape31->Brush->Color==clWhite)
                   Form1->Shape31->Brush->Color=clYellow;
                else Form1->Shape31->Brush->Color=clWhite;
                Form1->Shape31->Repaint();
                break;
   case 32: if (Form1->Shape32->Brush->Color==clWhite)
                   Form1->Shape32->Brush->Color=clYellow;
                else Form1->Shape32->Brush->Color=clWhite;
                Form1->Shape32->Repaint();
                break;
   case 33: if (Form1->Shape33->Brush->Color==clWhite)
                   Form1->Shape33->Brush->Color=clYellow;
                else Form1->Shape33->Brush->Color=clWhite;
                Form1->Shape33->Repaint();
                break;
   case 34: if (Form1->Shape34->Brush->Color==clWhite)
                   Form1->Shape34->Brush->Color=clYellow;
                else Form1->Shape34->Brush->Color=clWhite;
                Form1->Shape34->Repaint();
                break;
   case 35: if (Form1->Shape35->Brush->Color==clWhite)
                   Form1->Shape35->Brush->Color=clYellow;
                else Form1->Shape35->Brush->Color=clWhite;
                Form1->Shape35->Repaint();
                break;
   case 36: if (Form1->Shape36->Brush->Color==clWhite)
                   Form1->Shape36->Brush->Color=clYellow;
                else Form1->Shape36->Brush->Color=clWhite;
                Form1->Shape36->Repaint();
                break;
   case 37: if (Form1->Shape37->Brush->Color==clWhite)
                   Form1->Shape37->Brush->Color=clYellow;
                else Form1->Shape37->Brush->Color=clWhite;
                Form1->Shape37->Repaint();
                break;
   case 41: if (Form1->Shape41->Brush->Color==clWhite)
                   Form1->Shape41->Brush->Color=clYellow;
                else Form1->Shape41->Brush->Color=clWhite;
                Form1->Shape41->Repaint();
                break;
   case 42: if (Form1->Shape42->Brush->Color==clWhite)
                   Form1->Shape42->Brush->Color=clYellow;
                else Form1->Shape42->Brush->Color=clWhite;
                Form1->Shape42->Repaint();
                break;
   case 43: if (Form1->Shape43->Brush->Color==clWhite)
                   Form1->Shape43->Brush->Color=clYellow;
                else Form1->Shape43->Brush->Color=clWhite;
                Form1->Shape43->Repaint();
                break;
   case 44: if (Form1->Shape44->Brush->Color==clWhite)
                   Form1->Shape44->Brush->Color=clYellow;
                else Form1->Shape44->Brush->Color=clWhite;
                Form1->Shape44->Repaint();
                break;
   case 45: if (Form1->Shape45->Brush->Color==clWhite)
                   Form1->Shape45->Brush->Color=clYellow;
                else Form1->Shape45->Brush->Color=clWhite;
                Form1->Shape45->Repaint();
                break;
   case 46: if (Form1->Shape46->Brush->Color==clWhite)
                   Form1->Shape46->Brush->Color=clYellow;
                else Form1->Shape46->Brush->Color=clWhite;
                Form1->Shape46->Repaint();
                break;
   case 47: if (Form1->Shape47->Brush->Color==clWhite)
                   Form1->Shape47->Brush->Color=clYellow;
                else Form1->Shape47->Brush->Color=clWhite;
                Form1->Shape47->Repaint();
                break;
   case 51: if (Form1->Shape51->Brush->Color==clWhite)
                   Form1->Shape51->Brush->Color=clYellow;
                else Form1->Shape51->Brush->Color=clWhite;
                Form1->Shape51->Repaint();
                break;
   case 52: if (Form1->Shape52->Brush->Color==clWhite)
                   Form1->Shape52->Brush->Color=clYellow;
                else Form1->Shape52->Brush->Color=clWhite;
                Form1->Shape52->Repaint();
                break;
   case 53: if (Form1->Shape53->Brush->Color==clWhite)
                   Form1->Shape53->Brush->Color=clYellow;
                else Form1->Shape53->Brush->Color=clWhite;
                Form1->Shape53->Repaint();
                break;
   case 54: if (Form1->Shape54->Brush->Color==clWhite)
                   Form1->Shape54->Brush->Color=clYellow;
                else Form1->Shape54->Brush->Color=clWhite;
                Form1->Shape54->Repaint();
                break;
   case 55: if (Form1->Shape55->Brush->Color==clWhite)
                   Form1->Shape55->Brush->Color=clYellow;
                else Form1->Shape55->Brush->Color=clWhite;
                Form1->Shape55->Repaint();
                break;
   case 56: if (Form1->Shape56->Brush->Color==clWhite)
                   Form1->Shape56->Brush->Color=clYellow;
                else Form1->Shape56->Brush->Color=clWhite;
                Form1->Shape56->Repaint();
                break;
   case 57: if (Form1->Shape57->Brush->Color==clWhite)
                   Form1->Shape57->Brush->Color=clYellow;
                else Form1->Shape57->Brush->Color=clWhite;
                Form1->Shape57->Repaint();
                break;
   case 63: if (Form1->Shape63->Brush->Color==clWhite)
                   Form1->Shape63->Brush->Color=clYellow;
                else Form1->Shape63->Brush->Color=clWhite;
                Form1->Shape63->Repaint();
                break;
   case 64: if (Form1->Shape64->Brush->Color==clWhite)
                   Form1->Shape64->Brush->Color=clYellow;
                else Form1->Shape64->Brush->Color=clWhite;
                Form1->Shape64->Repaint();
                break;
   case 65: if (Form1->Shape65->Brush->Color==clWhite)
                   Form1->Shape65->Brush->Color=clYellow;
                else Form1->Shape65->Brush->Color=clWhite;
                Form1->Shape65->Repaint();
                break;
   case 73: if (Form1->Shape73->Brush->Color==clWhite)
                   Form1->Shape73->Brush->Color=clYellow;
                else Form1->Shape73->Brush->Color=clWhite;
                Form1->Shape73->Repaint();
                break;
   case 74: if (Form1->Shape74->Brush->Color==clWhite)
                   Form1->Shape74->Brush->Color=clYellow;
                else Form1->Shape74->Brush->Color=clWhite;
                Form1->Shape74->Repaint();
                break;
   case 75: if (Form1->Shape75->Brush->Color==clWhite)
                   Form1->Shape75->Brush->Color=clYellow;
                else Form1->Shape75->Brush->Color=clWhite;
                Form1->Shape75->Repaint();
                break;
   }
}

void qipancolor(void)
{
            Form1->Shape13->Brush->Color=clYellow;
            Form1->Shape13->Repaint();
            Form1->Shape14->Brush->Color=clYellow;
            Form1->Shape14->Repaint();
            Form1->Shape15->Brush->Color=clYellow;
            Form1->Shape15->Repaint();
            Form1->Shape23->Brush->Color=clYellow;
            Form1->Shape23->Repaint();
            Form1->Shape24->Brush->Color=clYellow;
            Form1->Shape24->Repaint();
            Form1->Shape25->Brush->Color=clYellow;
            Form1->Shape25->Repaint();
            Form1->Shape31->Brush->Color=clYellow;
            Form1->Shape31->Repaint();
            Form1->Shape32->Brush->Color=clYellow;
            Form1->Shape32->Repaint();
            Form1->Shape33->Brush->Color=clYellow;
            Form1->Shape33->Repaint();
            Form1->Shape34->Brush->Color=clYellow;
            Form1->Shape34->Repaint();
            Form1->Shape35->Brush->Color=clYellow;
            Form1->Shape35->Repaint();
            Form1->Shape36->Brush->Color=clYellow;
            Form1->Shape36->Repaint();
            Form1->Shape37->Brush->Color=clYellow;
            Form1->Shape37->Repaint();
            Form1->Shape41->Brush->Color=clYellow;
            Form1->Shape41->Repaint();
            Form1->Shape42->Brush->Color=clYellow;
            Form1->Shape42->Repaint();
            Form1->Shape43->Brush->Color=clYellow;
            Form1->Shape43->Repaint();
            Form1->Shape44->Brush->Color=clWhite;
            Form1->Shape44->Repaint();
            Form1->Shape45->Brush->Color=clYellow;
            Form1->Shape45->Repaint();
            Form1->Shape46->Brush->Color=clYellow;
            Form1->Shape46->Repaint();
            Form1->Shape47->Brush->Color=clYellow;
            Form1->Shape47->Repaint();
            Form1->Shape51->Brush->Color=clYellow;
            Form1->Shape51->Repaint();
            Form1->Shape52->Brush->Color=clYellow;
            Form1->Shape52->Repaint();
            Form1->Shape53->Brush->Color=clYellow;
            Form1->Shape53->Repaint();

⌨️ 快捷键说明

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