freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于mfc的對戰(zhàn)象棋設(shè)計與實現(xiàn)畢業(yè)論文(編輯修改稿)

2025-07-16 18:42 本頁面
 

【文章內(nèi)容簡介】 型 int OldX。 //記錄前一個棋子的橫坐標(biāo) int OldY。 //記錄前一個棋子的縱坐標(biāo) ///用于右鍵功能 int Rchoosed。 //記錄當(dāng)前一個棋子是第幾個棋子 int ROldX。 //記錄前一個棋子的橫坐標(biāo) int ROldY。 //記錄前一個棋子的縱坐標(biāo) //變量定義 HBITMAP ChessList[17]。 //位圖數(shù)組 CString m_strPiece。//棋子根目錄 CString m_strBoard。//棋盤根目錄 int m_nBoardIndex,m_nPieceIndex。 //背景設(shè)置選擇 //定義畫圖用CDC CDC Background。//背景句柄 CDC ChessAll。 //最終刷新句柄 CDC Buffer。//緩沖句柄 用于雙緩沖 CListBox m_listbox。 //用于記錄每步棋子走棋的信息和聊天信息 CButton m_ok。 //開始按鈕 CButton m_goback。 //悔棋按鈕 CButton m_huanyuan。 //還原按鈕 CButton m_renshu。 //認(rèn)輸按鈕 CButton m_send。//聊天發(fā)送按鈕 CEdit m_edit。//用于聊天的edit int down_move。//用于鼠標(biāo)按下時的控制 int move_up。 //用于鼠標(biāo)彈上時的控制 int goback_huanyuan。 //用于只有在有悔棋額情況下才能還原的控制// Operationspublic: void OnOk()。//開始 void OnGoBack()。//悔棋 void OnHuanYuan()。//還原 void OnRenShu()。//認(rèn)輸 void OnSend()。//發(fā)送聊天信息 //函數(shù)定義 void InitData()。 //初始化 void NewGame()。 //新游戲 void TextOutTop()。//提示現(xiàn)在出牌 void PrintAll()。 //把界面存儲于buffer中 void PrintAllMsg()。 //用于網(wǎng)絡(luò)刷新和整體刷新 void PrintAllDMsg()。//用于網(wǎng)絡(luò)動棋子的時候整體刷新 HBITMAP LoadFileBmp(CString filePath)。 //載入位圖 void SetBoardandPiece(CString strBoard,CString strPiece)。//給棋盤棋子賦值// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CChess_mView) public: virtual void OnDraw(CDC* pDC)。 // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCTamp。 cs)。 protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo)。 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)。 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)。 //}}AFX_VIRTUAL// Implementationpublic: virtual ~CChess_mView()。ifdef _DEBUG virtual void AssertValid() const。 virtual void Dump(CDumpContextamp。 dc) const。endifprotected: //{{AFX_MSG(CChess_mView) …………….(省略) //}}AFX_MSG DECLARE_MESSAGE_MAP()}。 棋子走法棋子走棋規(guī)則在“ 象棋棋子”已有介紹,這里不再累述。這里主要介紹各個棋子的程序具體實現(xiàn)。具體見CanGoTo(int Old_Point_x,int Old_Point_y,int Now_Point_x,int Now_Point_y,int chesstype)和ShuaiCanGoTo(int Old_Point_x,int Old_Point_y,int Now_Point_x,int Now_Point_y,int chesstype)函數(shù)。首先,不管是什么棋子,都不能吃自己一方的棋子。if (map[Old_Point_x][Old_Point_y]/7==map[Now_Point_x][Now_Point_y]/7) return false。 車車只要中間沒有棋子阻礙,可以到達(dá)它橫豎線所在的任何地方。所以只需判斷始末位置為端點的線段上的棋子個數(shù),即判斷map[][]不為空的個數(shù)。若只有一個,則表示目標(biāo)位置沒有棋子,可以直達(dá)。若有兩個,且目標(biāo)位置不為空,則表示吃子,可達(dá)。//車 if (9==chesstype||2==chesstype) { //同一行 if (Old_Point_y==Now_Point_y) { int maxcol=(Old_Point_xNow_Point_x)?Old_Point_x:Now_Point_x。 int mincol=(Old_Point_xNow_Point_x)?Now_Point_x:Old_Point_x。 int n=0。 //判斷移動前后位置之間有無其他子 for (int i=mincol。i=maxcol。i++) { if(14!=map[i][Old_Point_y]) n++。 } if(1==n) return true。 else if((2==n)amp。amp。(14!=map[Now_Point_x][Old_Point_y])) return true。 else return false。 } //同一列 else if (Old_Point_x==Now_Point_x) { int maxrow=(Old_Point_yNow_Point_y)?Old_Point_y:Now_Point_y。 int minrow=(Old_Point_yNow_Point_y)?Now_Point_y:Old_Point_y。 int n=0。 for(int i=minrow。i=maxrow。i++) { if(14!=map[Old_Point_x][i]) n++。 } if(1==n) return true。 else if((2==n)amp。amp。(14!=map[Now_Point_x][Now_Point_y])) return true。 else return false。 } } 馬馬走日,所以要判斷始末位置的X和Y的差值的乘積是不是2或者2。若是,則判斷有沒有蹩馬腿,即同側(cè)的第一個位置map[][]必須為空。 //馬if (3==chesstype||10==chesstype) { int row=Now_Point_xOld_Point_x。 int col=Now_Point_yOld_Point_y。 //日字的范圍 if((2!=row*col)amp。amp。(2!=row*col)) return false。 //是否有同側(cè)的子堵塞 if (2==row) { if (14==map[Old_Point_x1][Old_Point_y]) return true。 else return false。 } else if (2==row) { if(14==map[Old_Point_x+1][Old_Point_y]) return true。 else return false。 } else if (2==col) { if(14==map[Old_Point_x][Old_Point_y1]) return true。 else return false。 } else if (2==col) { if(14==map[Old_Point_x][Old_Point_y+1]) return true。 else return false。 } else return false。 } 相(象)相和象活動范圍不同,所以要分開判斷。但相(象)的走法判斷和馬類似,都是先判斷差值,來確定田字范圍,再判斷有沒有塞象眼,即田字中間有沒有棋子。//黑象 if (11==chesstype) { if((Now_Point_y=0)amp。amp。(Now_Point_y=4)) { int row=Now_Point_xOld_Point_x。 int col=Now_Point_yOld_Point_y。 //田字范圍 if ((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x1][Old_Point_y1])) { return true。 } else if (2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x1][Old_Point_y+1])) { return true。 } elseif((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x+1][Old_Point_y1])) { return true。 } else if ((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x+1][Old_Point_y+1])) { return true。 } else return false。 } else return false。 } //紅象 else if(4==chesstype) { if ((Now_Point_y=5)amp。amp。(Now_Point_y=9)) { int row=Now_Point_xOld_Point_x。 int col=Now_Point_yOld_Point_y。 //田字范圍 if ((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x1][Old_Point_y1])) { return true。 } else if ((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x1][Old_Point_y+1])) { return true。 } else if((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x+1][Old_Point_y1])) { return true。 } else if((2==row)amp。amp。(2==col)amp。amp。(14==map[Old_Point_x+1][Old_Point_y+1])) { return true。 } else return false。 } } 仕(士)仕(士)只能在各自九宮內(nèi)走動,所以紅黑士要分開判斷范圍,然后在判斷棋子是否斜走,而不是直走,即始末位置的X,Y的差值絕對值要都是1。//黑士 if (chesstype==12) { if ((Now_Point_x=3)amp。amp。(Now_Point_x=5)amp。amp。(Now_Point_y=0)amp。amp。(Now_Point_y=2)) { int row=abs(Now_Point_yOld_Point_y)。 int col=abs(Now_Point_xOld_Point_x)。 if ((0==rowcol)amp。amp。(row==1)) { return true。 } else return false。 } else return false。 } //紅士 else if(chesstype=
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1