/// <summary>
        /// Creates a schedule for the first round.
        /// </summary>
        /// <param name="teams"></param>
        /// <returns></returns>
        public Dictionary <int, List <Match> > GetSchedule(List <Team> teams)
        {
            var  possible       = new[] { 2, 4, 8, 16, 32, 64, 128, 256 };
            bool argumentsValid = possible.Contains(teams.Count);

            if (!argumentsValid)
            {
                throw new Exception("Unexpected number of teams");
            }

            teams.Shuffle();

            // Draw the first round, the other rounds will be drawn later.
            var schedule = new Dictionary <int, List <Match> >();

            schedule[0] = new List <Match>();
            int numberOfMatches = teams.Count / 2;

            int teamIndex = 0;

            for (int i = 0; i < numberOfMatches; i++)
            {
                var homeTeam = teams[teamIndex];
                var awayTeam = teams[teamIndex + 1];
                var match    = MatchFactory.CreateMatch(homeTeam, awayTeam);
                schedule[0].Add(match);
                teamIndex += 2;
            }

            return(schedule);
        }
Example #2
0
        public object Post(MoveTeamToLeagueRequest request)
        {
            var team = Db.SingleById <Team>(request.TeamId);

            var oldLeagueId = team.LeagueId.GetValueOrDefault();

            using (var transaction = Db.BeginTransaction())
            {
                Db.Delete <Match>(sql =>
                                  sql.GuestTeamId == team.Id || sql.HomeTeamId == team.Id && sql.LeagueId == team.LeagueId);

                var targetLeague        = Db.SingleById <League>(request.Id);
                var teamsInTargetLeague = Db.Select <Team>(sql => sql.LeagueId == request.Id);

                var newMatches = MatchFactory.CreateMatchesForMovedTeam(team, teamsInTargetLeague, targetLeague);

                foreach (var match in newMatches)
                {
                    match.LeagueId = targetLeague.Id;
                    Db.Insert(match, true);
                }

                Db.Update <Team>(new { LeagueId = request.Id }, p => p.Id == request.TeamId);
                Db.Update <TableEntry>(new { LeagueId = request.Id },
                                       p => p.TeamId == request.TeamId && p.LeagueId == oldLeagueId);

                StandingsCalculator.Calculate(Db, oldLeagueId);
                StandingsCalculator.Calculate(Db, request.Id);

                transaction.Commit();
            }

            return(null);
        }
Example #3
0
        public ActionResult check(string fromStreet, string fromCity, string fromState, string fromZip, string toStreet, string toCity, string toState, string toZip, string time, FormCollection fc)
        {
            string typeText    = fc["typeText"];
            string origin      = fromStreet + ", " + fromCity + ", " + fromState + ", " + fromZip;
            string destination = toStreet + ", " + toCity + ", " + toState + ", " + toZip;
            //Console.WriteLine("origin: " + origin);
            //Console.WriteLine("destination: " + destination);
            int type = Int32.Parse(typeText);

            ViewBag.from     = origin;
            TempData["from"] = origin;
            ViewBag.to       = destination;
            TempData["to"]   = destination;
            ViewBag.time     = time;
            TempData["time"] = time;
            // DriverTrip newTrip = new DriverTrip(from, to, time);
            // ViewBag.list = getResult(newTrip);
            Location from   = new Location(fromStreet, fromCity, fromState, fromZip);
            Location to     = new Location(toStreet, toCity, toState, toZip);
            DateTime myTime = DateTime.ParseExact(time, "yyyy-MM-dd HH:mm",
                                                  System.Globalization.CultureInfo.InvariantCulture);
            //.AddHours(6)

            Trip             newTrip = new Trip(from, to, myTime);
            IAbstractFactory factory = MatchFactory.getInstance();
            IMatchAdapter    adapter = factory.getMatchAdapter(myTime, type);

            ViewBag.list = adapter.getMatchedTrips(newTrip);
            if (ViewBag.list.Count == 0)
            {
                return(View("emptyResult"));
            }

            return(View());
        }
Example #4
0
        /// <summary>
        /// Diese Methode kümmert sich um das Spielen der Gruppenspiele.
        /// </summary>
        private void PlayMatches()
        {
            bool homeAndAwayMatches = false;

            Console.WriteLine("Do you want to play home and away matches? Press 'Y' for home and away Matches");

            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                homeAndAwayMatches = true;
            }

            Console.WriteLine("\nPress Enter to start playing.");
            Console.ReadLine();
            Console.Clear();
            CreateMatches();
            ShuffleMatches(AllMatches); // shuffle Matches to have more randomness
            var matchFactory = new MatchFactory();

            foreach (Match match in AllMatches)
            {
                matchFactory.PlayMatch(match);
            }

            //wenn die Rückrunde gespielt wird, sollen die Matches nochmal gespielt werden
            if (homeAndAwayMatches)
            {
                foreach (Match match in AllMatches)
                {
                    matchFactory.ChangeHomeAndAway(match);
                    matchFactory.PlayMatch(match);
                }
            }
        }
Example #5
0
        /// <summary>
        /// Returns a list of matches where each team from list1 plays against a team from teams2.
        /// All teams from both lists play one match. Whether a team plays home or away is determined randomly.
        /// The total number of teams for both lists must be an even number and both lists must contain an equal number of teams.
        /// </summary>
        public List <Match> GetMatches(IList <Team> teams1, IList <Team> teams2)
        {
            // Total number of teams must be even and both lists same number of teams.
            bool isValid = (teams1.Count + teams2.Count) % 2 == 0 &&
                           teams1.Count == teams2.Count;

            if (!isValid)
            {
                throw new Exception("Even number of teams expected and both lists same number of teams");
            }

            teams1.Shuffle();
            teams2.Shuffle();

            var matches = new List <Match>();

            for (int i = 0; i < teams1.Count; i++)
            {
                // Optionally swith home/away
                var  homeTeam          = teams1[i];
                var  awayTeam          = teams2[i];
                bool switchHomeAndAway = _randomizer.GetRandomBoolean();
                if (switchHomeAndAway)
                {
                    homeTeam = teams2[i];
                    awayTeam = teams1[i];
                }

                var match = MatchFactory.CreateMatch(homeTeam, awayTeam);

                matches.Add(match);
            }

            return(matches);
        }
 public void Initialize()
 {
     _matchFactory = new FootballMatchFactory();
     //_matchExecutioner = new MatchHandler(_matchFactory, new PoissonPotentialOutcomeCalculator());
     _matchExecutioner = new FakeMatchCommand();
     _RRSelector       = new RoundRobinTournamentSelector(_matchExecutioner, _matchFactory);
 }
        protected void BeginTest(string mapName, int playersCount)
        {
            m_abilities = new Dictionary <int, VoxelAbilities[]>();
            m_players   = new Guid[playersCount];
            for (int i = 0; i < m_players.Length; ++i)
            {
                m_players[i] = Guid.NewGuid();
                m_abilities.Add(i, CreateTemporaryAbilies());
            }

            string dataPath = Application.streamingAssetsPath + "/Maps/";
            string filePath = dataPath + mapName;

            m_replay = MatchFactory.CreateReplayRecorder();

            Dictionary <int, VoxelAbilities>[] allAbilities = new Dictionary <int, VoxelAbilities> [m_players.Length];
            for (int i = 0; i < m_players.Length; ++i)
            {
                allAbilities[i] = m_abilities[i].ToDictionary(a => a.Type);
            }

            MapData mapData = m_protobufSerializer.Deserialize <MapData>(File.ReadAllBytes(filePath));

            m_map    = m_protobufSerializer.Deserialize <MapRoot>(mapData.Bytes);
            m_engine = MatchFactory.CreateMatchEngine(m_map, playersCount);
            for (int i = 0; i < m_players.Length; ++i)
            {
                m_engine.RegisterPlayer(m_players[i], i, allAbilities);
            }
            m_engine.CompletePlayerRegistration();
        }
Example #8
0
        public object Get(CreateCupFromLeagueRequest request)
        {
            var competition = Db.LoadSingleById <Competition>(request.CompetitionId);
            var leagueIds   = competition.Leagues.Select(s => s.Id).ToList();
            var teams       = Db.Select(Db.From <Team>().Where(p => Sql.In(p.LeagueId, leagueIds)));
            var cup         = Db.SingleById <Cup>(request.Id);

            using (var transaction = Db.OpenTransaction(IsolationLevel.RepeatableRead))
            {
                Db.Delete(Db.From <Match>().Where(p => p.CupId == request.Id));

                var matches = MatchFactory.CreateCupMatches(teams, competition.Leagues, Db);
                matches.ForEach(m => m.CupId = request.Id);

                foreach (var match in matches)
                {
                    Db.Insert(match);
                }

                cup.CurrentRound = 1;

                Db.Save(cup);

                transaction.Commit();

                return(null);
            }
        }
Example #9
0
        internal static IMatch ParseFilterParameter(string filterParameter, out string error)
        {
            error = null;
            if (!Regex.IsMatch(filterParameter, "Description\\s+-like\\s+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
            {
                error = Strings.InvalidRuleSearchFilterMissingElements;
                return(null);
            }
            Regex regex = new Regex(string.Format("Description\\s+-like\\s+(\"|')(?<{0}>.*)(\"|')", "theFilter"), RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            Match match = regex.Match(filterParameter);

            if (match.Groups["theFilter"] != null)
            {
                string text = regex.Match(filterParameter).Groups["theFilter"].Value.Trim();
                if (string.IsNullOrEmpty(text))
                {
                    error = Strings.InvalidRuleSearchFilterEmpty;
                    return(null);
                }
                MatchFactory matchFactory = new MatchFactory();
                try
                {
                    return(matchFactory.CreateRegex(GetTransportRule.FilterStringToRegex(text), false, false));
                }
                catch (ArgumentException ex)
                {
                    error = (string.IsNullOrWhiteSpace(ex.Message) ? "Unknown Error" : ex.Message);
                    return(null);
                }
            }
            error = Strings.InvalidRuleSearchFilterEmpty;
            return(null);
        }
Example #10
0
        public object Post(CreateCupRoundRequest request)
        {
            using (var transaction = Db.BeginTransaction(IsolationLevel.RepeatableRead))
            {
                var cup = Db.SingleById <Cup>(request.Id);

                var matchesCurrentRound =
                    Db.LoadSelect(Db.From <Match>().Where(p => p.CupId == cup.Id && p.CupRound == cup.CurrentRound));
                var guestTeamIds = matchesCurrentRound.Select(s => s.GuestTeamId).ToList();
                var homeTeamIds  = matchesCurrentRound.Select(s => s.HomeTeamId).ToList();
                var teamIds      = guestTeamIds.Concat(homeTeamIds).Distinct().ToList();
                var teams        = Db.SelectByIds <Team>(teamIds);
                var leagueIds    = teams.Select(s => s.LeagueId).Distinct().ToList();
                var leagues      = Db.SelectByIds <League>(leagueIds);

                var newRoundMatches = MatchFactory.CreateNextCupRound(matchesCurrentRound, teams, leagues, Db);

                Db.Update <Cup>(new { CurrentRound = cup.CurrentRound + 1 }, p => p.Id == cup.Id);

                foreach (var match in newRoundMatches)
                {
                    // we can not use InsertAll as it opens a new transaction -> nested transaction are not supported
                    Db.Insert(match);
                }

                transaction.Commit();
            }

            return(null);
        }
Example #11
0
 public void WhenILoadTheMatch(string embeddedResource)
 {
     Invoke(() =>
     {
         Match = MatchFactory.Load(Assembly.GetExecutingAssembly().EmbeddedResourceString(embeddedResource)).Single();
         Game  = Match.Game;
     });
 }
Example #12
0
        public void IsTeamInvolved_TeamIsSecondOpponent_ShouldReturnTrue()
        {
            var gameStep     = CreateGameStepStub1();
            var team1        = CreateTeamStub1();
            var team2        = CreateTeamStub2();
            var matchSetting = CreateMatchSettingStub1();
            var match        = new MatchFactory().Create(gameStep.Object, team1.Object, team2.Object, matchSetting.Object);

            Assert.AreEqual(true, match.IsTeamInvolved(team2.Object));
        }
Example #13
0
        public void Start_PlannedMatchWithNoField_ShouldThrowException()
        {
            var gameStep     = CreateGameStepStub1();
            var team1        = CreateTeamStub1();
            var team2        = CreateTeamStub2();
            var matchSetting = CreateMatchSettingStub1();
            var match        = new MatchFactory().Create(Helper.GetMock(gameStep), Helper.GetMock(team1), Helper.GetMock(team2), Helper.GetMock(matchSetting));

            Assert.Throws <ArgumentNullException>(() => match.Start(null));
        }
Example #14
0
 public MatchDto GetMatchStatistics(int id)
 {
     if (id < 1)
     {
         throw new RankException("Bad id");
     }
     return(new MatchDto {
         Match = MatchFactory.GenerateMath(id), WaitingTime = 0
     });
 }
Example #15
0
        public void JoinGame_MatchListIsEmpty_CreatesNewMatch()
        {
            var playerId = Guid.NewGuid();
            var type     = GameType.TicTacToe;
            var expected = MatchFactory.CreateNewMatch(type, playerId);
            var result   = _service.JoinGame(type, playerId);

            Assert.Equal(expected.gameType, result.gameType);
            Assert.Equal(expected.operationState, result.operationState);
            Assert.Equal(expected.players, result.players);
        }
        public void CanCreateMatch()
        {
            //Arrange
            var p1Id = Guid.NewGuid();
            var p2Id = Guid.NewGuid();

            //Act
            var match = MatchFactory.Create(p1Id, p2Id);

            //Assert
            Assert.Equal(p1Id, match.PlayerOneId);
        }
Example #17
0
        public void MatchNumber_ReturnInstanceOfRegonClass()
        {
            IList <IMatchNumber> numbersType = new List <IMatchNumber>();

            numbersType.Add(new MatchRegonNumber());
            numbersType.Add(new MatchNIPNumber());

            MatchFactory match = MakeMatchClass();

            NumberBase number = match.MatchNumber(numbersType, "432522830");

            Assert.IsInstanceOf(typeof(RegonNumber), number);
        }
Example #18
0
        public void MatchNumber_NIPNumber_UEFormatNumber()
        {
            IList <IMatchNumber> numbersType = new List <IMatchNumber>();

            numbersType.Add(new MatchNIPNumber());
            numbersType.Add(new MatchRegonNumber());

            MatchFactory match = MakeMatchClass();

            NumberBase number = match.MatchNumber(numbersType, "PL6834322313");

            Assert.IsInstanceOf(typeof(NIPNumber), number);
        }
Example #19
0
        public void MatchNumber_InValidNumber_ReturnNull()
        {
            IList <IMatchNumber> numbersType = new List <IMatchNumber>();

            numbersType.Add(new MatchNIPNumber());
            numbersType.Add(new MatchRegonNumber());

            MatchFactory match = MakeMatchClass();

            NumberBase number = match.MatchNumber(numbersType, "683432");

            Assert.AreSame(null, number);
        }
Example #20
0
        public void MatchNumber_NIPNumber_RemoveDashInNumber()
        {
            IList <IMatchNumber> numbersType = new List <IMatchNumber>();

            numbersType.Add(new MatchNIPNumber());
            numbersType.Add(new MatchRegonNumber());

            MatchFactory match = MakeMatchClass();

            NumberBase number = match.MatchNumber(numbersType, "683-432-23-13");

            Assert.IsInstanceOf(typeof(NIPNumber), number);
        }
Example #21
0
        public void ChangeHomeAndAway()
        {
            Player playerOne = new Player(new Name("PlayerOne"), new Identification(1));
            Player playerTwo = new Player(new Name("PlayerTwo"), new Identification(2));
            Match  match     = new Match(playerOne, playerTwo);

            var matchFactory = new MatchFactory();

            matchFactory.ChangeHomeAndAway(match);

            Assert.AreEqual(match.PlayerOne, playerTwo);
            Assert.AreEqual(match.PlayerTwo, playerOne);
        }
Example #22
0
        public void Start_PlannedMatchFieldAlreadyBusy_ShouldThrowArgumentException()
        {
            var gameStep     = CreateGameStepStub1();
            var team1        = CreateTeamStub1();
            var team2        = CreateTeamStub2();
            var matchSetting = CreateMatchSettingStub1();
            var field        = CreateFieldStub1();
            var match        = new MatchFactory().Create(Helper.GetMock(gameStep), Helper.GetMock(team1), Helper.GetMock(team2), Helper.GetMock(matchSetting));

            field.SetupGet(_ => _.IsAllocated).Returns(true);
            field.SetupGet(_ => _.MatchInProgess).Returns(Helper.CreateMock <IMatch>("00000000-0000-0000-0000-000000000010").Object);

            Assert.Throws <ArgumentException>(() => match.Start(field.Object));
        }
Example #23
0
			public FormatRule(MatchFactory regexes, XElement format) {
				Regexes = regexes;

				FontFamily = (string)format.Element("FontFamily");
				FontSize = (float?)format.Element("FontSize");
				Bold = (bool?)format.Element("Bold");
				Italic = (bool?)format.Element("Italic");
				AllCaps = (bool?)format.Element("AllCaps");
				SmallCaps = (bool?)format.Element("SmallCaps");

				var alignment = (string)format.Element("Alignment");
				if (alignment != null)
					Alignment = (MsoParagraphAlignment)Enum.Parse(typeof(MsoParagraphAlignment),
																  "msoAlign" + alignment, ignoreCase: true);
			}
Example #24
0
        public void Start_PlannedMatchTeam2AlreadyInGame()
        {
            var gameStep   = CreateGameStepStub1();
            var team1      = CreateTeamStub1();
            var team2      = CreateTeamStub2();
            var matchTeam2 = CreateMatchStub1();

            team2.SetupGet(_ => _.CurrentMatch).Returns(matchTeam2.Object);
            var matchSetting = CreateMatchSettingStub1();
            var field        = CreateFieldStub1();

            field.SetupGet(_ => _.IsAllocated).Returns(false);
            var match = new MatchFactory().Create(Helper.GetMock(gameStep), Helper.GetMock(team1), Helper.GetMock(team2), Helper.GetMock(matchSetting));

            Assert.Throws <NotSupportedException>(() => match.Start(field.Object));
        }
Example #25
0
        public void CheckInputOfMatchTest()
        {
            Player playerOne = new Player(new Name("PlayerOne"), new Identification(1));
            Player playerTwo = new Player(new Name("PlayerTwo"), new Identification(2));
            Match  match     = new Match(playerOne, playerTwo);

            var  matchFactory       = new MatchFactory();
            bool checkedInputTrue   = matchFactory.CheckInputOfMatch("4 2");
            bool checkedInputFalse  = matchFactory.CheckInputOfMatch("a 1");
            bool checkedInputFalse2 = matchFactory.CheckInputOfMatch("12");
            bool checkedInputFalse3 = matchFactory.CheckInputOfMatch("1 a");

            Assert.AreEqual(true, checkedInputTrue);
            Assert.AreEqual(false, checkedInputFalse);
            Assert.AreEqual(false, checkedInputFalse2);
            Assert.AreEqual(false, checkedInputFalse3);
        }
Example #26
0
        public IDataContent <Company> GetData()
        {
            IDataContent <Company> dataContent = new CompanyContent();

            dataContent.Headers = Headers;

            MatchFactory factory = new MatchFactory();

            NumberBase concreteNumberType = factory.MatchNumber(NumbersToCheck, Number);

            if (concreteNumberType != null && concreteNumberType.IsValid(Number))
            {
                try
                {
                    Number = concreteNumberType.FormatNumber(Number);
                    ISession session = NHibernateManager.BeginSessionTransaction();
                    dataContent.Data = CompanyDAO.Instance.GetCompanyDataByNumber(Number, session);
                    NHibernateManager.CloseSessionTransaction();
                    dataContent.Status = StatusEnum.Valid.ToString();
                    if (dataContent.Data == null)
                    {
                        dataContent.Message = "Brak danych";
                        dataContent.Status  = StatusEnum.Error.ToString();
                    }
                }
                catch (Exception e)
                {
                    NHibernateManager.CloseSessionTransaction();
                    throw new Exception(e.Message);
                }
            }
            else
            {
                dataContent.Message = "Podany numer jest niepoprawny";
                dataContent.Status  = StatusEnum.Error.ToString();
            }
            LogManager log = new LogManager();

            log.LogData(dataContent);

            return(dataContent);
        }
        public List <Match> DrawNextRound(List <Team> winnersPreviousRound)
        {
            var matchesNextRound = new List <Match>();

            winnersPreviousRound.Shuffle();

            int numberOfMatches = winnersPreviousRound.Count / 2;
            int teamIndex       = 0;

            for (int i = 0; i < numberOfMatches; i++)
            {
                var homeTeam = winnersPreviousRound[teamIndex];
                var awayTeam = winnersPreviousRound[teamIndex + 1];
                var match    = MatchFactory.CreateMatch(homeTeam, awayTeam);
                matchesNextRound.Add(match);
                teamIndex += 2;
            }

            return(matchesNextRound);
        }
        public List <Match> GenerateMatches(Guid competitionId)
        {
            var compPlayers = ListPlayers(competitionId);

            if (compPlayers.Count % 2 != 0)
            {
                return(null);
            }
            for (var i = 0; i < compPlayers.Count; i += 2)
            {
                //if (i % 2 != 0) continue;
                var playerOne = compPlayers[i];
                var playerTwo = compPlayers[i + 1];

                var match = MatchFactory.Create(playerOne.PartyId, playerTwo.PartyId);

                _context.Add(match);
                _context.SaveChanges();
            }
            return(_context.Competitions.FirstOrDefault(x => x.CompetitionId == competitionId).Matches);
        }
Example #29
0
        public void Post(CreateTeamsAndMatchesRequest request)
        {
            using (var transaction = this.Db.OpenTransaction(IsolationLevel.ReadCommitted))
            {
                long competitionId = request.CompetitionId;

                var teamInscriptions = this.Db.Select(Db.From <TeamInscription>().Where(p => p.CompetitionId == competitionId && p.AssignedLeagueId != null));
                var teams            = teamInscriptions.CreateTeams();

                teams.ForEach(team => team.Id = (int)this.Db.Insert(team, true));

                var matches = MatchFactory.CreateLeagueMatches(teams, leagueId => Db.SingleById <League>(leagueId).LeagueMatchCreationMode).ToList();

                this.Db.InsertAll(matches);

                var leagueIds = matches.Select(s => s.LeagueId).Distinct().ToList();
                leagueIds.ForEach(leagueId => StandingsCalculator.Calculate(this.Db, leagueId));

                transaction.Commit();
            }
        }
Example #30
0
        public void JoinGame_MatchListIsNotEmpty_PlayerJoinsMatch()
        {
            var playerOne     = Guid.NewGuid();
            var playerTwo     = Guid.NewGuid();
            var type          = GameType.TicTacToe;
            var newMatch      = MatchFactory.CreateNewMatch(type, playerOne);
            var expectedMatch = new MatchState
            {
                id            = newMatch.id,
                gameStartTime = newMatch.gameStartTime,
                gameType      = type,
                players       = new List <Guid> {
                    playerOne, playerTwo
                },
                inGameState = new TicTacToeState
                {
                    firstPlayer  = playerOne,
                    secondPlayer = playerTwo,
                    board        = new List <PlayerMark>
                    {
                        PlayerMark.Empty, PlayerMark.Empty, PlayerMark.Empty,
                        PlayerMark.Empty, PlayerMark.Empty, PlayerMark.Empty,
                        PlayerMark.Empty, PlayerMark.Empty, PlayerMark.Empty,
                    },
                },
                operationState = GameOperationState.InProgress,
            };

            _onlineMatchList.Add(newMatch);
            var result = _service.JoinGame(type, playerTwo);

            Assert.Equal(expectedMatch.id, result.id);
            Assert.Equal(expectedMatch.gameStartTime, result.gameStartTime);
            Assert.Equal(expectedMatch.gameType, result.gameType);
            Assert.Equal(expectedMatch.players, result.players);
            Assert.Equal(expectedMatch.inGameState.firstPlayer, result.inGameState.firstPlayer);
            Assert.Equal(expectedMatch.inGameState.secondPlayer, result.inGameState.secondPlayer);
            Assert.Equal(expectedMatch.inGameState.board, result.inGameState.board);
            Assert.Equal(expectedMatch.operationState, result.operationState);
        }
Example #31
0
        public MatchState JoinGame(GameType matchType, Guid playerId)
        {
            var gameList = _onlineMatches
                           .FindAll(x => x.gameType == matchType)
                           .FindAll(x => x.operationState == GameOperationState.WaitingForPlayers);
            MatchState matchState = null;

            if (gameList.Count == 0)
            {
                matchState = MatchFactory.CreateNewMatch(matchType, playerId);
                _onlineMatches.Add(matchState);
            }
            else
            {
                matchState = gameList.First();
                matchState.players.Add(playerId);
                matchState.inGameState.secondPlayer = playerId;
                matchState.operationState           = GameOperationState.InProgress;
            }

            return(matchState);
        }