int main (int argc, char * argv[]) { int disciplines[19] = {STUDENT_BQN, STUDENT_MMONEY, STUDENT_MJ, \ STUDENT_MMONEY, STUDENT_MJ, STUDENT_BPS, STUDENT_MTV, \ STUDENT_MTV, STUDENT_BPS,STUDENT_MTV, STUDENT_BQN, \ STUDENT_MJ, STUDENT_BQN, STUDENT_THD, STUDENT_MJ, \ STUDENT_MMONEY, STUDENT_MTV, STUDENT_BQN, STUDENT_BPS}; int dice[19] = {9,10,8,12,6,5,3,11,3,11,4,6,4,7,9,2,8,10,5}; Game g = newGame (disciplines, dice); action a; // int score = 0; //This stores the KPI points of current player int curPlayer = NO_ONE; int curTurn = 0; int playerKPI = 0; int numStudents[MAX_STU_TYPES]; int legal = 0; int diceScore = 0; int spinoffDice = 0; //int discipline = 0; int counter = 0; char *degrees[] = \ {"THDs", "BPSs", "BQNs", "MJs", "MTVs", "MMONEYs"}; printf ("New game created, variables are initialized.\n"); printf ("Let the game begin!\n\n"); while (playerKPI < MAX_KPIPTS) { //To simulate an actual real life dice, we throw two dice diceScore = rollDice(); throwDice (g, diceScore); curTurn = getTurnNumber (g); curPlayer = getWhoseTurn (g); printf ("Turn number: %d\n", curTurn); printf ("Player %d's turn. Rolling dice.\n", curPlayer); printf ("The two dice rolled a %d! \n", diceScore); printf ("You currently have: \n"); counter = 0; while (counter < MAX_STU_TYPES) { numStudents[counter] = getStudents (g, curPlayer, counter); printf (" %d: %s\n", numStudents[counter],\ degrees[counter]); counter ++; } actionOptions (); a = actionPrompt (g); legal = isLegalAction (g, a); while (a.actionCode != PASS) { while (legal == FALSE) { printf ("The chosen action is illegal, try again.\n"); actionPrompt (g); legal = isLegalAction (g, a); } if (a.actionCode == START_SPINOFF) { //Ensures dice returns 1, 2 or 3. spinoffDice = (rand()%3 + 1); if (spinoffDice == 1) { a.actionCode = OBTAIN_IP_PATENT; } else { a.actionCode = OBTAIN_PUBLICATION; } } makeAction (g, a); printf("Action made!"); printf ("Your current stats:\n"); printf (" ARC Grants: %d\n", getARCs (g, curPlayer)); printf (" No of Campuses: %d\n", getCampuses (g, curPlayer)); printf (" No of G08s: %d\n", getGO8s (g, curPlayer)); printf (" No of Pubs: %d\n", getPublications (g, curPlayer)); printf (" No of IP Patents: %d\n", getIPs (g, curPlayer)); playerKPI = getKPIpoints (g, curPlayer); printf ("Player %d KPI Score: %d\n\n", curPlayer, playerKPI); } printf ("Next player's turn.\n\n"); } printf ("Congratulations, player %d won.\n", curPlayer); printf ("Game completed. Disposing game.\n"); disposeGame (g); return EXIT_SUCCESS; }
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindowEx( parent, flags ) { QCoreApplication::setOrganizationName( "Horns and Hooves" ); QCoreApplication::setOrganizationDomain( "hornsnhooves.com" ); QCoreApplication::setApplicationName( "composer" ); ui.setupUi(this); ui.actionSaveProject->setEnabled(false); connect( ui.actionSaveProject, SIGNAL( triggered() ), this, SLOT( actionProjectSave() ) ); connect( ui.actionSaveProjectAs, SIGNAL( triggered() ), this, SLOT( actionProjectSaveAs() ) ); connect( ui.actionOpenProject, SIGNAL( triggered() ), this, SLOT( actionProjectOpen() ) ); connect( ui.actionNewProject, SIGNAL( triggered() ), this, SLOT( actionProjectNew() ) ); connect( ui.actionRemoveRulers, SIGNAL( triggered() ), this, SLOT( actionRemoveRulers() ) ); undoStack = new QUndoStack(this); createUndoView(); undoAction = undoStack->createUndoAction(this, tr("&Undo")); undoAction->setShortcuts(QKeySequence::Undo); redoAction = undoStack->createRedoAction(this, tr("&Redo")); redoAction->setShortcuts(QKeySequence::Redo); uiSetupUndoRedoAction(); createAboutDialog(); spriteModel = new SpriteModel( &project, this ); createSpriteView(spriteModel); animationModel = new AnimationModel( &project, spriteView, this ); createAnimationView(animationModel); compositionModel = new CompositionModel( &project, spriteView, animationView, this ); createCompositionView(compositionModel); commandEnvFabric = new CommandEnvFabric(&project, spriteView, animationView, compositionView); createScene(); optionsDialog = new OptionsDialog( this ); connect( ui.actionOptions, SIGNAL( triggered() ), this, SLOT( actionOptions() ) ); spriteMoveDialog = new SpriteMoveDialog( this ); connect( spriteMoveDialog, SIGNAL( accepted() ), this, SLOT( moveSpriteDialogAccepted() ) ); createRecentActions(); readRecentFileList(); loadSettings(); graphicsScene->triggerStickToBorder( ui.actionSnapToBorder->isChecked() ); graphicsScene->triggerStickToPictures( ui.actionSnapToPictures->isChecked() ); graphicsScene->triggerStickToGuides( ui.actionSnapToGuides->isChecked() ); connect( ui.actionSnapToBorder, SIGNAL( triggered( bool ) ), graphicsScene, SLOT( triggerStickToBorder( bool ) ) ); connect( ui.actionSnapToPictures, SIGNAL( triggered( bool ) ), graphicsScene, SLOT( triggerStickToPictures( bool ) ) ); connect( ui.actionSnapToGuides, SIGNAL( triggered( bool ) ), graphicsScene, SLOT( triggerStickToGuides( bool ) ) ); QComboBox* comboBoxZoom = new QComboBox; ui.mainToolBar->addSeparator(); ui.mainToolBar->addWidget( new QLabel( " " ) ); ui.mainToolBar->addWidget( comboBoxZoom ); ui.mainToolBar->addWidget( new QLabel( " " ) ); graphicsView->setComboBoxZoom( comboBoxZoom ); connect( &project, SIGNAL( compositionModelReset() ), compositionModel, SLOT( resetModel() ) ); connect( &project, SIGNAL( sceneModelReset() ), graphicsScene, SLOT( resetModel() ) ); connect( &project, SIGNAL( animBeginRemoveRows( int, int ) ), animationModel, SLOT( animBeginRemoveRows( int, int ) ) ); connect( &project, SIGNAL( animEndRemoveRows() ), animationModel, SLOT( animEndRemoveRows() ) ); connect( &project, SIGNAL( animBeginInsertRows( int, int ) ), animationModel, SLOT( animBeginInsertRows( int, int ) ) ); connect( &project, SIGNAL( animEndInsertRows() ), animationModel, SLOT( animEndInsertRows() ) ); connect( &project, SIGNAL( compositionBeginRemoveRows( int, int ) ), compositionModel, SLOT( compositionBeginRemoveRows( int, int ) ) ); connect( &project, SIGNAL( compositionEndRemoveRows() ), compositionModel, SLOT( compositionEndRemoveRows() ) ); connect( &project, SIGNAL( compositionBeginInsertRows( int, int ) ), compositionModel, SLOT( compositionBeginInsertRows( int, int ) ) ); connect( &project, SIGNAL( compositionEndInsertRows() ), compositionModel, SLOT( compositionEndInsertRows() ) ); connect( &project, SIGNAL( setLineEditFrameTag( const QString & ) ), lineEditFrameTag, SLOT( setText( const QString & ) ) ); connect(spriteModel, &SpriteModel::renameNode, this, &MainWindow::renameSpriteNode); connect(spriteModel, &SpriteModel::dragDropNode, this, &MainWindow::dragDropSpriteNode); connect(compositionModel, &CompositionModel::dropPictures, this, &MainWindow::dropPictures); connect(graphicsScene, &GraphicsScene::dropPictures, this, &MainWindow::dropPictures); setConnections(); spriteView->setCurrentIndex(spriteModel->getRootIndex()); onResetCurrentSprite(); if ( isLoadLastProjectAtStartup() ) loadLastProject(); }