void LinearSNNClassifier::checkgradRowSparse(const vector<Example>& examples, mat& Wd, const mat& gradWd, const string& mark, int iter,
        const hash_set<int>& sparseRowIndexes, const mat& ft) {
    //Random randWdRowcheck = new Random(iter + "Row".hashCode() + hash));
    int charseed = mark.length();
    for (int i = 0; i < mark.length(); i++) {
        charseed = (int) (mark[i]) * 5 + charseed;
    }
    srand(iter + charseed);
    std::vector<int> idRows, idCols;
    idRows.clear();
    idCols.clear();
    if (sparseRowIndexes.empty()) {
        for (int i = 0; i < Wd.n_rows; ++i)
            idRows.push_back(i);
    } else {
        hash_set<int>::iterator it;
        for (it = sparseRowIndexes.begin(); it != sparseRowIndexes.end(); ++it)
            idRows.push_back(*it);
    }

    for (int idx = 0; idx < Wd.n_cols; idx++)
        idCols.push_back(idx);

    random_shuffle(idRows.begin(), idRows.end());
    random_shuffle(idCols.begin(), idCols.end());

    int check_i = idRows[0], check_j = idCols[0];

    double orginValue = Wd(check_i, check_j);

    Wd(check_i, check_j) = orginValue + 0.001;
    double lossAdd = 0.0;
    for (int i = 0; i < examples.size(); i++) {
        Example oneExam = examples[i];
        lossAdd += computeScore(oneExam);
    }

    Wd(check_i, check_j) = orginValue - 0.001;
    double lossPlus = 0.0;
    for (int i = 0; i < examples.size(); i++) {
        Example oneExam = examples[i];
        lossPlus += computeScore(oneExam);
    }

    double mockGrad = (lossAdd - lossPlus) / (0.002 * ft(check_i, check_j));
    mockGrad = mockGrad / examples.size();
    double computeGrad = gradWd(check_i, check_j);

    printf("Iteration %d, Checking gradient for %s[%d][%d]:\t", iter, mark.c_str(), check_i, check_j);
    printf("mock grad = %.18f, computed grad = %.18f\n", mockGrad, computeGrad);

    Wd(check_i, check_j) = orginValue;
}
/** removes cuts that are inefficacious w.r.t. the current LP solution from separation storage without adding the cuts to the LP */
SCIP_RETCODE SCIPsepastoreRemoveInefficaciousCuts(
   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
   BMS_BLKMEM*           blkmem,             /**< block memory */
   SCIP_SET*             set,                /**< global SCIP settings */
   SCIP_STAT*            stat,               /**< problem statistics data */
   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
   SCIP_EVENTFILTER*     eventfilter,        /**< event filter for global events */
   SCIP_LP*              lp,                 /**< LP data */
   SCIP_Bool             root                /**< are we at the root node? */
   )
{
   int cnt;
   int c;

   assert( sepastore != NULL );

   /* check non-forced cuts only */
   cnt = 0;
   c = sepastore->nforcedcuts;
   while( c < sepastore->ncuts )
   {
      assert( sepastore->efficacies[c] == SCIP_INVALID ); /*lint !e777*/
      SCIP_CALL( computeScore(sepastore, set, stat, lp, FALSE, c) );
      if( !SCIPsetIsEfficacious(set, root, sepastore->efficacies[c]) )
      {
         SCIP_CALL( sepastoreDelCut(sepastore, blkmem, set, eventqueue, eventfilter, lp, c) );
         ++cnt;
      }
      else
         ++c;
   }
   SCIPdebugMessage("removed %d non-efficacious cuts\n", cnt);

   return SCIP_OKAY;
}
Exemple #3
0
void Game::updateGameInfos(int nbLinesDeleted)
{
	setLinesCompleted(getLinesCompleted() + nbLinesDeleted);
	setLevel(computeLevel());
	setFallIterationDelay(computeFallIterationDelay());
	setScore(computeScore(nbLinesDeleted) + getScore());
}
Exemple #4
0
	// Perform tracking score computation for all objects in the current frame
	// TODO for some reasons, somehow prev_score->getDirection() returns 0
	void TrackingEvaluator::addFrame(const vector<const TrackedObject*>& tracked_objects, const Mat& frame, int frame_number, const Mat* next_frame)
	{
		// Process each tracked object
		for(vector<const TrackedObject*>::const_iterator it = tracked_objects.begin(); it != tracked_objects.end(); it++)
		{
			// Get reference
			const TrackedObject& tracked_object = **it;
			// Check that the object appears in this frame
			if(tracked_object.lastAppearance() != frame_number)
			{
				// Skip object
				continue;
			}
			// If we don't have a ScoreHistory for this object, create it
			TrackingScoreHistory* history = NULL;
			if(objects.find(tracked_object.id) == objects.end())
			{
				// Create history
				history = new TrackingScoreHistory();
				// Add history to object list
				objects[tracked_object.id] = history;
			}
			else
			{
				// Get existing score history
				history = (TrackingScoreHistory*) objects[tracked_object.id];
			}
			// Compute score
			computeScore(tracked_object, frame, frame_number, history);
		}
	}
Exemple #5
0
int main()
{
    seqan::String<char> text = "This is an awesome tutorial to get to now SeqAn!";
    seqan::String<char> pattern = "tutorial";
    seqan::String<int> score = computeScore(text, pattern);
    print(score);
    return 0;
}
void LinearSNNClassifier::checkgrad(const vector<Example>& examples, double* Wd, const double* gradWd, const string& mark, int iter, int rowSize, int colSize) {
    //Random randWdRowcheck = new Random(iter + "Row".hashCode() + hash));
    int charseed = mark.length();
    for (int i = 0; i < mark.length(); i++) {
        charseed = (int) (mark[i]) * 5 + charseed;
    }
    srand(iter + charseed);
    std::vector<int> idRows, idCols;
    idRows.clear();
    idCols.clear();
    for (int i = 0; i < rowSize; ++i)
        idRows.push_back(i);
    for (int idx = 0; idx < colSize; idx++)
        idCols.push_back(idx);

    random_shuffle(idRows.begin(), idRows.end());
    random_shuffle(idCols.begin(), idCols.end());

    int check_i = idRows[0], check_j = idCols[0];

    double orginValue = Wd[check_i * colSize + check_j];

    Wd[check_i * colSize + check_j] = orginValue + 0.001;
    double lossAdd = 0.0;
    for (int i = 0; i < examples.size(); i++) {
        Example oneExam = examples[i];
        lossAdd += computeScore(oneExam);
    }

    Wd[check_i * colSize + check_j] = orginValue - 0.001;
    double lossPlus = 0.0;
    for (int i = 0; i < examples.size(); i++) {
        Example oneExam = examples[i];
        lossPlus += computeScore(oneExam);
    }

    double mockGrad = (lossAdd - lossPlus) / 0.002;
    mockGrad = mockGrad / examples.size();
    double computeGrad = gradWd[check_i * colSize + check_j];

    printf("Iteration %d, Checking gradient for %s[%d][%d]:\t", iter, mark.c_str(), check_i, check_j);
    printf("mock grad = %.18f, computed grad = %.18f\n", mockGrad, computeGrad);

    Wd[check_i * colSize + check_j] = orginValue;
}
Exemple #7
0
Correspondence::Correspondence(Edge *line, EdgePlane plane, ExtrinsicParameters came, int frameId, int id)
{
	score_alignment = score_overlap = score =0.0;
	p0 = plane;
	p=plane; 
	p.fromCameraFrameToWorldFrame(came.getTranslation(),came.getRotation()); // do not invert rotation matrix here since it has been done in ::init()
	l=line;
	valid = false;
	_frameId = frameId;
	_token = id;

	computeScore();
}
/*
 *  The player chose to stay. This function represents the dealers turn,
 *  returning the final score of the dealer to the caller.
 */
int stay(char *dealerHand, char *deck, int *deckPointer) {
    printCards(dealerHand,0,0,false);

    int dealerScore = computeScore(dealerHand);
    if(dealerScore >= 17) { // Don't have the dealer try to hit on 17 or up
        return dealerScore;
    }

    while(true) {
        drawCard(dealerHand,deck, deckPointer);
        dealerScore = computeScore(dealerHand);
        printCards(dealerHand,0,0,false);
        if(dealerScore == BUST) {
            break;
        } else if(dealerScore == BLACKJACK) {
            break;
        } else if(dealerScore >= 16) {
            break;
        }
    }

    return dealerScore;
}
Exemple #9
0
Team Game::endGame()
{
  if( toSwap )
    swapFool();
  
  if( addDogAtTheEnd )
    addWonCards( defenders.members.begin()->first, dog );
    
  // Compute score for each player
  for( shared_ptr<Player> player : players )
    player->score = computeScore( player->name );
  
  if( takers > defenders )
    return takers;
  else
    return defenders;
}
Exemple #10
0
void Cosine::setup(set<size_t> binResult, vector<size_t> queryTermId, vector<string>queryTerm, ForwardIndex* fR){
	// TODO set the list of binary search result and the query term Ids.
	//		Calculate the scores for each documents in binResult.
	this->frwdReader = fR;
	this->frwdReader->setup(1,"OUTPUT/fwd_index/ForwardIndex.txt");
	this->queryTerm = queryTerm;
	sort(queryTermId.begin(), queryTermId.end());
	this->queryTermId = queryTermId;
	// make query terms unique
	for(vector<size_t>::iterator it = queryTermId.begin(); it!=queryTermId.end(); ++it){
		this->uniQueryTermId.insert(*it);
	}
	this->uniQueryTermFreq = Cosine::computeQueryFreq(this->queryTermId, uniQueryTermId);
	this->queryDenominator = Cosine::computeDenominator(uniQueryTermId, uniQueryTermFreq);
	// for each document in binary search result list, apply "computeScore"
	for(set<size_t>::iterator itBinResult = binResult.begin(); itBinResult!=binResult.end(); ++itBinResult){
		computeScore(*itBinResult);
	}
}
//this function gets called after the falling animation ends and checks for a new explosion through the entire board
bool Board::boardHasMatches()
{
	bool explode = false;
	for (int i = 0; i < height; ++i)
		if (rowHasMatches(i))
			explode = true;

	for (int i = 0; i < width; ++i)
		if (colHasMatches(i))
			explode = true;

	if (explode)
	{
		STATE = State::STATE_EXPLODE;
		Board::STEP = 0;
		computeScore();
	}

	return explode;
}
void loop() {
    static char deck[DECK_SIZE];
    static char dealerHand[HAND_SIZE];
    static char hand[HAND_SIZE];
    static int deckPointer = 0;

    static int playerScore = 0;
    static int dealerScore = 0;
    static bool first = true;
    static bool checkForWinner = false;


    if(first) {
        generateDeck(deck);
        drawHand(hand,deck, &deckPointer);
        drawHand(dealerHand, deck, &deckPointer);
        playerScore = computeScore(hand);

        if(playerScore == BLACKJACK) {
            printGameResult("Blackjack!", playerScore);
            resetGame(hand, dealerHand, deck, &playerScore, &dealerScore, &deckPointer, &checkForWinner);
        }
        first = false;
    }

    if(sensorValue != analogRead(A0)) {
        sensorValue = analogRead(A0);
        Button button = (Button) getButton();

        switch (button) {
            case UP_BTN:
                playerScore = hit(hand,deck, &deckPointer);
                break;
            case DOWN_BTN:
                dealerScore = stay(dealerHand,deck, &deckPointer);
                checkForWinner = true;
                break;
            case LEFT_BTN:
                break;
            case RIGHT_BTN:
                break;
            case SELECT_BTN:
                resetGame(hand,dealerHand,deck,&playerScore,&dealerScore,&deckPointer,&checkForWinner);
                break;
            default:
                break;
        }
    }

    printCards(hand,1,0, false);

    if(computeScore(hand) == BLACKJACK) {
        printGameResult("Win!", playerScore);
        resetGame(hand,dealerHand,deck,&playerScore,&dealerScore,&deckPointer,&checkForWinner);

    } else if(computeScore(hand) == BUST) {
        printGameResult("Bust!", computeScoreNoBust(hand));
        resetGame(hand,dealerHand,deck,&playerScore,&dealerScore,&deckPointer,&checkForWinner);
    }

    if(checkForWinner) {
        printCards(dealerHand, 0,0,false);
        if(computeScore(hand) > computeScore(dealerHand)) {
            printGameResult("Win!", computeScore(hand));
        } else if(computeScore(hand) == computeScore(dealerHand)) {
            printGameResult("Tie.", computeScore(hand));
        } else {
            printGameResult("Lose.", computeScore(hand));
        }

        resetGame(hand,dealerHand,deck,&playerScore,&dealerScore,&deckPointer,&checkForWinner);
    } else {
        printCards(dealerHand,0,0,true);
    }

    computeScore(hand) > 9 ? lcd.setCursor(14,1) : lcd.setCursor(15,1);
    lcd.print(computeScore(hand));
    delay(100);
}
Exemple #13
0
 // !Important! Computing the gradient of a given input vector for the actual output           
 double computeGradient (int xi_id, int yi, int ythis)
 {
   return (yi == ythis ? 1 : 0) - computeScore (xi_id);
 }
BOOL HandRaisExcer::HandRaisExcerProcess(const NUI_SKELETON_DATA& skeletonData)
{
	//// distance filter
	Vector4 skeletonHead = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_HEAD];
	Vector4 skeletonShoulderCenter = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_SHOULDER_CENTER];
	Vector4 skeletonSpine = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_SPINE];
	Vector4 skeletonHipCenter = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_HIP_CENTER];

	m_dist2sensor = (skeletonHead.z + skeletonShoulderCenter.z + skeletonSpine.z + skeletonHipCenter.z) / 4;
	
	if (m_dist2sensor > 2.0f)
	{

		// caculate the min of two hands' raising angles
		Vector4 skeletonShoulderRight = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_SHOULDER_RIGHT];
		Vector4 skeletonWristRight = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_WRIST_RIGHT];
		Vector4 skeletonShoulderLeft = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_SHOULDER_LEFT];
		Vector4 skeletonWristLeft = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_WRIST_LEFT];

		FLOAT LeftAngle = GetAngleFromHands(skeletonWristLeft, skeletonShoulderLeft);
		FLOAT RightAngle = GetAngleFromHands(skeletonWristRight, skeletonShoulderRight);
	
		FLOAT m_RaisAngle = min(LeftAngle,RightAngle);

		// raising threshold
		FLOAT RaiseAngleThr = 60.0f;

		// detect the start of the raising and identify the right/left hand and increase the count
		if (m_RaisAngle < RaiseAngleThr)
		{
			if (LeftAngle < RaiseAngleThr && RightAngle < RaiseAngleThr)
			{
				if (!m_LeftRaisStatus)
				{
					m_LeftCount++;
				}
				if (!m_RightRaisStatus)
				{
					m_RightCount++;
				}
				m_LeftRaisStatus = TRUE;
				m_RightRaisStatus = TRUE;
				if (LeftAngle < m_MinLeftRaisAngle)
				{
					m_MinLeftRaisAngle = LeftAngle;
				}
				if (RightAngle < m_MinRightRaisAngle)
				{
					m_MinRightRaisAngle = RightAngle;
				}
			}
			else if (LeftAngle < RaiseAngleThr)
			{
				// increase the count of left hand by 1
				if ((!m_LeftRaisStatus)&&(!m_RightRaisStatus))
				{
					m_LeftCount++;
				}
				m_LeftRaisStatus = TRUE;
				if (LeftAngle < m_MinLeftRaisAngle)
				{
					m_MinLeftRaisAngle = LeftAngle;
				}
			}
			else
			{
				// increase the count of right hand by 1
				if ((!m_LeftRaisStatus)&&(!m_RightRaisStatus))
				{
					m_RightCount++;
				}
				m_RightRaisStatus = TRUE;
				if (RightAngle < m_MinRightRaisAngle)
				{
					m_MinRightRaisAngle = RightAngle;
				}

			}
		}
		else
		{
			if (m_LeftRaisStatus||m_RightRaisStatus)
			{
				computeScore();
			}
			m_LeftRaisStatus = FALSE;
			m_RightRaisStatus = FALSE;
			m_MinRightRaisAngle = 90.0f;
			m_MinLeftRaisAngle = 90.0f;
		}
		return TRUE;
	}
	else
		return FALSE;
}
Exemple #15
0
/*
adaptiveSearch
return n:number of wrong pieces left
*/
int adaptiveSearch(puzzle p, int **cur_sol)
{

	int* wrongs; //array of wrong pieces
	wrongs = (int *) malloc(p.n*sizeof(int));
	int n, found=1, new_score, score, i, j, tmp, rot, max, max_rot, old, index, jndex;


	//compute wrong pieces' array and actual score
	score=computeScore(p, cur_sol, wrongs, &n);
	if (n==0){
		//previous heuristics has already found optimum.
		return(0);
	}

	while(found){
		found=0;
		#ifndef WRONGS
		n=p.n;
		#endif

		for(i=0; i<n && !found;i++){

		    /*try rotating the piece in place */
		    index=i;
		    #ifdef WRONGS
            index=wrongs[i];
            #endif
		    max_rot=-1;
		    old=max=computeLocalScore(p, cur_sol, cur_sol[index][0], index, cur_sol[index][1]);
		    for(rot=0;rot<4;rot++){
                tmp=computeLocalScore(p, cur_sol, cur_sol[index][0], index, rot);
                if(tmp>max){
                    max=tmp;
                    max_rot=rot;
                }
            }
            if(max_rot>=0){
                cur_sol[index][1]=max_rot;
                score+=max-old;
                //TODO: update wrongs
                found=1;
            }
			for(j=i+1;j<n && !found;j++){
                    jndex=j;
                    #ifdef WRONGS
                    jndex=wrongs[j];
                    #endif


					//swap one to one between 2 wrong pieces
					new_score=trySwapPieces(p, cur_sol, score, index, jndex, wrongs,&n );

					if(new_score>score){
						found=1;
						score=new_score;
					}

					//else try other 2 pieces
			}
		}
	}

    free(wrongs);
	return(0);



}
Exemple #16
0
int main() {


	
	char toReroll[DICE];
	int sectionSelection;
	int categorySelection;
	int counter= 1;

	int upperUsed1 = 0;
	int upperUsed2 = 0;
	int upperUsed3 = 0;
	int upperUsed4 = 0;
	int upperUsed5 = 0;
	int upperUsed6 = 0;

	int lowerUsed1 = 0;
	int lowerUsed2 = 0;
	int lowerUsed3 = 0;
	int lowerUsed4 = 0;
	int lowerUsed5 = 0;
	int lowerUsed6 = 0;
	int lowerUsed7 = 0;

	srand(time(NULL));
	int i;

	while (counter < 13) {	//Must go 13 times to fill all categories
		printf("\: %i\n", counter);

		int rolls=1;		//Variable to hold how many re-rolls a user gets

		for(i = 0; i < DICE; i++) {
			dice[i] = generateDice();		//Generates dice
		}

		printf("Your Roll: ");

		for(i = 0; i < DICE; i++){ 
			printf("%i ", dice[i]);			//Prints dice
		}

		printf("\n");



		while(rolls < 3 ) {					//Loop to re-roll dice if necessary
			printf("Which dice to reroll?\n");
			scanf("%s", &toReroll);

			if(toReroll[0] == '0') {	//Do not reroll any more dice if user enters '0'
				break;
			} else {
				for(i = 0; i < DICE; i++) {
					//printf("%c\n", toReroll[i]);
					if(toReroll[i] == NULL) {
						break;
					}
					int num = toReroll[i] - '0';	//Converts from char to int
					num -= 1;
					dice[num] = generateDice();
				
					
				}

				int x;
					
				for(x = 0; x < DICE; x++){ 
					printf("%i ", dice[x]);			//Prints dice
				}
				printf("\n");


			}



			rolls++;

		}

		printf("Place dice into:\n");
		printf("1) Upper Section\n");
		printf("2) Lower Section\n");

		printf("Selection? ");
		scanf("%i", &sectionSelection);
		printf("\n");

		if(sectionSelection == 1) {		//Place into Upper Section

			while(1) {
				printf("Place dice into:\n");
				printf("1) Ones\n");
				printf("2) Twos\n");
				printf("3) Threes\n");
				printf("4) Fours\n");
				printf("5) Fives\n");
				printf("6) Sixes\n");
				scanf("%i", &categorySelection);
				printf("\n");


				if(categorySelection == 1) {
					if(upperUsed1) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.ones = computeScore(categorySelection);
					score+= upper.ones;
					upperUsed1 = 1;
					break;
				} else if (categorySelection == 2) {
					if(upperUsed2) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.twos = computeScore(categorySelection);
					score+= upper.twos;
					upperUsed2 = 1;
					break;
				} else if (categorySelection == 3) {
					if(upperUsed3) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.threes = computeScore(categorySelection);
					score+= upper.threes;
					upperUsed3 = 1;
					break;
				} else if (categorySelection == 4) {
					if(upperUsed4) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.fours = computeScore(categorySelection);
					score+= upper.fours;
					upperUsed4 = 1;
					break;
				} else if (categorySelection == 5) {
					if(upperUsed5) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.fives = computeScore(categorySelection);
					score+= upper.fives;
					upperUsed5 = 1;
					break;
				} else if (categorySelection == 6) {
					if(upperUsed6) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					upper.sixes = computeScore(categorySelection);
					score+= upper.sixes;
					upperUsed6 = 1;
					break;
				}
			}


			printScore();
			printf("\n\n");

		} else {	//Place into Lower Section

			while(1) {
				char takeZero;
				printf("Place dice into:\n");
				printf("1) Three of a Kind\n");
				printf("2) Four of a Kind\n");
				printf("3) Full House\n");
				printf("4) Small Straight\n");
				printf("5) Large Straight\n");
				printf("6) Yahtzee\n");
				printf("7) Chance\n");
				scanf("%i", &categorySelection);
				printf("\n");

				if(categorySelection == 1) {
					if(lowerUsed1) {
						printf("Already used. Please pick again\n\n");
						continue;
					}

					if(!isThreeOfAKind()){
						printf("You do not have three of a kind. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.threeOfAKind = 0;
						} else{
							continue;
						}
					} else{
						int sum = 0;
						for(i = 0; i < DICE; i++) {
							sum += dice[i];
						}

						lower.threeOfAKind = sum;
						score+= lower.threeOfAKind;
						lowerUsed1 = 1;
					}
					
				} else if (categorySelection == 2) {
					if(lowerUsed2) {
						printf("Already used. Please pick again\n\n");
						continue;
					}

					if(!isFourOfAKind()){
						printf("You do not have four of a kind. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.fourOfAKind = 0;
						} else {
							continue;
						}
					} else{
						int sum = 0;
						for(i = 0; i < DICE; i++) {
							sum += dice[i];
						}

						lower.fourOfAKind = sum;
						score+= lower.fourOfAKind;
						lowerUsed2 = 1;
					}
					
				} else if (categorySelection == 3) {
					if(lowerUsed3) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					if(!isFullHouse()) {
						printf("You do not have a full house. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.fullHouse = 0;
						} else {
							continue;
						}
					} else {
						lower.fullHouse = FULL_HOUSE;
						score += FULL_HOUSE;
						lowerUsed3 = 1;
					}
				} else if (categorySelection == 4) {
					if(lowerUsed4) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					if(!isSmallStraight()) {
						printf("You do not have small straight. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.smallStraight = 0;
						} else {
							continue;
						}
					} else {
						lower.smallStraight = SMALL_STRAIGHT;
						score += SMALL_STRAIGHT;
						lowerUsed4 = 1;
					}
				} else if (categorySelection == 5) {
					if(lowerUsed5) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					if(!isLargeStraight()) {
						printf("You do not have large straight. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.largeStraight = 0;
						} else {
							continue;
						}
					} else {
						lower.largeStraight = LARGE_STRAIGHT;
						score += LARGE_STRAIGHT;
						lowerUsed5 = 1;
					}
				} else if (categorySelection == 6) {
					if(lowerUsed6) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					if(!isYahtzee()){
						printf("You do not have yahtzee. Would you like to take a 0 for this category? [y/n]\n\n");
						scanf("%c", &takeZero);
						if(takeZero == 'y') {
							lower.threeOfAKind = 0;
						} else {
							continue;
						}
					} else {
						lower.yahtzee = YAHTZEE;
						score += YAHTZEE;
						lowerUsed6 = 1;
					}
				} else if(categorySelection == 7) {
					if(lowerUsed7) {
						printf("Already used. Please pick again\n\n");
						continue;
					}
					int i;
					int tempScore = 0;
					for (i = 0; i < DICE; i++) {
						tempScore += dice[i];
					}

					lower.chance = tempScore;
					score += tempScore;
					lowerUsed7 = 1;
				}


				printScore();
				printf("\n");
				break;
			} //End while
		} //End else


		counter++;
	} //End while

	if( (upper.ones + upper.twos + upper.threes + upper.fours + upper.fives + upper.sixes) > 63) {
		printf("35 Bonus points because your upper section totalled more than 63\n");
		score+= 35;
	}
	addInZeros();
	printf("Final Score\n");
	printf("------------------------------------------\n");
	printScore();
	printf("------------------------------------------\n");
	 


	return 0;
}
/** adds cuts to the LP and clears separation storage */
SCIP_RETCODE SCIPsepastoreApplyCuts(
   SCIP_SEPASTORE*       sepastore,          /**< separation storage */
   BMS_BLKMEM*           blkmem,             /**< block memory */
   SCIP_SET*             set,                /**< global SCIP settings */
   SCIP_STAT*            stat,               /**< problem statistics */
   SCIP_TREE*            tree,               /**< branch and bound tree */
   SCIP_LP*              lp,                 /**< LP data */
   SCIP_BRANCHCAND*      branchcand,         /**< branching candidate storage */
   SCIP_EVENTQUEUE*      eventqueue,         /**< event queue */
   SCIP_EVENTFILTER*     eventfilter,        /**< global event filter */
   SCIP_Bool             root,               /**< are we at the root node? */
   SCIP_Bool*            cutoff              /**< pointer to store whether an empty domain was created */
   )
{
   SCIP_NODE* node;
   SCIP_Real mincutorthogonality;
   int depth;
   int maxsepacuts;
   int ncutsapplied;
   int pos;

   assert(sepastore != NULL);
   assert(set != NULL);
   assert(tree != NULL);
   assert(lp != NULL);
   assert(cutoff != NULL);

   *cutoff = FALSE;

   SCIPdebugMessage("applying %d cuts\n", sepastore->ncuts);

   node = SCIPtreeGetCurrentNode(tree);
   assert(node != NULL);

   /* get maximal number of cuts to add to the LP */
   maxsepacuts = SCIPsetGetSepaMaxcuts(set, root);
   ncutsapplied = 0;

   /* get depth of current node */
   depth = SCIPnodeGetDepth(node);

   /* calculate minimal cut orthogonality */
   mincutorthogonality = (root ? set->sepa_minorthoroot : set->sepa_minortho);
   mincutorthogonality = MAX(mincutorthogonality, set->num_epsilon);

   /* Compute scores for all non-forced cuts and initialize orthogonalities - make sure all cuts are initialized again for the current LP solution */
   for( pos = sepastore->nforcedcuts; pos < sepastore->ncuts; pos++ )
   {
      SCIP_CALL( computeScore(sepastore, set, stat, lp, TRUE, pos) );
   }

   /* apply all forced cuts */
   for( pos = 0; pos < sepastore->nforcedcuts && !(*cutoff); pos++ )
   {
      SCIP_ROW* cut;

      cut = sepastore->cuts[pos];
      assert(SCIPsetIsInfinity(set, sepastore->scores[pos]));

      /* if the cut is a bound change (i.e. a row with only one variable), add it as bound change instead of LP row */
      if( !SCIProwIsModifiable(cut) && SCIProwGetNNonz(cut) == 1 )
      {
         SCIPdebugMessage(" -> applying forced cut <%s> as boundchange\n", SCIProwGetName(cut));
         SCIP_CALL( sepastoreApplyBdchg(sepastore, blkmem, set, stat, tree, lp, branchcand, eventqueue, cut, cutoff) );
      }
      else
      {
         /* add cut to the LP and update orthogonalities */
         SCIPdebugMessage(" -> applying forced cut <%s>\n", SCIProwGetName(cut));
         /*SCIPdebug(SCIProwPrint(cut, NULL));*/
         SCIP_CALL( sepastoreApplyCut(sepastore, blkmem, set, eventqueue, eventfilter, lp, cut, mincutorthogonality, depth, &ncutsapplied) );
      }
   }

   /* apply non-forced cuts */
   while( ncutsapplied < maxsepacuts && sepastore->ncuts > sepastore->nforcedcuts && !(*cutoff) )
   {
      SCIP_ROW* cut;
      int bestpos;
      
      /* get best non-forced cut */
      bestpos = sepastoreGetBestCut(sepastore);
      assert(sepastore->nforcedcuts <= bestpos && bestpos < sepastore->ncuts);
      assert(sepastore->scores[bestpos] != SCIP_INVALID ); /*lint !e777*/
      assert(sepastore->efficacies[bestpos] != SCIP_INVALID ); /*lint !e777*/
      cut = sepastore->cuts[bestpos];
      assert(SCIProwIsModifiable(cut) || SCIProwGetNNonz(cut) != 1); /* bound changes are forced cuts */
      assert(!SCIPsetIsInfinity(set, sepastore->scores[bestpos]));
      
      SCIPdebugMessage(" -> applying cut <%s> (pos=%d/%d, len=%d, efficacy=%g, objparallelism=%g, orthogonality=%g, score=%g)\n",
         SCIProwGetName(cut), bestpos, sepastore->ncuts, SCIProwGetNNonz(cut), sepastore->efficacies[bestpos], sepastore->objparallelisms[bestpos],
         sepastore->orthogonalities[bestpos], sepastore->scores[bestpos]);
      /*SCIPdebug(SCIProwPrint(cut, NULL));*/

      /* capture cut such that it is not destroyed in sepastoreDelCut() */
      SCIProwCapture(cut);

      /* release the row and delete the cut (also issuing ROWDELETEDSEPA event) */
      SCIP_CALL( sepastoreDelCut(sepastore, blkmem, set, eventqueue, eventfilter, lp, bestpos) );

      /* Do not add (non-forced) non-violated cuts.
       * Note: do not take SCIPsetIsEfficacious(), because constraint handlers often add cuts w.r.t. SCIPsetIsFeasPositive().
       */
      if( SCIPsetIsFeasPositive(set, sepastore->efficacies[bestpos]) )
      {
         /* add cut to the LP and update orthogonalities */
         SCIP_CALL( sepastoreApplyCut(sepastore, blkmem, set, eventqueue, eventfilter, lp, cut, mincutorthogonality, depth, &ncutsapplied) );
      }

      /* release cut */
      SCIP_CALL( SCIProwRelease(&cut, blkmem, set, lp) );
   }

   /* clear the separation storage and reset statistics for separation round */
   SCIP_CALL( SCIPsepastoreClearCuts(sepastore, blkmem, set, eventqueue, eventfilter, lp) );

   return SCIP_OKAY;
}
/*
 *  The player chose to hit
 */
int hit(char *hand, char *deck, int *deckPointer) {
    drawCard(hand,deck,deckPointer);
    int score = computeScore(hand);
    return score > 21 ? BUST : score;
}