예제 #1
0
파일: Caravan.cs 프로젝트: tatlat/Caravan
        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);
        }
예제 #2
0
파일: Caravan.cs 프로젝트: tatlat/Caravan
        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);
        }