第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

作業(yè)社區(qū)

探索學(xué)習(xí)新天地,共享知識(shí)資源!

0 提交作業(yè)
0個(gè) 布置作業(yè)
0 滿分作業(yè)
得分 100
學(xué)習(xí)任務(wù)

胡漢三66 的學(xué)生作業(yè):

Judge.hpp #ifndef _JUDEG_HEAD_H #define _JUDEG_HEAD_H #include "Player.hpp" // 玩家 #include "ChessBoard.hpp" // 棋盤 class Judge{ // 判斷類 public: bool isWin(Player *player){ // 判斷 玩家 是否贏了 bool ok = false; string chessColor = player->getColor(); // 獲取 玩家 棋子顏色 ok = isHorziontalWin(chessColor); // 判斷 棋子顏色 在水平方向 是否贏了 if(ok){ return true; } ok = isVerticalWin(chessColor); // 判斷 棋子顏色 在垂直方向 是否贏了 if(ok){ return true; } ok = isUphillWin(chessColor); // 判斷 棋子顏色 在上坡方向 是否贏了 if(ok){ return true; } ok = isDownhillWin(chessColor); // 判斷 棋子顏色 在下坡方向 是否贏了 if(ok){ return true; } return ok; } bool isHorziontalWin(const string &chessColor){ // 判斷 棋子顏色 在水平方向 是否贏了 int count = 0; // 保存 連續(xù)同色棋子 數(shù) ChessBoard *chessBoard = ChessBoard::getChessBoard(); // 獲取 棋盤指針 int curLine = chessBoard->getCurrentLine(); // 獲取 棋盤 當(dāng)前 行 int curColumn = chessBoard->getCurrentColumn(); // 獲取 棋盤 當(dāng)前 列 for(int i = 0; i < 5; i++){ // 右方向 if(chessBoard->isSameColorChess(chessColor,curLine,curColumn + i)){ // 如果 棋子顏色相同, count++; // 連續(xù)同色棋子數(shù) 加1 }else{ // 如果 棋子顏色不同 break; // 跳出 該for循環(huán) } } if(count >= 5){ // 如果 連續(xù)棋子數(shù) 大于等于5 return true; // 返回 true } for(int i = 0; i < 5; i++){ // 左方向 if(chessBoard->isSameColorChess(chessColor,curLine,curColumn - i)){ count++; }else{ break; } } return count - 1 >= 5 ? true:false; // 如果同色連子數(shù)滿足5個(gè), 返回true // -1 : 多計(jì)算了一個(gè)棋子 } bool isVerticalWin(const string &chessColor){ // 判斷 棋子顏色 在垂直方向 是否贏了 int count = 0; // 保存 連續(xù)同色棋子 數(shù) ChessBoard *chessBoard = ChessBoard::getChessBoard(); // 獲取 棋盤指針 int curLine = chessBoard->getCurrentLine(); // 獲取 棋盤 當(dāng)前 行 int curColumn = chessBoard->getCurrentColumn(); // 獲取 棋盤 當(dāng)前 列 for(int i = 0; i < 5; i++){ // 向上 if(chessBoard->isSameColorChess(chessColor,curLine - i,curColumn)){ // 如果 棋子顏色相同, count++; // 連續(xù)同色棋子數(shù) 加1 }else{ // 如果 棋子顏色不同 break; // 跳出 該for循環(huán) } } if(count >= 5){ // 如果 連續(xù)棋子數(shù) 大于等于5 return true; // 返回 true } for(int i = 0; i < 5; i++){ // 向下 if(chessBoard->isSameColorChess(chessColor,curLine + i,curColumn)){ count++; }else{ break; } } return count - 1 >= 5 ? true:false; // 如果同色連子數(shù)滿足5個(gè), 返回true // -1 : 多計(jì)算了一個(gè)棋子 } bool isUphillWin(const string &chessColor){ // 判斷 棋子顏色 在上坡方向 是否贏了 int count = 0; // 保存 連續(xù)同色棋子 數(shù) ChessBoard *chessBoard = ChessBoard::getChessBoard(); // 獲取 棋盤指針 int curLine = chessBoard->getCurrentLine(); // 獲取 棋盤 當(dāng)前 行 int curColumn = chessBoard->getCurrentColumn(); // 獲取 棋盤 當(dāng)前 列 for(int i = 0; i < 5; i++){ // 右上角方向 if(chessBoard->isSameColorChess(chessColor,curLine - i,curColumn + i)){ // 如果 棋子顏色相同, count++; // 連續(xù)同色棋子數(shù) 加1 }else{ // 如果 棋子顏色不同 break; // 跳出 該for循環(huán) } } if(count >= 5){ // 如果 連續(xù)棋子數(shù) 大于等于5 return true; // 返回 true } for(int i = 0; i < 5; i++){ // 左下角方向 if(chessBoard->isSameColorChess(chessColor,curLine + i,curColumn - i)){ count++; }else{ break; } } return count - 1 >= 5 ? true:false; // 如果同色連子數(shù)滿足5個(gè), 返回true // -1 : 多計(jì)算了一個(gè)棋子 } bool isDownhillWin(const string &chessColor){ // 判斷 棋子顏色 在下坡方向 是否贏了 int count = 0; // 保存 連續(xù)同色棋子 數(shù) ChessBoard *chessBoard = ChessBoard::getChessBoard(); // 獲取 棋盤指針 int curLine = chessBoard->getCurrentLine(); // 獲取 棋盤 當(dāng)前 行 int curColumn = chessBoard->getCurrentColumn(); // 獲取 棋盤 當(dāng)前 列 for(int i = 0; i < 5; i++){ // 右下角方向 if(chessBoard->isSameColorChess(chessColor,curLine + i,curColumn + i)){ // 如果 棋子顏色相同, count++; // 連續(xù)同色棋子數(shù) 加1 }else{ // 如果 棋子顏色不同 break; // 跳出 該for循環(huán) } } if(count >= 5){ // 如果 連續(xù)棋子數(shù) 大于等于5 return true; // 返回 true } for(int i = 0; i < 5; i++){ // 左上角方向 if(chessBoard->isSameColorChess(chessColor,curLine - i,curColumn + i)){ count++; }else{ break; } } return count - 1 >= 5 ? true:false; // 如果同色連子數(shù)滿足5個(gè), 返回true // -1 : 多計(jì)算了一個(gè)棋子 } }; #endif

得分 100
學(xué)習(xí)任務(wù)

工地少年與磚('?') 的學(xué)生作業(yè):

接口 stu_seq.h #ifndef __INT_SEQ_H__ #define __INT_SEQ_H__ #include #define MAX_COUNT 3 // 實(shí)際學(xué)?的存儲(chǔ) typedef struct student { char name[20]; int id; int age; } student; typedef student datatype_t; // 存儲(chǔ)學(xué)生對(duì)象的數(shù)組結(jié)構(gòu) typedef struct seqlist_t { datatype_t *buf[MAX_COUNT]; unsigned int n; } seqlist_t; // 初始化對(duì)象 extern seqlist_t *create_empty_seqlist(); // 序列是否已滿 const bool is_full_seqlist(seqlist_t *l); // 向序列中插入數(shù)據(jù) extern void insert_data_seqlist(seqlist_t *l, datatype_t data); // 打印序列中的數(shù)據(jù) extern void printf_data_seqlist(const seqlist_t *l); #endif stu_seq.c 實(shí)現(xiàn) #include "stu_seq.h" #include #include #include seqlist_t *create_empty_seqlist() { // c語(yǔ)言中, 可以不用對(duì)void*進(jìn)行強(qiáng)轉(zhuǎn) seqlist_t *seq = malloc(sizeof(seqlist_t)); if (NULL == seq) { printf("malloc failure \n"); return seq; } memset(seq, 0, sizeof(seqlist_t)); seq->n = 0; return seq; } bool is_full_seqlist(seqlist_t *l) { if (MAX_COUNT == l->n) return true; return false; } void insert_data_seqlist(seqlist_t *l, datatype_t data) { bool res = is_full_seqlist(l); if (res) { printf("容量已滿"); return; } datatype_t *tmp = malloc(sizeof(datatype_t)); tmp->id = data.id; strcpy(tmp->name, data.name); tmp->age = data.age; // data是一個(gè)值, 不是一個(gè)指針, 所以會(huì)拷貝它的數(shù)據(jù)在我們的堆中 l->buf[l->n] = tmp; (l->n)++; } void printf_data_seqlist(const seqlist_t *l) { unsigned int i = 0; for (i = 0; i n; i++) { printf("id = %d, name = %s, age = %d \n", l->buf[i]->id, l->buf[i]->name, l->buf[i]->age); } } 入口 main.c #include "stu_seq.h" #include int main(int argc, char const *argv[]) { // 初始化列表 seqlist_t *l = create_empty_seqlist(); unsigned int c = 0; datatype_t stu; for (c = 0; c

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)