版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、VC+ PROJECTECJTUNAME STUDENT IDLIU * 2*LI * 2*DAI * 2*WANG * 2*ZUO * 2*STUDENT CLASS:CLASS 1MAJOR: 2*CertificateThis to certify that the following students:1. Liu *,and Student ID No is 2*2. Li * and Student ID No is 2*3. Dai * and Student ID No is 2*4. Wang * and Student ID No is 2*5. Zuo * and Stu
2、dent ID No is 2*are done this project under the guidance and supervision of MR.RAVI and it is submitted to the East China JiaoTong University as partial fulfillment of Software and Machanic & Electronics Engineering graduation.Signature of the GuideAcknowledgementFirstly, we would like to expres
3、s my deep and sincere gratitude to our parents, as they gave me life and brought me up. Besides, they do their best to make our life better, but they seldom care about themselves. We know they have so many hopes and wishes for my future, and Ill do my best to respond you. Secondly, we warmly thank P
4、rofessor Mr. Ravi for his valuable advice and patient help. He taught us the Visual C+ course and let me know the foundation of MFC. Moreover, thanks to the help of Mr. Ravi, my ability of spoken English has been improved.Finally, we would like express my thanks to other classmates who helped us wit
5、h the process of doing the project.Content1. System study -5 2. Hardware and Software Required Developing the Project-73. Hardware and Software Required to Run Project-74. Screen shot- 85. Source Code-11 skyblue_LLK.h-11 skyblue_LLK.cpp-12 Resource.h-14 skyblue_LLKDlg.h-15 stdafx.h- 18 skyblue_LLKDl
6、g.cpp-19 StdAfx.cpp- 326. References- 321. System StudyA total of four lianliankan even method, but the algorithm only requires three.The first kind:Direct even. As long as the two pictures neighboring or two pictures a coordinate equal, are not equal coordinates between picture is empty.The second
7、kind: in one picture crossover square is alexandrine, find empty place in an array of record, let the array each worth with another picture position directly even calculation.Cross even.The third kind:The two pictures cross on the direction of empty place recorded in group 2 array, let two groups of
8、 array loop computations directly connected.Operation bought, there will be a table, there are disrupted sequence pairs of design.Click on one of the pattern, and then click another pattern, if accord with algorithm, it will be eliminated off.When all designs is eliminated, the game is over.C_LLK_Dl
9、g: : StartNewGame () : initialization map, will map all squares regional position set to empty squares stateC_LLK_Dlg: : GameDraw (CDC * pDC) : game area of paintC_LLK_Dlg: : OnLButtonDown (nFlags, CPoint UINT point) : mouse the left key message handlingC_LLK_Dlg: : X1_Link_X2 (int x, int y1, int y2
10、) : x directly connectedC_LLK_Dlg: : Y1_Link_Y2 (int clamps its x1, int, int y x2) : y directly connectedC_LLK_Dlg: : LineX (int x, int y1, int y2) : whether a straight onC_LLK_Dlg: : LineY (int clamps its x1 int x2, int y, whether the line) : generalC_LLK_Dlg: : OneCornerLink (int clamps its x1 y1,
11、 int x2, int, int y2) : 1 right-angle interface connectivityC_LLK_Dlg: : TwoCornerLink (int clamps its x1 y1, int x2, int, int y2) : 2 right-angle interface connectivityC_LLK_Dlg: : IsLink (int clamps its x1 y1, int x2, int, int y2) : judge selected two squares whether can eliminateC_LLK_Dlg: : PreT
12、ranslateMessage (MSG * pMsg) : intercept keyboard messages F2 (for the new game)C_LLK_Dlg: : IsWin (use void) : to test whether has won the game2. Hardware and Software Required to Develop the ProjectHardware Processor: Intel(R) Core(TM)2 Duo CPU T5550 1.8GHzRam: 2GB RAMDisplay Adapter: WXGA LCD (12
13、80*800)Monitor size : 14.1''Keyboard: 104keysSoftwareMicrosoft Visual C+ Version: 6.0Operating system: Windows 7 Ultimate 7600 6.1.7600Database : Access versionProgramming Language:VC+IDE :Visual studio3.Hardware and Software Required to Run the Project HardwareProcessor: Intel(R) Pentium(TM
14、)4 1.5GHzRam: 512MB RAMDisplay Adapter: 800*600 AboveKeyboard:104keysSoftware Microsoft Visual C+ Version: 6.0Operating system: Windows 2000/XP/Vista/7Database : Access versionProgramming Language: VC+IDE: Visual studio4.Screen shot Start the game Game playThe game ends5. Source Codeskyblue_LLK.h#if
15、 !defined(AFX_SKYBLUE_LLK_H_A2AA2546_B9F0_4250_9623_03889A3B311A_INCLUDED_)#define AFX_SKYBLUE_LLK_H_A2AA2546_B9F0_4250_9623_03889A3B311A_INCLUDED_#if _MSC_VER > 1000#pragma once#endif / _MSC_VER > 1000#ifndef _AFXWIN_H_#error include 'stdafx.h' before including this file for PCH#endif
16、#include "resource.h"/ main symbols/ CSkyblue_LLKApp:/ See skyblue_LLK.cpp for the implementation of this class/class CSkyblue_LLKApp : public CWinApppublic:CSkyblue_LLKApp();/ Overrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CSkyblue_LLKApp)public:virtual BOOL InitI
17、nstance();/AFX_VIRTUAL/ Implementation/AFX_MSG(CSkyblue_LLKApp)/ NOTE - the ClassWizard will add and remove member functions here./ DO NOT EDIT what you see in these blocks of generated code !/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations
18、immediately before the previous line.#endif / !defined(AFX_SKYBLUE_LLK_H_A2AA2546_B9F0_4250_9623_03889A3B311A_INCLUDED_)skyblue_LLK.cpp/ skyblue_LLK.cpp : Defines the class behaviors for the application./#include "stdafx.h"#include "skyblue_LLK.h"#include "skyblue_LLKDlg.h&q
19、uot;#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CSkyblue_LLKAppBEGIN_MESSAGE_MAP(CSkyblue_LLKApp, CWinApp)/AFX_MSG_MAP(CSkyblue_LLKApp)/ NOTE - the ClassWizard will add and remove mapping macros here./ DO NOT EDIT what you see in these blocks of generated
20、 code!/AFX_MSGON_COMMAND(ID_HELP, CWinApp:OnHelp)END_MESSAGE_MAP()/ CSkyblue_LLKApp constructionCSkyblue_LLKApp:CSkyblue_LLKApp()/ TODO: add construction code here,/ Place all significant initialization in InitInstance/ The one and only CSkyblue_LLKApp objectCSkyblue_LLKApp theApp;/ CSkyblue_LLKApp
21、initializationBOOL CSkyblue_LLKApp:InitInstance()AfxEnableControlContainer();/ Standard initialization/ If you are not using these features and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization routines you do not need.C_LLK_Dlg dlg;
22、m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse = IDOK)/ TODO: Place code here to handle when the dialog is/ dismissed with OKelse if (nResponse = IDCANCEL)/ TODO: Place code here to handle when the dialog is/ dismissed with Cancel/ Since the dialog has been closed, return FALSE so
23、 that we exit the/ application, rather than start the application's message pump.return FALSE;Resource.h/NO_DEPENDENCIES/ Microsoft Developer Studio generated include file./ Used by skyblue_LLK.rc/#define IDD_SKYBLUE_LLK_DIALOG 102#define IDD_LLK_DIALOG 102#define IDR_MAINFRAME 128#define IDB_BM
24、P_ANIMAL 130#define IDB_BITMAP_3D_FRAMES 131/ Next default values for new objects/ #ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONLY_SYMBOLS#define _APS_NEXT_RESOURCE_VALUE 132#define _APS_NEXT_COMMAND_VALUE 32771#define _APS_NEXT_CONTROL_VALUE 1000#define _APS_NEXT_SYMED_VALUE 101#endif#endifskyblue
25、_LLKDlg.h/*+Copyright (c) AFE(Active-Free-Elegance)Module Name: skyblue_LLKDlg.hAbstract:LLK-Game's kernal-solving DialogAuthor: Weijian Luo (Arthur Luo) 15-Jun-2005E-mail: skybluehackerRevision History: 1.0-*/#if !defined(AFX_SKYBLUE_LLKDLG_H_F043F328_5562_4EEC_921D_508E1DBDC900_INCLUDED_)#defi
26、ne AFX_SKYBLUE_LLKDLG_H_F043F328_5562_4EEC_921D_508E1DBDC900_INCLUDED_#if _MSC_VER > 1000#pragma once#endif / _MSC_VER > 1000/ C_LLK_Dlg dialogclass C_LLK_Dlg : public CDialog/ Constructionpublic:/GameDrawvoid GameDraw(CDC * pDC);/StartNewGamevoid StartNewGame();BOOL IsLink(int x1,int y1,int x
27、2,int y2);BOOL IsWin(void);/X=BOOL X1_Link_X2(int x,int y1,int y2);/Y=BOOL Y1_Link_Y2(int x1,int x2,int y);BOOL OneCornerLink(int x1,int y1,int x2,int y2);BOOL TwoCornerLink(int x1,int y1,int x2,int y2);BOOL YThrough(int x,int y,BOOL bAdd);BOOL XThrough(int x,int y,BOOL bAdd);BOOL LineX(int x,int y1
28、,int y2);BOOL LineY(int x1,int x2,int y);C_LLK_Dlg(CWnd* pParent = NULL);/ standard constructorC_LLK_Dlg();/ Dialog Data/AFX_DATA(CTemp2Dlg)enum IDD = IDD_LLK_DIALOG ;/ NOTE: the ClassWizard will add data members here/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CTemp2Dlg)p
29、ublic:virtual BOOL PreTranslateMessage(MSG* pMsg);protected:virtual void DoDataExchange(CDataExchange* pDX);/ DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:HICON m_hIcon;CDCm_mem3DBkDC; CBitmap m_mem3DBkBmp; CDCm_memAnimalDC; CBitmap m_memAnimalBmp; CDCm_MemDC; CBitmap m_memBitmap; /地图位置相关属性组
30、int*m_map; intm_nRow; intm_nCol; intm_nX1; intm_nY1; / Generated message map functions/AFX_MSG(CTemp2Dlg)virtual BOOL OnInitDialog();afx_msg void OnPaint();afx_msg HCURSOR OnQueryDragIcon();afx_msg void OnLButtonDown(UINT nFlags, CPoint point);/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Micr
31、osoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_SKYBLUE_LLKDLG_H_F043F328_5562_4EEC_921D_508E1DBDC900_INCLUDED_)stdafx.h/ stdafx.h : include file for standard system include files,/ or project specific include files that are used frequen
32、tly, but/ are changed infrequently/#if !defined(AFX_STDAFX_H_F66DEF85_CF00_4F60_8D9D_B3BBB3169771_INCLUDED_)#define AFX_STDAFX_H_F66DEF85_CF00_4F60_8D9D_B3BBB3169771_INCLUDED_#if _MSC_VER > 1000#pragma once#endif / _MSC_VER > 1000#define VC_EXTRALEAN/ Exclude rarely-used stuff from Windows hea
33、ders#include <afxwin.h> / MFC core and standard components#include <afxext.h> / MFC extensions#include <afxdisp.h> / MFC Automation classes#include <afxdtctl.h>/ MFC support for Internet Explorer 4 Common Controls#ifndef _AFX_NO_AFXCMN_SUPPORT#include <afxcmn.h>/ MFC su
34、pport for Windows Common Controls#endif / _AFX_NO_AFXCMN_SUPPORT/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_STDAFX_H_F66DEF85_CF00_4F60_8D9D_B3BBB3169771_INCLUDED_)skyblue_LLKDlg.cpp/*+Copyright (c) AFE(Acti
35、ve-Free-Elegance)Module Name: skyblue_LLKDlg.cppAbstract:LLK-Game's kernal-solving DialogAuthor: Weijian Luo (Arthur Luo) 15-Jun-2005E-mail: skybluehackerRevision History: 1.0-*/#include "stdafx.h"#include "skyblue_LLK.h"#include "skyblue_LLKDlg.h"#ifdef _DEBUG#defi
36、ne new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ C_LLK_Dlg dialog#define BKCOLOR RGB(128,128,128)#define FRONTWIDTH (39+2) #define FRONTHEIGHT (39+12) #define BKWIDTH 46#define BKHEIGHT 56#define ROWCOUNT 7#define COLCOUNT 12#define BLANK_STATE -1 / C_LLK_Dlg dialogC_LLK_Dlg:C_
37、LLK_Dlg(CWnd* pParent /*=NULL*/): CDialog(C_LLK_Dlg:IDD, pParent)/AFX_DATA_INIT(C_LLK_Dlg)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);m_nY1= BLANK_STA
38、TE;m_nX1= BLANK_STATE;m_nRow=ROWCOUNT;m_nCol=COLCOUNT;m_map=new intm_nRow*m_nCol;C_LLK_Dlg:C_LLK_Dlg()delete m_map;void C_LLK_Dlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(C_LLK_Dlg)/ NOTE: the ClassWizard will add DDX and DDV calls here/AFX_DATA_MAPBEGIN_MESSAGE_MA
39、P(C_LLK_Dlg, CDialog)/AFX_MSG_MAP(C_LLK_Dlg)ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_WM_LBUTTONDOWN()/AFX_MSG_MAPEND_MESSAGE_MAP()/ C_LLK_Dlg message handlersBOOL C_LLK_Dlg:OnInitDialog()CDialog:OnInitDialog();/ Set the icon for this dialog. The framework does this automatically/ when the application
40、9;s main window is not a dialogSetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE);/ Set small iconCDC *pWinDC = GetDC();m_mem3DBkDC.CreateCompatibleDC(pWinDC);m_mem3DBkBmp.LoadBitmap(IDB_BITMAP_3D_FRAMES);m_mem3DBkDC.SelectObject(&m_mem3DBkBmp);m_memAnimalDC.CreateCompatibleDC(pWinDC);
41、m_memAnimalBmp.LoadBitmap(IDB_BMP_ANIMAL);m_memAnimalDC.SelectObject(&m_memAnimalBmp);m_MemDC.CreateCompatibleDC(pWinDC);m_memBitmap.CreateCompatibleBitmap(pWinDC,m_nCol*FRONTWIDTH+5,m_nRow*FRONTHEIGHT+5);m_MemDC.SelectObject(&m_memBitmap);StartNewGame();HWND hWnd = :AfxGetMainWnd()->m_hW
42、nd;:SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);return TRUE; / return TRUE unless you set the focus to a controlvoid C_LLK_Dlg:StartNewGame()for(int iNum=0;iNum<(m_nCol*m_nRow);iNum+)m_mapiNum = BLANK_STATE;srand(time(NULL);CDWordArray tmpMap;for(int i=0;i<(m_nCol*m_nRow)/4;i
43、+)for(int j=0;j<4;j+)tmpMap.Add(i);for(i=0;i<m_nRow*m_nCol;i+)int nIndex=(int(rand()*0.1+rand()*0.01+rand()%tmpMap.GetSize();m_mapi=tmpMap.GetAt(nIndex);tmpMap.RemoveAt(nIndex);Invalidate(TRUE);/void C_LLK_Dlg:GameDraw(CDC * pDC)pDC->FillSolidRect(0,0,m_nCol*FRONTWIDTH+5,m_nRow*FRONTHEIGHT+
44、5,BKCOLOR);for(int i=0;i<m_nRow;i+)for(int j=0;j<m_nCol;j+)if(m_mapi*m_nCol+j=BLANK_STATE)continue;pDC->BitBlt(j*FRONTWIDTH,i*FRONTHEIGHT,BKWIDTH,BKHEIGHT,&m_mem3DBkDC,0,BKHEIGHT,SRCCOPY);pDC->BitBlt(j*FRONTWIDTH,i*FRONTHEIGHT,FRONTWIDTH-2,FRONTHEIGHT-12,&m_memAnimalDC,FRONTWIDTH
45、-2,m_mapi*m_nCol+j*(FRONTHEIGHT-12),SRCAND);pDC->BitBlt(j*FRONTWIDTH,i*FRONTHEIGHT,FRONTWIDTH-2,FRONTHEIGHT-12,&m_memAnimalDC,0,m_mapi*m_nCol+j*(FRONTHEIGHT-12),SRCPAINT);/ The system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR C_LLK_Dlg:OnQue
46、ryDragIcon()return (HCURSOR) m_hIcon;/ If you add a minimize button to your dialog, you will need the code below/ to draw the icon. For MFC applications using the document/view model,/ this is automatically done for you by the framework.void C_LLK_Dlg:OnPaint() CPaintDC dc(this); / device context fo
47、r paintingGameDraw(&m_MemDC);dc.BitBlt(0,0,m_nCol*FRONTWIDTH,m_nCol*FRONTHEIGHT,&m_MemDC,0,0,SRCCOPY);/void C_LLK_Dlg:OnLButtonDown(UINT nFlags, CPoint point) int x=point.x/FRONTWIDTH+(point.x%FRONTWIDTH?1:0)-1;int y=point.y/FRONTHEIGHT+(point.y%FRONTHEIGHT?1:0)-1;if(x<m_nCol&&y<m_nRow&&m_mapy*m_nCol+x!= BLANK_STATE)if(m_nX1=BLANK_STATE)m_nX1=x;m_nY1=y;CDC *p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新疆维吾尔自治区普通高考适应性检测分学科第二次模拟检测语文试题【含答案详解】
- 2026年剧本杀运营公司企业发展战略规划管理制度
- (一模)扬州市2026届高三模拟调研测试政治试卷(含答案解析)
- 北京市昌平区2025-2026学年高一上学期期末语文试卷(含答案)
- 2025 小学五年级道德与法治法律知识生活化应用课件
- 2026年及未来5年中国海岸带修复行业市场深度研究及发展趋势预测报告
- 企业服务类采购制度
- 机器人关节伺服驱动技术
- 两票三制奖罚制度
- 中国司法大数据研究院2026年招聘备考题库及1套参考答案详解
- 国家职业技术技能标准 4-10-01-02 育婴员 人社厅发201947号
- BCG-并购后整合培训材料-201410
- 招标代理机构入围 投标方案(技术方案)
- 运输车队年终总结报告
- 房屋损坏纠纷鉴定报告
- 精益生产方式-LEAN-PRODUCTION
- 颈动脉外膜剥脱术
- 养老设施建筑设计规范
- Starter-软件简易使用手册
- RFJ01-2008 人民防空工程防护设备选用图集
- GB/T 27818-2011化学品皮肤吸收体外试验方法
评论
0/150
提交评论