Beispiel #1
0
        public void PlayerScoresWithTurns(HandGesture g1, HandGesture g2, HandGesture g3, int score1, int score2, int score3)
        {
            var turn1 = new Turn(_Players.ElementAt(0), g1);
            var turn2 = new Turn(_Players.ElementAt(1), g2);
            var turn3 = new Turn(_Players.ElementAt(2), g3);

            _Scorer.Update(new Turn[] { turn1, turn2, turn3 });
            Assert.AreEqual(score1, _Scorer.Scores.ElementAt(0).Score, $@"Player 1 should score {score1} points");
            Assert.AreEqual(score2, _Scorer.Scores.ElementAt(1).Score, $@"Player 2 should score {score2} points");
            Assert.AreEqual(score3, _Scorer.Scores.ElementAt(2).Score, $@"Player 3 should score {score3} points");
        }
Beispiel #2
0
        public async Task <IEnumerable <Turn> > RunRound()
        {
            _Round++;
            // Wait for all players to play their turn
            var turns = await Task.WhenAll(_Players.Select(async p => new Turn(p, await p.GetGesture())));

            // and then score the turns
            _Scorer.Update(turns);
            // Allow the players to do any learning if necessary
            await Task.WhenAll(_Players.Select(async p => await p.Learn(turns)));

            return(turns);
        }