Beispiel #1
0
        public override ILinearizedRound Linearize()
        {
            Deploying deploying = new Deploying(new List<Deployment>());
            Attacking attacking = new Attacking(new List<Attack>());

            int index = 0;
            while (true)
            {
                // true if anything in this round of cycle was added
                // false if nothing happened => everything was solved => can break out
                bool didSomething = false;
                foreach (GameTurn round in Turns)
                {
                    if (round.Deploying.ArmiesDeployed.Count > index)
                    {
                        Deployment armyDeployed = round.Deploying.ArmiesDeployed[index];
                        deploying.ArmiesDeployed.Add(armyDeployed);
                        didSomething = true;
                    }

                    if (round.Attacking.Attacks.Count > index)
                    {
                        Attack attack = round.Attacking.Attacks[index];
                        attacking.Attacks.Add(attack);
                        didSomething = true;
                    }
                }

                if (!didSomething)
                {
                    break;
                }

                index++;
            }
            return new LinearizedGameRound(deploying, attacking);
        }
Beispiel #2
0
 public LinearizedGameRound(Deploying deploying, Attacking attacking)
 {
     Deploying = deploying;
     Attacking = attacking;
 }
Beispiel #3
0
 public GameTurn(Player playerOnTurn) : base(playerOnTurn)
 {
     Deploying = new Deploying(new List <Deployment>());
     Attacking = new Attacking(new List <Attack>());
 }
Beispiel #4
0
 public GameTurn(Deploying deploying, Attacking attacking, Player playerOnTurn) : base(playerOnTurn)
 {
     Deploying = deploying;
     Attacking = attacking;
 }