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

正文內(nèi)容

人工智能實(shí)驗(yàn)報(bào)告(編輯修改稿)

2024-08-30 08:40 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 目標(biāo)狀態(tài),用于評(píng)價(jià)h的值 string grid。//用字符串保存當(dāng)前棋盤狀態(tài) int x, y。//空格所在位置 int moves。//到此狀態(tài)的移動(dòng)次數(shù) int value。//價(jià)值 State *pPrevious。//前一個(gè)狀態(tài) State(string amp。grid, State *pPrevious = NULL)。 int getReversedCount()。//獲取逆序數(shù) void evaluate()。//評(píng)價(jià)函數(shù) bool check(Move move)。//檢查是否可以移動(dòng) State takeMove(Move move)。//實(shí)施移動(dòng),生成子狀態(tài) //重載==運(yùn)算符,判斷兩個(gè)狀態(tài)是否相等 inline bool operator == (State amp。state) { return grid == 。 }}。//九宮重排問題class NineGrid{private: vectorState* openList, closeList。 State startState, endState。 clock_t startTime。 bool pareReversed()。//比較逆序數(shù)奇偶性是否相同 bool takeMove(State *nowState, Move move)。//進(jìn)行一次決策 State* findInList(vectorState* amp。listToCheck, State amp。State)。//檢查某狀態(tài)節(jié)點(diǎn)是否在列表中 void print(State *endState)。//打印結(jié)果 //用于排序 static bool greater_than(const State *state1, const State *state2)。public: static void ShowInfo()。//顯示信息 NineGrid(string amp。start, string amp。dest)。 bool solve()。//求解問題}。include include iostreaminclude stackinclude algorithmusing namespace std。State* State::pEndState = NULL。/*=======================Methods for class State=======================*///構(gòu)造函數(shù)State::State(string amp。grid, State *pPrevious){ thisgrid = grid。 thispPrevious = pPrevious。 if (thispPrevious) thismoves = pPreviousmoves + 1。 else thismoves = 0。 thisvalue = 0。 evaluate()。 for (int i = 0。 i 3。 ++i) { for(int j = 0。 j 3。 ++j) { if (AT(grid, i, j) == SPACE) { x = i。 y = j。 return。 } } }}bool State::check(Move move){ switch (move) { case UP: if (x 1 0) return false。 break。 case DOWN: if (x + 1 = 3) return false。 break。 case LEFT: if (y 1 0) return false。 break。 case RIGHT: if (y + 1 = 3) return false。 break。 } return true。}State State::takeMove(Move move){ int destX, destY。 switch (move) { case UP: destX = x 1。 destY = y。 break。 case DOWN: destX = x + 1。 destY = y。 break。 case LEFT: destX = x。 destY = y 1。 break。 case RIGHT: destX = x。 destY = y + 1。 break。 } string tGrid = grid。 char t = AT(tGrid, destX, destY)。 AT(tGrid, destX, destY) = AT(tGrid, x, y)。 AT(tGrid, x, y) = t。 return State(tGrid, this)。}void State::evaluate(){ if (!pEndState) return。 int g = moves, h = 0。 for (int i = 0。 i 3。 ++i) { for (int j = 0。 j 3。 ++j) { //if (AT(grid, i, j) != AT(pEndStategrid, i, j)) // ++h。 if(AT(grid, i, j) == SPACE) continue。 for (int ii = 0。 ii 3。 ++ii) { for (int jj = 0。 jj 3。 ++jj) { if (AT(grid, i, j) == AT(pEndStategrid, ii, jj)) { h += abs(i ii) + abs(j jj)。 } } } } } thisvalue = g + h。}//求該狀態(tài)的逆序數(shù)//逆序數(shù)定義為://  不計(jì)空格,將棋盤按順序排列,//  對(duì)于grid[i],存在ji,使grid[j]grid[i],即為逆序。//  所有棋子的逆序總數(shù)為逆序數(shù)。int State::getReversedCount(){ int count = 0。 for (int i = 0。 i 9。 ++i) { if(grid[i] == SPACE) continue。 for (int j = 0。 j i。 ++j) { if (grid[j] == SPACE) continue。 if (grid[i] grid[j]) ++count。 } } return count。}/*=====================Methods for class NineGrid=====================*///顯示信息void NineGrid::ShowInfo(){ cout************************************************endl。 cout 九宮重排問題求解 endl。 cout by 1040501211 陳嘉生 endl。 cout************************************************endl。}//構(gòu)造函數(shù)NineGrid::NineGrid(string amp。start, string amp。dest) : startState(start), endState(dest){ State::pEndState = amp。endState。 ()。}//當(dāng)初始狀態(tài)和目標(biāo)狀態(tài)的逆序數(shù)的奇偶性相同時(shí),
點(diǎn)擊復(fù)制文檔內(nèi)容
化學(xué)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1