亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mantischess.cpp

?? 象棋的小游戲
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************
  MantisChess.cpp : 程序入口

  版權(quán)所有(C)  陳成濤

  這一程序是自由軟件,你可以遵照自由軟件基金會出版的GNU通用公共
  許可證條款來修改和重新發(fā)布這一程序?;蛘哂迷S可證的第二版,或者
  (根據(jù)你的選擇)用任何更新的版本。

  發(fā)布這一程序的目的是希望它有用,但沒有任何擔(dān)保。甚至沒有適合特
  定目的的隱含的擔(dān)保。更詳細的情況請參閱GNU通用公共許可證。
  
  你應(yīng)該已經(jīng)和程序一起收到一份GNU通用公共許可證的副本。
  如果還沒有,寫信給:

  The Free Software Foundation,Inc,,675 Mass Ave, Cambridge,
  MAO2139,USA

  如果你在使用本軟件時有什么問題或建議,用以下地址可以與我取得聯(lián)
  系:

              http://thecct.51.net

  或發(fā)Email到:

              stove@eyou.com
              thecct@163.com

------------------------------------------------------------------
  MantisChess.cpp : program entrance

  Copyright (C)  Chen Chengtao, China
  
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  
  If you have any question about this software please visit my hompage:

              http://thecct.51.net

  or E_mail to:

              stove@eyou.com
              thecct@163.com

******************************************************************/


#include "StdAfx.h"
#include "resource.h"
#include "MantisChessDef.h"
#include "MantisChessDraw.h"
#include "MantisChessStd.h"
#include "MantisChessThink.h"

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;								// current instance
TCHAR szTitle[MAX_LOADSTRING];								// The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];								// The title bar text

// Foward declarations of functions included in this code module:
ATOM				MyRegisterClass(HINSTANCE hInstance);
BOOL				InitInstance(HINSTANCE, int);
LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK	About(HWND, UINT, WPARAM, LPARAM);

//----------------------------
void OnCreate(HWND hWnd);
void Reset();
void ShowRect(HDC hdc,LPRECT prect);
void ShowPoint(HDC hdc,POINT point);
void Think(HWND hWnd);
BOOL Go(HWND hWnd,int man,POINT targetpoint);
void OnMouseMove(POINT point);
void OnLButtonDown(HWND hWnd,POINT point);
BOOL FaceToPoint(POINT &point);
void OnBack(HWND hWnd);

//--------------------------------------
static  POINT g_pointChessman[32];	//棋子坐標(biāo)
static  int g_iChessmanMap[11][12];	//棋位狀態(tài)
static  int g_iSide;				//輪到哪放走
static  HCURSOR g_hCurCantGo;		//不可以點擊時顯示的鼠標(biāo)
static  HCURSOR g_hCurHand;			//可以點擊時顯示的鼠標(biāo)
static  HCURSOR g_hCurThinking;		//計算時顯示的鼠標(biāo)
static 	HICON g_hIconChessman[14];	//棋子的圖像
static 	HICON g_hIconBox;			//指示最后一步走法的框
static 	HICON g_hIconSelect;		//指示選擇棋子的框
static 	HICON g_hIconCanMove;		//指示可到達的位置
static 	HICON g_hIconAttack;		//指示被攻擊的棋子
static 	HDC g_hdcChessboard;		//棋盤的設(shè)備描述表
static 	HBITMAP g_hbmpChessboard;	//棋盤的位圖
static 	POINT g_pointBoxFrom;		//最后一步的原始位置
static 	POINT g_pointBoxTo;			//最后一步的目標(biāo)位置
static 	int g_iChessmanSelect;		//選擇的棋子
static 	int g_iComputerSide;		//電腦的顏色
static  BOOL g_bEndGame;			//游戲結(jié)束標(biāo)志
static  BOOL g_bCanMove[11][12];	//

static	struct	MOVEHISTORY	g_MoveHistory;
//--------------------------------------

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	// TODO: Place code here.
	MSG msg;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_MANTIS, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow)) 
	{
		return FALSE;
	}

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}



//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage is only necessary if you want this code
//    to be compatible with Win32 systems prior to the 'RegisterClassEx'
//    function that was added to Windows 95. It is important to call this function
//    so that the application will get 'well formed' small icons associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
	WNDCLASSEX wcex;

	wcex.cbSize = sizeof(WNDCLASSEX); 

	wcex.style			= CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc	= (WNDPROC)WndProc;
	wcex.cbClsExtra		= 0;
	wcex.cbWndExtra		= 0;
	wcex.hInstance		= hInstance;
	wcex.hIcon			= LoadIcon(hInstance, (LPCTSTR)IDI_MANTIS);
	wcex.hCursor		= NULL;
	wcex.hbrBackground	= NULL;
	wcex.lpszMenuName	= (LPCSTR)IDC_MANTIS;
	wcex.lpszClassName	= szWindowClass;
	wcex.hIconSm		= LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

	return RegisterClassEx(&wcex);
}

//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	RECT rect;
	TCHAR szHello[MAX_LOADSTRING];
	LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
	POINT point;
	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{
				case IDM_ABOUT:
				   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				   break;
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				case IDM_NEW_BLACK:
					Reset();
					g_iComputerSide=RED;
					rect.left=0;
					rect.top=0;
					rect.right=XBW;
					rect.bottom=YBW;
					hdc=GetDC(hWnd);
					ShowRect(hdc,&rect);
					SetCursor(g_hCurThinking);
					Think(hWnd);
					SetCursor(g_hCurCantGo);
					break;
				case IDM_NEW_RED:
					Reset();
					g_iComputerSide=BLACK;
					rect.left=0;
					rect.top=0;
					rect.right=XBW;
					rect.bottom=YBW;
					hdc=GetDC(hWnd);
					ShowRect(hdc,&rect);
					break;
				case IDM_BACK:
					OnBack(hWnd);
					break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
			// TODO: Add any drawing code here...
			RECT rect;
			GetClientRect(hWnd, &rect);
			ShowRect(hdc,&rect);	
			EndPaint(hWnd, &ps);
			break;
		case WM_DESTROY:
			DeleteObject(g_hbmpChessboard);
			DeleteDC(g_hdcChessboard);
			PostQuitMessage(0);
			break;
		case WM_CREATE:
			OnCreate(hWnd);
			break;
		case WM_LBUTTONDOWN:
			point.x=LOWORD(lParam);
			point.y=HIWORD(lParam);
			OnLButtonDown(hWnd,point);
			break;
		case WM_MOUSEMOVE:
			point.x=LOWORD(lParam);
			point.y=HIWORD(lParam);
			OnMouseMove(point);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}

// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_INITDIALOG:
				return TRUE;

		case WM_COMMAND:
			if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) 
			{
				EndDialog(hDlg, LOWORD(wParam));
				return TRUE;
			}
			break;
	}
    return FALSE;
}


/******************************************************************
OnCreate:		WM_CREATE 消息響應(yīng)函數(shù),建立窗口時進行初始化

參數(shù):
hWnd:			窗口句柄

返回值:			無
******************************************************************/
void OnCreate(HWND hWnd)
{
	g_hCurHand=LoadCursor(hInst,MAKEINTRESOURCE(IDC_HAND));
	g_hCurThinking=LoadCursor(hInst,MAKEINTRESOURCE(IDC_THINKING));
	g_hCurCantGo=LoadCursor(hInst,MAKEINTRESOURCE(IDC_CANTGO));
	g_hIconChessman[RED_K]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_K));
	g_hIconChessman[RED_S]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_S));
	g_hIconChessman[RED_X]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_X));
	g_hIconChessman[RED_M]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_M));
	g_hIconChessman[RED_J]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_J));
	g_hIconChessman[RED_P]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_P));
	g_hIconChessman[RED_B]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_R_B));

	g_hIconChessman[BLACK_K]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_K));
	g_hIconChessman[BLACK_S]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_S));
	g_hIconChessman[BLACK_X]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_X));
	g_hIconChessman[BLACK_M]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_M));
	g_hIconChessman[BLACK_J]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_J));
	g_hIconChessman[BLACK_P]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_P));
	g_hIconChessman[BLACK_B]=LoadIcon(hInst,MAKEINTRESOURCE(IDI_B_B));
	g_hIconBox=LoadIcon(hInst,MAKEINTRESOURCE(IDI_BOX));
	g_hIconSelect=LoadIcon(hInst,MAKEINTRESOURCE(IDI_SELECT));
	g_hIconCanMove=LoadIcon(hInst,MAKEINTRESOURCE(IDI_CANMOVE));
	g_hIconAttack=LoadIcon(hInst,MAKEINTRESOURCE(IDI_ATTACK));

	Reset();
	HDC hdc=GetDC(hWnd);
	g_hdcChessboard=CreateCompatibleDC(hdc);
	g_hbmpChessboard=CreateCompatibleBitmap(hdc,XBW,YBW);
	SelectObject(g_hdcChessboard,g_hbmpChessboard);
	int nCurTime=(int)::GetTickCount();
	MakeBoard(g_hdcChessboard,RGB(180,180+nCurTime%30,160));
	RECT rect={0,0,XBW,YBW};
	AdjustWindowRect(&rect,WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU,TRUE);
	POINT lefttop;
	lefttop.x=(GetSystemMetrics(SM_CXSCREEN)-(rect.right-rect.left))/2;
	lefttop.y=(GetSystemMetrics(SM_CYSCREEN)-(rect.bottom-rect.top))/2;
	rect.left+=lefttop.x;
	rect.right+=lefttop.x;
	rect.top+=lefttop.y;
	rect.bottom+=lefttop.y;
	MoveWindow(hWnd,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,TRUE);
}

/******************************************************************
Reset:			把數(shù)據(jù)恢復(fù)為初始值

參數(shù):			無

返回值:			無
******************************************************************/
void Reset()
{
	int i,j;

	g_pointChessman[0].x=5;g_pointChessman[0].y=10;	//帥
	g_pointChessman[1].x=4;g_pointChessman[1].y=10;	//士
	g_pointChessman[2].x=6;g_pointChessman[2].y=10;	
	g_pointChessman[3].x=3;g_pointChessman[3].y=10;	//相
	g_pointChessman[4].x=7;g_pointChessman[4].y=10;
	g_pointChessman[5].x=2;g_pointChessman[5].y=10;	//馬
	g_pointChessman[6].x=8;g_pointChessman[6].y=10;
	g_pointChessman[7].x=1;g_pointChessman[7].y=10;	//車

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷中文字幕一区三区| 一色屋精品亚洲香蕉网站| 成人综合婷婷国产精品久久蜜臀| 亚洲人成亚洲人成在线观看图片| 日韩一卡二卡三卡四卡| 99精品桃花视频在线观看| 国产在线视频精品一区| 亚洲成人一区二区| 国产精品人人做人人爽人人添| 欧美一区二区三区视频免费| 一本一道久久a久久精品| 国产成人亚洲综合色影视| 天堂在线亚洲视频| 有码一区二区三区| 欧美国产欧美综合| 久久这里都是精品| 日韩欧美国产电影| 欧美高清视频不卡网| 91视频免费看| www.成人网.com| 国产福利视频一区二区三区| 美女视频免费一区| 日韩av网站在线观看| 亚洲一级二级在线| 亚洲免费观看高清完整版在线观看熊 | 中文字幕一区二区三区av| 久久新电视剧免费观看| 日韩欧美精品在线视频| 欧美欧美午夜aⅴ在线观看| 91麻豆蜜桃一区二区三区| 懂色av中文一区二区三区| 国产乱妇无码大片在线观看| 久久99精品久久久久久国产越南| 蜜桃视频在线一区| 另类中文字幕网| 激情综合网最新| 美国十次综合导航| 经典三级一区二区| 国产自产2019最新不卡| 国产美女在线观看一区| 国产精品一二三区| 国产白丝精品91爽爽久久| 国产·精品毛片| 成人成人成人在线视频| av不卡一区二区三区| 91亚洲精品乱码久久久久久蜜桃| 97超碰欧美中文字幕| 色狠狠综合天天综合综合| 在线观看日韩一区| 99久久精品国产麻豆演员表| 日韩电影一区二区三区| 一卡二卡三卡日韩欧美| 国产欧美综合在线观看第十页| 色哟哟国产精品| 成人综合在线视频| 岛国一区二区三区| 国产99久久精品| 国产一区二区日韩精品| 麻豆精品一区二区综合av| 天天综合色天天| 中文字幕高清一区| 国产成人精品免费| 成人一区二区三区视频在线观看| 成人午夜在线视频| 欧美亚洲综合另类| 91麻豆精品国产91久久久资源速度 | 亚洲综合在线五月| 婷婷久久综合九色国产成人| 另类小说视频一区二区| 国产精品一区二区在线播放 | 成人永久免费视频| 色网综合在线观看| 91精品国产综合久久香蕉麻豆| 精品久久久久久无| 国产精品久久久久久久第一福利| 亚洲一区视频在线观看视频| 青青青伊人色综合久久| 成人免费毛片aaaaa**| 欧美美女视频在线观看| 久久久噜噜噜久噜久久综合| 亚洲美女在线国产| 久久99国产精品免费网站| av爱爱亚洲一区| 欧美一区二区黄色| 综合激情成人伊人| 蜜桃一区二区三区四区| 色噜噜夜夜夜综合网| 精品日韩99亚洲| 伊人开心综合网| 国产成人自拍高清视频在线免费播放| 在线观看欧美精品| 国产日韩精品一区二区三区| 亚洲精品欧美激情| 国产成人午夜电影网| 欧美日韩二区三区| 最近日韩中文字幕| 国产真实乱对白精彩久久| 欧美亚洲高清一区| 国产精品电影一区二区三区| 蜜臀99久久精品久久久久久软件| 一本大道久久a久久综合婷婷 | 国产精品久久精品日日| 老司机精品视频导航| 在线观看成人小视频| 国产精品女人毛片| 国产一区在线视频| 欧美一区二区三区视频在线| 一区二区三区欧美| 99久久99久久精品国产片果冻| 久久影院午夜片一区| 奇米影视一区二区三区| 欧美性视频一区二区三区| 国产精品嫩草影院av蜜臀| 国产麻豆视频一区| 日韩精品在线一区| 青草av.久久免费一区| 欧美三级韩国三级日本三斤| 中文字幕欧美一| 波多野结衣亚洲一区| 久久久.com| 国模套图日韩精品一区二区| 欧美成人三级在线| 久久国产日韩欧美精品| 91麻豆精品国产91久久久久久久久| 亚洲一区二区三区视频在线播放 | 亚洲人成网站在线| 99久久精品免费看国产| 国产精品黄色在线观看| 岛国精品一区二区| 国产免费观看久久| 高清不卡一区二区在线| 国产女人18毛片水真多成人如厕 | 国产精品一区二区在线观看不卡| 精品sm在线观看| 激情五月婷婷综合网| 欧美成人女星排行榜| 久久99国产精品麻豆| 久久久久久电影| 国产成人精品www牛牛影视| 欧美激情中文字幕| jlzzjlzz亚洲女人18| 亚洲视频免费观看| 国产日产亚洲精品系列| 国产v日产∨综合v精品视频| 中文字幕av一区二区三区免费看| 成人激情文学综合网| 中文字幕一区二区5566日韩| 91网站在线播放| 天天射综合影视| 欧美一区二区三区免费在线看| 麻豆精品一区二区三区| 国产日韩欧美不卡| aaa欧美色吧激情视频| 亚洲综合视频网| 欧美一区二区三区在线看| 久久99精品久久久久久国产越南 | 成人网页在线观看| 国产精品久久久久久久久搜平片| 91在线看国产| 亚洲成人高清在线| 精品日产卡一卡二卡麻豆| 懂色av一区二区在线播放| 亚洲精品日韩专区silk| 91精品国产入口| 国产精品亚洲午夜一区二区三区 | 亚洲男同性恋视频| 欧美精品自拍偷拍动漫精品| 久久99精品国产| 亚洲色图在线视频| 欧美一区二区视频免费观看| 国产suv精品一区二区6| 亚洲午夜视频在线| 精品毛片乱码1区2区3区| 99久久国产免费看| 看片的网站亚洲| 综合分类小说区另类春色亚洲小说欧美 | 亚洲大片一区二区三区| 精品乱码亚洲一区二区不卡| www.成人网.com| 免费精品99久久国产综合精品| 亚洲国产精品激情在线观看| 欧美午夜精品久久久久久超碰| 国产一区二区美女| 亚洲高清不卡在线| 国产精品嫩草久久久久| 欧美精品在线视频| 99久久精品情趣| 国产一区啦啦啦在线观看| 一区二区三区免费| 久久网站最新地址| 欧美日韩你懂的| 99v久久综合狠狠综合久久| 免费观看久久久4p| 亚洲精品成人悠悠色影视| 久久免费电影网| 4hu四虎永久在线影院成人| 波多野结衣91| 国产成人在线影院| 精品一区二区三区免费| 亚洲va欧美va人人爽|