void displayCall(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); drawBoard(11); int x, y; char owner; while(true){ cout<<"Enter (row) [space] (column)"<<endl; cout<<"Ex: 1 11 or 11 5"<<endl; cin>>x>>y; if(x>0 && x<=11 && y>0 && y<=11 && hexBoard.getVector()[x-1][y-1].owner == '-'){ owner = 'R'; break; } } x--; y--; //used for translating input of 1-11 to data of 0-10 hexBoard.placePiece(x, y, owner); posNode temp = posNode(x,y,owner); board.push_back(temp); for(auto element: board) colorHex(element.coordX, element.coordY, element.owner); drawBoard(11); drawRects(); glutSwapBuffers(); char winner = ' '; determineWinner(connectivityMatrix, hexBoard, boardWidth, winner, false); if(winner == 'R') exit(0); }
static void idle(){ drawRects(); drawBoard(11); glutSwapBuffers(); hexBoard.fillAIRemaining(); posNode move = moveAI(connectivityMatrix, hexBoard); cout<<move.coordX<<", "<<move.coordY<<" " <<move.owner<<endl; hexBoard.placePiece(move.coordX, move.coordY, move.owner); board.push_back(move); char winner = ' '; determineWinner(connectivityMatrix, hexBoard, boardWidth, winner, false); if(winner == 'B') exit(0); for(auto element: board) colorHex(element.coordX, element.coordY, element.owner); drawBoard(11); drawRects(); glutSwapBuffers(); glutPostRedisplay(); }