void GameSpecificMenu (){ char c; BOOLEAN cont = TRUE; while(cont) { printf("\n\nCurrent %dx%d board: \n", width, length); PrintPosition(gInitialPosition, "Gamesman", 0); printf("\tGame Options:\n\n" "\tc)\t(C)hange the board size (nxn), currently: %dx%d\n" //"\ti)\tSet the (I)nitial position\n" "\tr)\t(R)eset to default settings\n" "\tb)\t(B)ack to the main menu\n" "\nSelect an option: ", width, length); c = GetMyChar(); switch(c) { case 'c': case 'C': ChangeBoardSize(); break; case 'i': case 'I': GetInitialPosition(); break; case 'r': case 'R': Reset(); SetupGame(); break; case 'b': case 'B': cont = FALSE; break; default: printf("Invalid option!\n"); } } //InitializeHelpStrings(); }
void CPlayerCharacter::PrintInfo() { printf_s("============================================\n"); printf_s("============================================\n"); printf_s("[alias : %s ] \n",m_info.name.c_str()); printf_s("[HP : %d ] \n", m_info.hp); printf_s("[level : %d ] \n", m_info.level); printf_s("[exp : %d / %d ] \n", m_info.current_exp, m_info.total_exp); PrintPosition(); printf_s("============================================\n"); printf_s("============================================\n"); }
void GameSpecificMenu() { do { printf("\n\t----- Game-specific options for %s -----\n\n", kGameName); printf("\tCurrent Initial Position:\n"); PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn); printf("\tI)\tChoose the (I)nitial position\n"); printf("\tT)\t(T)rapping opponent toggle from %s to %s\n", gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)", !gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)"); printf("\tD)\tChange the number of (D)ragons (Currently %d)\n", gNumDragons); printf("\n\n\tb)\t(B)ack = Return to previous activity.\n"); printf("\n\nSelect an option: "); switch(GetMyChar()) { case 'Q': case 'q': ExitStageRight(); case 'H': case 'h': HelpMenus(); break; case 'I': case 'i': gInitialPosition = GetInitialPosition(); break; case 'T': case 't': gToTrapIsToWin = !gToTrapIsToWin; break; case 'D': case 'd': printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS); /*scanf("%d", &gNumDragons);*/ gNumDragons = GetMyInt(); while (gNumDragons > MAX_DRAGONS || gNumDragons < MIN_DRAGONS) { printf("Invalid entry. Please try again\n"); printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS); /*scanf("%d", &gNumDragons);*/ gNumDragons = GetMyInt(); } InitializeGame(); break; case 'b': case 'B': return; default: printf("\nSorry, I don't know that option. Try another.\n"); HitAnyKeyToContinue(); break; } } while(TRUE); }
void GameSpecificMenu() { do { printf("\n\t----- Game-specific options for %s -----\n\n", kGameName); printf("\tCurrent Initial Position:\n"); PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn); printf("\n\tI)\tChoose the (I)nitial position\n"); printf("\tC)\tCreate a (C)ustom board\n"); printf("\tD)\tUse (D)efault board\n"); printf("\n\n\tB)\t(B)ack = Return to previous activity.\n"); printf("\n\nSelect an option: "); switch(GetMyChar()) { case 'Q': case 'q': ExitStageRight(); case 'H': case 'h': HelpMenus(); break; case '1': case 'I': case 'i': gInitialPosition = GetInitialPosition(); break; case 'c': case 'C': kUseCustomBoard = TRUE; gCreateCustomBoard(); break; case 'd': case 'D': kUseCustomBoard = FALSE; break; case 'b': case 'B': return; default: printf("\nSorry, I don't know that option. Try another.\n"); HitAnyKeyToContinue(); break; } } while(TRUE); }
/* Check and print errors */ int CheckAndPrintErrors(VyParseTree* tree){ int treeType = tree->type; int error = 0; if(treeType == TREE_LIST){ /* Check each element recursively */ int i; for(i = 0; i < ListTreeSize(tree); i++){ VyParseTree* next = GetListData(tree,i); /* Check the sub nodes for errors */ int listError = CheckAndPrintErrors(next); if(listError) error = 1; } } /* Check each piece of the ref */ else if(treeType == TREE_REF){ int objError = CheckAndPrintErrors(GetObj(tree)); int refError = CheckAndPrintErrors(GetRef(tree)); if(objError || refError) error = 1; } /* If it is an error, print the error */ else if(treeType == TREE_ERROR){ printf("\n\n"); printf("------- Parsing Error -------\n"); printf("Position: "); PrintPosition(tree->pos); printf("\n"); printf(tree->data->error.message); printf("\n-----------------------------"); error = 1; } return error; }
void PrintSingleOpenData(POSITION p) { OPEN_POS_DATA dat=GetOpenData(p); if(GetDrawValue(dat)==undecided) return; PrintPosition(p, "", 0); printf("Level number: %d\n",GetLevelNumber(dat)); printf("OpenPosition value: "); switch(GetDrawValue(dat)) { case win: printf("win"); break; case lose: printf("lose"); break; case tie: printf("tie"); break; } printf("\nCorruption level: %d\n",GetCorruptionLevel(dat)); printf("Fremoteness: %d\n",GetFremoteness(dat)); printf("Fringe?: %s\n",GetFringe(dat) ? "yes" : "no"); }
void ChangeBoardSize (){ int newWidth, newLength; while (TRUE) { printf("\n\nCurrent board of size %dx%d:\n\n", width, length); PrintPosition(gInitialPosition, "Gamesman", 0); printf("\n\nEnter the new width (%d - %d): ", WIDTH_MIN, WIDTH_MAX); newWidth = GetMyChar()-48; if(newWidth > WIDTH_MAX || newWidth < WIDTH_MIN) { printf("\nInvalid width!\n"); continue; } printf("\n\nEnter the new length (%d - %d): ", LENGTH_MIN, LENGTH_MAX); newLength = GetMyChar()-48; if(newLength > LENGTH_MAX || newLength < LENGTH_MIN) { printf("\nInvalid length!\n"); continue; } width = newWidth; length = newLength; boardsize = width*length; SetupGame(); break; } }
void ConfigDisp( void ) { a_window *wnd, *scan; char buff[20]; char buff2[20]; a_window *head, *next; int h; wnd_class_wv wndclass; gui_rect rect; ReqEOC(); GetCmdEntry( WndNameTab, WND_ALL, buff ); GetCmdEntry( DispOptions, CLOSE, buff2 ); Format( TxtBuff, "%s %s /%s", GetCmdName( CMD_DISPLAY ), buff, buff2 ); WndDlgTxt( TxtBuff ); if( WndHaveStatusWindow() ) { GetCmdEntry( MiscTab, MISC_STATUS, buff ); Format( TxtBuff, "%s %s", GetCmdName( CMD_DISPLAY ), buff ); WndDlgTxt( TxtBuff ); } if( WndHaveToolBar() ) { h = WndToolHeight(); GetCmdEntry( MiscTab, MISC_TOOL, buff ); GetCmdEntry( DispOptions, WndToolFixed() ? FIXED : FLOATING, buff2 ); Format( TxtBuff, "%s %s /%s %d", GetCmdName( CMD_DISPLAY ), buff, buff2, h ); WndDlgTxt( TxtBuff ); } for( wndclass = 0; wndclass < WND_NUM_CLASSES; ++wndclass ) { if( wndclass == WND_ALL ) continue; if( WndFindClass( NULL, wndclass ) != NULL ) continue; WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen ); if( rect.width == 0 ) continue; if( rect.height == 0 ) continue; PrintPosition( CLOSE, wndclass, &rect, buff, buff2 ); } head = WndNext( NULL ); if( head == NULL ) return; // traverse in reverse order so that windows get created in correct order for( wnd = head; (next = WndNext( wnd )) != NULL; wnd = next ) ; for( ;; ) { if( WndHasClass( wnd ) ) { wndclass = WndClass( wnd ); switch( wndclass ) { case WND_ALL: break; case WND_BINARY: case WND_FILE: case WND_MEMORY: WndResizeHook( wnd ); WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen ); PrintPosition( CLOSE, wndclass, &rect, buff, buff2 ); break; case WND_VARIABLE: case WND_TMPFILE: break; default: WndResizeHook( wnd ); WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen ); PrintPosition( OPEN, wndclass, &rect, buff, buff2 ); break; } } if( wnd == head ) break; for( scan = head; (next = WndNext( scan )) != wnd; scan = next ) ; wnd = scan; } }
void FileList::loadAngles() { bool val; PrintPosition(); std::cout<<"*******LOAD ANGLES"<<std::endl; int size =m_jointData.size(); std::cout<<"*******SIZE: "<<size<<std::endl; for (int i = 0;i<size; ++i) { ngl:: Vec3 _BC; //val = CheckSlope(m_jointData[i].m_worldposition ,m_jointData[i+1].m_worldposition); //if(val) _BC = m_jointData[i+1].m_worldposition - m_jointData[i].m_worldposition; // i+1.x has greater value than i.x //else // _BC = m_jointData[i+1].m_worldposition - m_jointData[i].m_worldposition; // i+1.x has greater value than i.x std::cout<<"Printing xvalue of i : "<<m_jointData[i].m_worldposition.m_x<<std::endl; if(fabs(_BC.m_x) > Epsilon) //!= 0) { m_jointData[i].m_drawAngles = atan(fabs(_BC.m_y)/fabs(_BC.m_x))*180/3.141; std::cout<<" ????Calculating Angles: "<<m_jointData[i].m_drawAngles<<std::endl; if(_BC.m_x <0 && _BC.m_y >= 0) m_jointData[i].m_drawAngles = 90 - m_jointData[i].m_drawAngles; else if(_BC.m_x < 0 && _BC.m_y < 0) m_jointData[i].m_drawAngles = m_jointData[i].m_drawAngles + 90; else if(_BC.m_x >= 0 && _BC.m_y < 0) m_jointData[i].m_drawAngles =-( m_jointData[i].m_drawAngles + 90); else// both +ve m_jointData[i].m_drawAngles = m_jointData[i].m_drawAngles - 90; //if((_BC.m_x < 0) && (_BC.m_y > 0)) // m_jointData[i].m_drawAngles = fabs(m_jointData[i].m_drawAngles); } } std::cout<<"-- * Printing in the LOAD FUNCTION * --"<<std::endl; PrintDrawAngles(); std::cout<<std::endl<<"---------------------------------------------------------------------------------------------------"<<std::endl; }