public bool isGameOver() { int count = 0; for (int i = 0; i < 3; i++) { if (CaravanRow.isSold(theirCaravans[i]) || CaravanRow.isSold(myCaravans[i])) { count++; } } return(count == 3); }
public bool checkWinner() { int mySold = 0; int oppSold = 0; for (int i = 0; i < 3; i++) { CaravanRow mine = myCaravans[i]; CaravanRow theirs = theirCaravans[i]; if (CaravanRow.isSold(mine) && !CaravanRow.isSold(theirs)) { mySold++; } else if (!CaravanRow.isSold(mine) && CaravanRow.isSold(theirs)) { oppSold++; } else if (CaravanRow.isSold(mine) && CaravanRow.isSold(theirs)) { if (mine.GetScore() > theirs.GetScore()) { mySold++; } else if (mine.GetScore() < theirs.GetScore()) { oppSold++; } else { mySold++; oppSold++; } } } return(mySold >= oppSold); }