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

正文內(nèi)容

基于c的五子棋游戲的設計與實現(xiàn)(編輯修改稿)

2025-07-16 12:32 本頁面
 

【文章內(nèi)容簡介】 if ( 0)//棧非空 { tempStackElement = (StackElement)()。 [ 1] = (result)(0 totalresult)。 [ 1] = bestStepNumber。 //在棋盤上退一棋 points[[ 1].X, [ 1].Y] = 2。 (tempStackElement)。 } } } } for (i = 0。 i 。 i++) if (totalresult == [i] amp。amp。 bestStepNumber == [i]) break。 bestPoint = [i]。 return true。10) 尋找最佳的五個點,并形成棧元素——FindBestFivePointsAndFormAStackElement函數(shù)主要是找最佳點,并形成棧元素。如果找到,返回true;否則。返回false。要找 最佳點,就是找權值最大的點。首先,計算出棋盤上每一個點的權值,并找出最大的一 個。代碼如下: int[,] qpPower = new int[15, 15]。 bool blnHaveFound。 int x, y, i, max。 = 0。 for (x = 0。 x 15。 x++) for (y = 0。 y 15。 y++) qpPower[x, y] = GetqpPower(qzcolor, x, y)。 for (i = 0。 i 5。 i++) {//求第i個最佳點 max = 0。 for (x = 0。 x 15。 x++) for (y = 0。 y 15。 y++) if (max qpPower[x, y]) max = qpPower[x, y]。 for (x = 0。 x 15。 x++) { blnHaveFound = false。 for (y = 0。 y 15。 y++) if (max == qpPower[x, y]) { [i] = new Point(x, y)。 ++。 qpPower[x, y] = 1。 blnHaveFound = true。 break。 } if (blnHaveFound) break。 } } if ( == 0) return false。 else { = qzcolor。 = 0。 return true。 }11) 求權值——GetqpPower定義八個方向:左,右,上,下,左上,右下,左下,右上。代碼如下: left = new Point((0, x 4), y)。 right = new Point((14, x + 4), y)。 top = new Point(x, (0, y 4))。 down = new Point(x, (14, y + 4))。 temp = (x , y )。 leftTop = new Point(x temp, y temp)。 temp = (x , y)。 leftDown = new Point(x temp, y + temp)。 temp = ( x, y )。 rightTop = new Point(x + temp, y temp)。 temp = ( x, y)。 rightDown = new Point(x + temp, y + temp)。如果顏色是黑色,處理黑棋連子情況:如果這個點沒有下棋子,則在此置為1,表示這點下的是黑棋。然后看這個點各個方向黑棋子的數(shù)目是多少,并看是否是活棋,再作出處理。最后,將此點處置為2。表示這點沒有下棋子。處理白棋連子情況:在此點處置為0,表示這點下的是白棋。然后看這個點各個方向白棋子的數(shù)目是多少,并在此放一白棋破壞黑棋,再做出相應的處理。如果各個方向上出現(xiàn)3個的活棋。就將tempActive3自加1。最后,將此點處置為2。表示這點沒有下棋子。設置權值:形成黑棋五個的權值設為150000;形成白棋五個的權值設為140000;形成黑活棋個數(shù)為4或形成兩條以上黑棋個數(shù)為4的權值設為130000;形成一條黑棋個數(shù)為4并且一條為黑活棋個數(shù)為3的權值為120000;形成一條黑棋個數(shù)為4或一條以上黑棋個數(shù)為3的權值110000;形成白活棋個數(shù)為4或形成兩條以上白棋個數(shù)為4的權值設為100000;形成一條黑棋個數(shù)為4并且一條為黑活棋個數(shù)為3的權值為120000;形成一條白棋個數(shù)為4并且一條為白活棋個數(shù)為3的權值為90000;兩條以上白活棋個數(shù)為3的權值為80000;形成一條白棋個數(shù)為4或一條以上白棋個數(shù)為3的權值為70000;同樣,如果顏色為白色,做法和以上的差不多。代碼如下:if (qzcolor == 1) { if (points[x, y] != 2) return 2。 else { /// ///處理黑棋連子情況 /// points[x, y] = 1。 //左右方向 connectCount = ConnectqpCount(1, left, right)。 [connectCount]++。 if (ActiveConnectqp(1, connectCount, left, right)) { [connectCount]。 [connectCount]++。 } //上下方向 connectCount = ConnectqpCount(1, top, down)。 [connectCount]++。 if (ActiveConnectqp(1, connectCount, top, down)) { [connectCount]。 [connectCount]++。 } //左上_右下方向 connectCount = ConnectqpCount(1, leftTop, rightDown)。 [connectCount]++。 if (ActiveConnectqp(1, connectCount, leftTop, rightDown)) { [connectCount]。 [connectCount]++。 } //左下_右上方向 connectCount = ConnectqpCount(1, leftDown, rightTop)。 [connectCount]++。 if (ActiveConnectqp(1, connectCount, leftDown, rightTop)) { [connectCount]。 [connectCount]++。 } points[x, y] = 2。 /// ///處理白棋連子情況 /// points[x, y] = 0。 //左右方向 connectCount = ConnectqpCount(0, left, right)。 [connectCount]++。 if (BreakActiveConnectqp(0, connectCount, x, y, left, right)) { [connectCount]。 [connectCount]++。 } //上下方向 connectCount = ConnectqpCount(0, top, down)。 [connectCount]++。 if (BreakActiveConnectqp(0, connectCount, x, y, top, down)) {
點擊復制文檔內(nèi)容
研究報告相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1