3034ccom/final/War.cpp
void War::applyTieback(string s) {

  // J1 won the tiebreaker
  if (s == "J1") {

    // while the tieback vector has elements
    while (!tieback.empty()) {

      // Assign the elements to J1
      J1Deck.push_front(J1Deck.back());
      J1Deck.push_front(J2Deck.back());
      J1Deck.pop_back();
      J2Deck.pop_back();

      tieback.pop_back();
    }

  // J2 won the tiebreaker
  } else {

    // while the tieback vector has elements
    while (!tieback.empty()) {

      // Assign the elements to J2
      J2Deck.push_front(J2Deck.back());
      J2Deck.push_front(J1Deck.back());
      J1Deck.pop_back();
      J2Deck.pop_back();

      tieback.pop_back();
    }
  }
}
// applyTieback:
//  input a string s
//  output: function is void
input a string s
output: function is void
input a string s output : function is void
void War::applyTieback(string s) {
  if (s == "J1") {
    while (!tieback.empty()) {
      J1Deck.push_front(J1Deck.back());
      J1Deck.push_front(J2Deck.back());
      J1Deck.pop_back();
      J2Deck.pop_back();
      tieback.pop_back();
    }
  } else {
    while (!tieback.empty()) {
      J2Deck.push_front(J2Deck.back());
      J2Deck.push_front(J1Deck.back());
      J1Deck.pop_back();
      J2Deck.pop_back();
      tieback.pop_back();
    }
  }
}
void War :: applyTieback ( string s ) { if ( s == " " ) { while ( ! tieback . empty ( ) ) { J1Deck . push_front ( J1Deck . back ( ) ) ; J1Deck . push_front ( J2Deck . back ( ) ) ; J1Deck . pop_back ( ) ; J2Deck . pop_back ( ) ; tieback . pop_back ( ) ; } } else { while ( ! tieback . empty ( ) ) { J2Deck . push_front ( J2Deck . back ( ) ) ; J2Deck . push_front ( J1Deck . back ( ) ) ; J1Deck . pop_back ( ) ; J2Deck . pop_back ( ) ; tieback . pop_back ( ) ; } } }
applyTieback:
input a string s
output: function is void
applyTieback : input a string s output : function is void
// J1 won the tiebreaker // while the tieback vector has elements // Assign the elements to J1 // J2 won the tiebreaker // while the tieback vector has elements // Assign the elements to J2