Exemple #1
0
        public void CalculateScores(Team[] teams, Case gameCase)
        {
            int[] scores = new int[teams.Length];

            for (int i = 0; i < teams.Length; i++)
            {
                scores[i] = teams[i].Tricks;
                foreach (var player in teams[i].Players)
                    player.score += scores[i];
            }
        }
Exemple #2
0
 public void CalculateScores(Team[] teams, Case gameCase)
 {
     switch (gameCase)
     {
         case Case.TEAM:
             {
                 Team teamA = teams.Where(t => t.objective == 8).Single();
                 Team teamB = teams.Where(t => t.objective == 6).Single();
                 if (teamA.Tricks >= teamA.objective)
                 {
                     int overslagen = teamA.Tricks - teamA.objective;
                     int scorePP = (2 + overslagen);
                     if (teamA.Tricks == 13)
                         scorePP *= 2;
                     teamA.applyScore(scorePP);
                     teamB.applyScore(-scorePP);
                 }
                 else
                 {
                     int onderslagen = teamA.objective - teamA.Tricks;
                     int scorePP = 2 + 2* onderslagen;
                     teamA.applyScore(-scorePP);
                     teamB.applyScore(scorePP);
                 }
                 break;
             }
         case Case.ALONE:
             {
                 Team aloneTeam = teams.Where(t => t.objective == 5).Single();
                 Team otherTeam = teams.Where(t => t.objective == 9).Single();
                 if (aloneTeam.Tricks >= aloneTeam.objective)
                 {
                     int overslagen = aloneTeam.Tricks - aloneTeam.objective;
                     int scorePP = (2 + overslagen);
                     if (aloneTeam.Tricks == 13)
                         scorePP *= 2;
                     aloneTeam.applyScore(scorePP * 3);
                     otherTeam.applyScore(-scorePP);
                 }
                 else
                 {
                     int onderslagen = aloneTeam.objective - aloneTeam.Tricks;
                     int scorePP = 3 + 2* onderslagen;
                     aloneTeam.applyScore(-scorePP * 3);
                     otherTeam.applyScore(scorePP);
                 }
                 break;
             }
         default:
             {
                 SpecialGameCaseFactory.GetDictionary()[gameCase].ApplyScores(teams);
                 break;
             }
         /*case Case.ABONDANCE:
             {
                 var abondance = new Abondance();
                 abondance.ApplyScores(teams);
                 break;
             }
         case Case.TROEL:
             {
                 var troel = new Troel();
                 troel.ApplyScores(teams);
                 break;
             }
         case Case.MISERIE:
             {
                 var miserie = new Miserie();
                 miserie.ApplyScores(teams);
                 break;
             }
         case Case.SOLO:
             {
                 var solo = new Solo();
                 solo.ApplyScores(teams);
                 break;
             }
         case Case.SOLOSLIM:
             {
                 var soloslim = new Soloslim();
                 soloslim.ApplyScores(teams);
                 break;
             }*/
     }
 }
Exemple #3
0
 public ResultData(Team[] teams, Case gameCase, Player firstPlayer, Suits trump)
 {
     this.teams = teams;
     this.gameCase = gameCase;
     this.firstPlayer = firstPlayer;
     this.trump = trump;
 }
Exemple #4
0
 public abstract void ApplyScores(Team[] teams);
Exemple #5
0
        //Set Game Case and teams
        public ResultData FinalizeBidding()
        {
            if (GameCase == 0)//GameCase 0 is FFA, perhaps unnecessary.
            {
                if (!passedPlayers.ContainsValue(false))//Everyone passed => FFA
                {
                    GameCase = Case.UNDECIDED;
                    throw new ApplicationException();
                }
            }

            Team[] teams;
            Player firstPlayer = players[0];
            switch (GameCase)
            {
                case Case.TEAM:
                    {
                        Team teamA = new Team(new Player[] { playerA, playerB }, 8);
                        Player[] others = players.Except(teamA.Players).ToArray();
                        Team teamB = new Team(others, 6);
                        teams = new Team[] { teamA, teamB };
                        break;
                    }
                case Case.ALONE:
                    {
                        Team teamA = new Team(new Player[] { playerA }, 5);
                        Player[] others = players.Except(teamA.Players).ToArray();
                        Team teamB = new Team(others, 9);
                        teams = new Team[] { teamA, teamB };
                        break;
                    }
                case Case.TROEL:
                    {
                        Troel troel = new Troel();
                        teams = troel.Teams(players);
                        Trump = troel.GetTrump(players);
                        firstPlayer = teams.Where(t => t.objective == 8).Single().Players.Where(p => p.hand.Cards.Where(c => c.Number == Numbers.ACE).Count() <= 1).Single();
                        break;
                    }
                case Case.ABONDANCE:
                    {
                        firstPlayer = specialGameCases[Case.ABONDANCE].selectedPlayers[0];
                        teams = specialGameCases[Case.ABONDANCE].Teams(players);
                        break;
                    }
                case Case.MISERIE:
                    {
                        teams = specialGameCases[Case.MISERIE].Teams(players);
                        break;
                    }
                case Case.SOLO:
                    {
                        firstPlayer = specialGameCases[Case.SOLO].selectedPlayers[0];
                        teams = specialGameCases[Case.SOLO].Teams(players);
                        break;
                    }
                case Case.SOLOSLIM:
                    {
                        firstPlayer = specialGameCases[Case.SOLOSLIM].selectedPlayers[0];
                        teams = specialGameCases[Case.SOLOSLIM].Teams(players);
                        break;
                    }
                default: return null;
            }

            return new ResultData(teams, GameCase, firstPlayer, Trump);
        }
Exemple #6
0
        public override void ApplyScores(Team[] teams)
        {
            var teamA = teams.Where(t => t.objective == 13).Single();
            var teamB = teams.Where(t => t.objective == 1).Single();

            if (teamA.Tricks == 13)
            {
                teamA.applyScore(90);
                teamB.applyScore(-30);
            }
            else
            {
                teamA.applyScore(-90);
                teamB.applyScore(30);
            }
        }
Exemple #7
0
 public override Team[] Teams(Player[] players)
 {
     Team teamA = new Team(new Player[] { selectedPlayers[0] }, 13);
     Player[] others = players.Except(selectedPlayers).ToArray();
     Team teamB = new Team(others, 1);
     return new Team[] { teamA, teamB };
 }
Exemple #8
0
        public override void ApplyScores(Team[] teams)
        {
            var miserieTeams = teams.Where(t => t.objective == 0);
            var antimiserieTeam = teams.Where(t => t.objective == 1).Single();

            foreach (Team misTeam in miserieTeams)
                if (misTeam.Tricks == 0)
                {
                    misTeam.applyScore(21);
                    foreach (Team losingTeam in teams.Except(new Team[] { misTeam }))
                        losingTeam.applyScore(-7);
                }
                else
                {
                    misTeam.applyScore(-21);
                    foreach (Team winingTeam in teams.Except(new Team[] { misTeam }))
                        winingTeam.applyScore(7);
                }
        }
Exemple #9
0
        public override void ApplyScores(Team[] teams)
        {
            var teamA = teams.Where(t => t.objective == 9).Single();
            var teamB = teams.Where(t => t.objective == 5).Single();

            if (teamA.Tricks >= 9)
            {
                teamA.applyScore(15);
                teamB.applyScore(-5);
            }
            else
            {
                teamA.applyScore(-15);
                teamB.applyScore(5);
            }
        }
Exemple #10
0
        public override void ApplyScores(Team[] teams)
        {
            var teamA = teams.Where(t => t.objective == 8).Single();
            var teamB = teams.Where(t => t.objective == 6).Single();

            if (teamA.Tricks >= teamA.objective)
            {
                int overslagen = teamA.Tricks - teamA.objective;
                int scorePP = (4 + 2*overslagen);
                if (teamA.Tricks == 13)
                    scorePP *= 2;
                teamA.applyScore(scorePP);
                teamB.applyScore(-scorePP);
            }
            else
            {
                int onderslagen = teamA.objective - teamA.Tricks;
                int scorePP = 4 + 4*onderslagen;
                teamA.applyScore(-scorePP);
                teamB.applyScore(scorePP);
            }
        }