int main(int argc, char** argv) { //Init block glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(width, height); glutInitWindowPosition(WIN_POS_X, WIN_POS_Y); glutInit(&argc, argv); //Read the object r.read("objects/f16.obj"); r.normalize(); r.center(); path = readMoves("paths/spiral.path", 0.01, false); moveObj(); //Position the object for the initial showing //Create an appropriately named window window = glutCreateWindow(r.getName().c_str()); //Set up the handlers glutReshapeFunc(reshapeHandler); glutDisplayFunc(displayHandler); glutKeyboardFunc(keypressHandler); glutMainLoop(); return 0; }
bool CsaReader::read(std::istream& is, Record& record, RecordInfo* info/* = nullptr*/) { Board board; // 局面の読み込み if (!readBoard(is, board, info)) { return false; } record.init(board); // 指し手の読み込み if (!readMoves(is, record)) { return false; } return true; }
int sampleMethod() { int val,i,j,k; int * retVal; setPropertyFileName(".\\stackgameclient.properties"); printf("Waiting for handshake ... ...\n"); retVal = handShake(); printf("The response is: %d %d %d\n",retVal[0],retVal[1],retVal[2]); if (retVal[1] == RED_COINS) { Op = 4; Iam = 3; } else { Iam = 4; Op = 3; } if(retVal[2] == PLAY_SECOND) { printf("I am playing Second\n"); play =2; retVal = readMoves(); printf("The response is: %d %d %d %d %d %d\n",retVal[0],retVal[1],retVal[2],retVal[3],retVal[4],retVal[5]); retVal[1]-=1; retVal[2]-=1; retVal[4]-=1; retVal[5]-=1; update_board(retVal,1); for(i=0;i<8;i++) for(j=0;j<8;j++) for(k=0;k<5;k++) board[i][j][k] = t_board[i][j][k]; for(i=0;i<8;i++) for(j=0;j<8;j++) top[i][j] = t_top[i][j]; res = t_res; cap = t_cap; opp_res = t_opp_res; opp_cap = t_opp_cap; } else { play=1; printf("I am playing First\n"); } while(1) { val = intelligence(); for(i=0;i<8;i++) for(j=0;j<8;j++) for(k=0;k<5;k++) t_board[i][j][k] = board[i][j][k]; for(i=0;i<8;i++) for(j=0;j<8;j++) t_top[i][j] = top[i][j]; t_res = res; t_cap = cap; t_opp_res = opp_res; t_opp_cap = opp_cap; update_board(all_moves[val],0); for(i=0;i<8;i++) for(j=0;j<8;j++) for(k=0;k<5;k++) board[i][j][k] = t_board[i][j][k]; for(i=0;i<8;i++) for(j=0;j<8;j++) top[i][j] = t_top[i][j]; res = t_res; cap = t_cap; opp_res = t_opp_res; opp_cap = t_opp_cap; writeMoves(all_moves[val][0],all_moves[val][1]+1,all_moves[val][2]+1,all_moves[val][3],all_moves[val][4]+1,all_moves[val][5]+1); printf("Waiting for response ... ...\n"); retVal = readMoves(); printf("The response is: %d %d %d %d %d %d\n",retVal[0],retVal[1],retVal[2],retVal[3],retVal[4],retVal[5]); retVal[1]-=1; retVal[2]-=1; retVal[4]-=1; retVal[5]-=1; for(i=0;i<8;i++) for(j=0;j<8;j++) for(k=0;k<5;k++) t_board[i][j][k] = board[i][j][k]; for(i=0;i<8;i++) for(j=0;j<8;j++) t_top[i][j] = top[i][j]; t_res = res; t_cap = cap; t_opp_res = opp_res; t_opp_cap = opp_cap; update_board(retVal,1); for(i=0;i<8;i++) for(j=0;j<8;j++) for(k=0;k<5;k++) board[i][j][k] = t_board[i][j][k]; for(i=0;i<8;i++) for(j=0;j<8;j++) top[i][j] = t_top[i][j]; res = t_res; cap = t_cap; opp_res = t_opp_res; opp_cap = t_opp_cap; if(retVal[0] !=0 && retVal[0] != 1) { if(retVal[0] == GAME_ENDED) { break; } else if(retVal[0] == GAME_RESET) { break; } else if(retVal[0] == INVALID_MOVE) { break; } } } }