public Match(string seed, IEnumerable<string> accountIds, int lobby, MatchType matchType, LogOnService logOnService) { _lobby = lobby; _matchType = matchType; _logOnService = logOnService; _shuffler = new WallGenerator(seed); _firstOyaIndex = _shuffler.GetWall(0).First().Id % 4; var playerIndex = 0; foreach (var player in accountIds) { _players.Add(player, new PlayerStatus(playerIndex)); playerIndex += 1; } _stateMachine = new StateMachine(new PlayersConnectingState(this)); _stateMachine.Finished += OnFinished; }
public void TestWallGenerator() { var w = new WallGenerator(Seed); Assert.AreEqual(5, w.GetDice(0).ToList()[0], "dice 0"); Assert.AreEqual(5, w.GetDice(0).ToList()[1], "dice 1"); Assert.AreEqual(11, w.GetWall(0).ToList()[5].Id, "dora 0"); Assert.IsTrue(_tileIdsGame0.SequenceEqual(w.GetWall(0).Select(t => t.Id).Reverse().Take(13 * 4)), "wall"); Assert.AreEqual(1, w.GetDice(1).ToList()[0], "dice 0"); Assert.AreEqual(3, w.GetDice(1).ToList()[1], "dice 1"); Assert.AreEqual(109, w.GetWall(1).ToList()[5].Id, "dora 0"); Assert.IsTrue(_tileIdsGame1.SequenceEqual(w.GetWall(1).Select(t => t.Id).Reverse().Take(13 * 4)), "wall"); }