📄 nqueendlg.h
字号:
// NQueenDlg.h : header file
//
#if !defined(AFX_NQUEENDLG_H__73CC8691_39B4_462E_B6FB_1A8521DB69DF__INCLUDED_)
#define AFX_NQUEENDLG_H__73CC8691_39B4_462E_B6FB_1A8521DB69DF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CNQueenDlgAutoProxy;
/////////////////////////////////////////////////////////////////////////////
// CNQueenDlg dialog
class CNQueenDlg : public CDialog
{
DECLARE_DYNAMIC(CNQueenDlg);
friend class CNQueenDlgAutoProxy;
// Construction
public:
void WINAPI Go();
void DisableXY(int i,int j);
void OnOK();
CNQueenDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CNQueenDlg();
// Dialog Data
//{{AFX_DATA(CNQueenDlg)
enum { IDD = IDD_NQUEEN_DIALOG };
// NOTE: the ClassWizard will add data members here
CButton m_mainboard;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNQueenDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CNQueenDlgAutoProxy* m_pAutoProxy;
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CNQueenDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnCancelMode();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCaptureChanged(CWnd *pWnd);
afx_msg void OnStart();
afx_msg void OnSetsize();
afx_msg void OnEndStep();
afx_msg void OnNextStep();
afx_msg void OnClear();
afx_msg void OnExit();
afx_msg void OnAbout();
//}}AFX_MSG
private:
//递归实现皇后的放置
void WINAPI SetQueen(int j);
//检查横、竖、斜是否可以放置棋子
int CanSetQueen(int i,int j);
//启动线程
static DWORD WINAPI ThreadGo( LPVOID lpParam );
//画棋盘
void DrawGrid();
//放置棋子
void DrawChess(CPoint point);
void DrawChess(int x,int y);
//更新所有棋子
void DrawAllChess();
int cell; //每格大小
int N; //皇后数
int board; //面板大小
bool man_paint; //手动下否?
bool auto_paint; //机下?
int queen[20][20]; //存储下的棋子位置
int step; //步数
int nways; //所有解法数目
int a[20]; //暂存每列中棋子的位置
bool canceling; //结束演示标志
bool next_step; //下一步标志
CFont m_font;
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NQUEENDLG_H__73CC8691_39B4_462E_B6FB_1A8521DB69DF__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -