public void AddRemoveTest() { Team t = new Team("FirstTeam", "FirstProject"); t.Add("Maria", "Sharapova", 33, "Apple"); t.Add("Vladimir", "Klichko", 25, "Microsoft"); t.Add("Max", "Korzh", 28, "Google"); t.Remove(1); // а если передать 0? Assert.AreEqual(2, t.CountMembers); }
public void HumanTeam_TestAdd() { var count = _humanTeam.Fighters.Count; Assert.AreEqual(2, count); var newFighter = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1); _humanTeam.Add(newFighter); count = _humanTeam.Fighters.Count; Assert.AreEqual(3, count); Assert.IsTrue(_humanTeam.Contains(newFighter)); }
void Start() { this.board.LoadLayout(layout); var t1p1 = this.board.Spawn(playerPrefab, new BoardPosition(0, -2)); var t1p2 = this.board.Spawn(playerPrefab, new BoardPosition(-2, 0)); var t2p1 = this.board.Spawn(playerPrefab, new BoardPosition(0, 2)); var t2p2 = this.board.Spawn(playerPrefab, new BoardPosition(2, 0)); team1.Add(t1p1.gameObject); team1.Add(t1p2.gameObject); team2.Add(t2p1.gameObject); team2.Add(t2p2.gameObject); DoneLoadingEvent?.Invoke(); }
public void LoadTeam(dynamic Item) { var Counter = 0; Team.Clear(); foreach (var Item2 in Item.Value) { string Name = Item2.PokemonName; string PokemonArt = Item2.PokemonArt; int LivePoints = Item2.LivePoints; int MaxLivePoints = Item2.MaxLivePoints; string Typ1 = Item2.Typ1; string Typ2 = Item2.Typ2; int Initiative = Item2.Initiative; int Strength = Item2.Strength; int Defence = Item2.Defence; Team.Add(new Pokemon(Name, PokemonArt, LivePoints, MaxLivePoints, Typ1, Typ2, Initiative, Strength, Defence, new Attack(), new Attack(), new Attack(), new Attack())); for (var i = 0; i < Item2.PokeAttackList.Count; i++) { string AttackName1 = Item2.PokeAttackList[i].AttackName; string Attacktyp1 = Item2.PokeAttackList[i].Attacktyp; int Damage1 = Item2.PokeAttackList[i].Damage; var A = new Attack(AttackName1, Attacktyp1, Damage1); Team[Counter].PokeAttackList[i] = A; } Counter++; } }
public override Task DivideLine(string line) { Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} started job."); if (line.Contains(" LOGIN: "******" LOGIN MISC: ")) { LoginMisc.Add(line); } if (line.Contains(" QUIT MISC: ")) { QuitMisc.Add(line); } if (line.Contains("TC: [Civilian Workers]")) { Team.Add(line); } if (line.Contains(" Hosted Civilian event; ")) { Events.Add(line); } if (line.Contains(" created a quiz of '")) { Quizzes.Add(line); } Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} ended job."); return(Task.CompletedTask); }
public void RandomEnemy(bool IsSingelPokemon) { int RadomNumber = Random.Next(0, 5); if (IsSingelPokemon) { RadomNumber = 0; } _Team.Clear(); for (int i = 0; i <= 5; i++) { if (RadomNumber < 6) { int Rand = Random.Next(1, Generate.DictionaryOfPokemons.Count); Console.WriteLine(Generate.DictionaryOfPokemons.Count); Console.WriteLine(Rand); _Team.Add(new Pokemon(Generate.DictionaryOfPokemons.ElementAt(Rand).Value)); Console.WriteLine(_Team[i].ToString()); } else { Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); } RadomNumber++; } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //read values p.FirstName = txtFirstName.Text; p.LastName = txtLastName.Text; p.DateOfBirth = DateTime.Parse(txtDateOfBirt.Text); p.HeightInInches = Int32.Parse(txtEight.Text); p.WeightInPounds = Int32.Parse(txtWeight.Text); //save player Team t = (Team)cmbTeams.SelectedItem; if (t.Add(t.Id)) { MessageBox.Show("Added!"); } p.Team = t.Id; p.Add(); MessageBox.Show("Added!"); //clean txbox txtFirstName.Text = ""; txtLastName.Text = ""; txtDateOfBirt.Text = ""; txtEight.Text = ""; txtWeight.Text = ""; }
void HandleCreate(Player p, string[] args, CommandData data) { if (!CheckExtraPerm(p, data, 1)) { return; } Team team = p.Game.Team; if (team != null) { p.Message("You need to leave your current team before you can create one."); return; } if (args.Length == 1) { p.Message("You need to provide the name of the new team."); return; } team = Team.Find(args[1]); if (team != null) { p.Message("There is already an existing team with that name."); return; } if (args[1].Length > 8) { p.Message("Team names must be 8 characters or less."); return; } team = new Team(args[1], p.name); p.Game.Team = team; p.SetPrefix(); Team.Add(team); Team.SaveList(); Chat.MessageFrom(p, "λNICK %Screated the &a" + args[1] + " %Steam"); }
// Use this for initialization void Start() { GameObject go = new GameObject(); Team team = go.AddComponent <Team> (); team.AddTo(this.transform); team.Formation.AddPoint(new Vector3(2, 1, 2)); team.Formation.AddPoint(new Vector3(2, 1, 4)); team.Formation.AddPoint(new Vector3(2, 1, 6)); team.Formation.AddPoint(new Vector3(4, 1, 2)); team.Formation.AddPoint(new Vector3(4, 1, 4)); team.Formation.AddPoint(new Vector3(4, 1, 6)); team.Formation.AddPoint(new Vector3(6, 1, 2)); team.Formation.AddPoint(new Vector3(6, 1, 4)); team.Formation.AddPoint(new Vector3(6, 1, 6)); team.Add <Unit> (CreateRole(new Vector3(10, 1, 2))); team.Add <Unit> (CreateRole(new Vector3(-40, 1, 1))); team.Add <Unit> (CreateRole(new Vector3(-40, 1, 40))); team.Add <Unit> (CreateRole(new Vector3(10, 1, 22))); team.Add <Unit> (CreateRole(new Vector3(30, 1, 2))); team.Add <Unit> (CreateRole(new Vector3(10, 1, 42))); team.Add <Unit> (CreateRole(new Vector3(10, 1, 12))); team.BuildUp(); _team = team; }
static void Main(string[] args) { var currentPlayer = new Player(" Pesho", 75, 85, 84, 92, 67); var currentTeam = new Team("Pesho"); currentTeam.Add(currentPlayer); currentTeam.GetRating(); Console.ReadKey(); }
public void SetDefault() { ActivePokemon = 0; Team.Add(new Pokemon(Generate.DictionaryOfPokemons["pikatchu"])); Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); Team.Add(new Pokemon(Generate.DictionaryOfPokemons["empty"])); }
public ITeam RegisterTeam(List <IPerson> players) { var team = new Team(); foreach (var p in players) { team.Add(p); } return(team); }
public ITeam RegisterTeam(ArrayOfJugadores jugadores) { var team = new Team(); foreach (var j in jugadores.Jugadores) { var player = _playerFactory.RegisterPlayer(j); team.Add(player); } return(team); }
// Create team members and set their locations void Initialize(Point start, Point end) { Random rand = new Random(DateTime.Now.Millisecond); Id = rand.Next(); this.Team = new List <Asker>(); int num_Er = 0, num_Tegmen = 0, num_Yuzbasi = 0; int x, y; Asker soldier; for (int c = 0; c < Size; c++) { soldier = null; while (soldier == null) { double roll = rand.NextDouble(); // 20% Yuzbasi if (.0 < roll && roll <= .2 && num_Yuzbasi < 1) { soldier = new Yuzbasi(); num_Yuzbasi += 1; } // 20% Tegmen if (.2 < roll && roll <= .4 && num_Tegmen < 2) { soldier = new Tegmen(); num_Tegmen += 1; } // 60% Er if (.4 < roll && roll <= 1) { soldier = new Er(); num_Er += 1; } } // Set initial location while (soldier.Location == null) { x = rand.Next(start.X, end.X); y = rand.Next(start.Y, end.Y); Map.Mapping[x, y].MoveIn(soldier); } Map.Log.WriteLine(String.Format("{0} - {1} at {2}", (c + 1), soldier, soldier.Location)); Team.Add(soldier); soldier.Team = this; } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //read values t.Id = txtId.Text; t.City = txtCity.Text; t.Nickname = txtNickname.Text; //save team Division d = (Division)cmbDivision.SelectedItem; if (t.Add(d.Id)) { MessageBox.Show("Added!"); } }
public void HumanTeam_TeamDefeatedCorrectlyFiresAfter_AddingNewFighters() { _logger.Subscribe(EventType.TeamDefeated, _humanTeam); _humanTeam.Add((TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1)); var fighters = _humanTeam.Fighters; var count = fighters.Count; var i = 0; for (; i < count - 1; ++i) { fighters[i].PhysicalDamage(fighters[i].MaxHealth); Assert.AreEqual(0, _logger.Logs.Count); } fighters[i].PhysicalDamage(fighters[i].MaxHealth); var logs = _logger.Logs; Assert.AreEqual(1, logs.Count); Assert.AreEqual(EventType.TeamDefeated, logs[0].Type); }
public IEnumerable <Team> Create(IEnumerable <User> leaders, IEnumerable <User> members) { if (leaders is null) { throw new ArgumentNullException(nameof(leaders)); } if (members is null) { throw new ArgumentNullException(nameof(members)); } if (leaders.AnyElementInBothCollections(members)) { throw new ArgumentException("Leader cannot be a member in the same time!"); } if (leaders.Any() == false) { return(Enumerable.Empty <Team>()); } List <Team> teams = new List <Team>(); foreach (var leader in leaders) { Team team = new Team(leader); teams.Add(team); } var membersCopy = members.ToList(); while (membersCopy.Any()) { foreach (var team in teams) { if (membersCopy.Any()) { User member = membersCopy.Random(); membersCopy.Remove(member); team.Add(member); } } } return(teams); }
/// <summary> /// Überprüft alle Felder auf Korrektheit, anschließend entweder Fehlerausgabe oder speichern der Daten /// Author: Antonios Fesenmeier /// </summary> /// <param name="button"></param> private void pbSave_Click(Button button) { _Validator.clearSB(); // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden! CheckForm(); if (_IsValid == false) { MessageBox.Show(_Validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK, MessageBoxImage.Hand); } else { try { var title = cbTitle.SelectedItem as DataModel.Title; var teamFunction = cBFunction.SelectedItem as TeamFunction; var firstName = txtFirstName.Text; var lastName = txtLastName.Text; var street = txtStreet.Text; var zipCode = int.Parse(txtZipCode.Text); var city = txtCity.Text; var dateOfBirth = (DateTime)dpBirthday.SelectedDate; var mobileNo = txtMobileNo1.Text; var phoneNo = txtTelNo1.Text; var email = txtEMail1.Text; var isFormLetterAllowed = (bool)chBIsFormletterAllowed.IsChecked; var teamId = Team.Add(title.TitleID, teamFunction.TeamFunctionID, firstName, lastName, street, zipCode, city, dateOfBirth, mobileNo, phoneNo, email, isFormLetterAllowed); if (teamId > 0) { KPage pageTeamAdministration = new KöTaf.WPFApplication.Views.pTeamAdministration(); SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "teamAdministration"), pageTeamAdministration); } else { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "saveDataRecord")); } } catch { MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common")); } } _Validator.clearSB(); }
public void AddTeamAndMembers(string teamName, Color teamColour, IEnumerable <ITeamBased> members) { // Create new team Team team = new Team() { Name = teamName, Colour = teamColour }; // Cache it Teams.Add(team); // Add members to team foreach (ITeamBased member in members) { team.Add(member); } }
private void AddPlayerInTeam(string[] input) { Queue <string> line = new Queue <string>(input); try { string teamName = line.Dequeue(); Team team = catalogTeam.Take(teamName); Player player = CreatePlayer(line); if (player != null) { team.Add(player); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
void FilterItems(string filter) { var filteredItems = source.Where(person => person.Name.ToLower().Contains(filter.ToLower())).ToList(); foreach (var person in source) { if (!filteredItems.Contains(person)) { Team.Remove(person); } else { if (!Team.Contains(person)) { Team.Add(person); } } } }
public Team GetTeam(Player player) { Team team = null; if (!teams.TryGetValue(player.Team, out team)) { team = new Team(); team.name = player.Team; team.Add(player); teams.Add(team.name, team); try { RefreshTeams(); } catch { } } return(team); }
private void LayEgg(Team ownTeam, IOutput output) { var typeIndex = ChanceService.WhichEventOccurs(Globals.EggMagicTypes.Length); var type = Globals.EggMagicTypes[typeIndex]; var prefix = "a"; if (type == MagicType.Ice) { prefix += "n"; } var egg = (Egg)FighterFactory.GetFighter(FighterType.Egg, 1, null, type); egg.Killed += OnEggKilled; ownTeam.Add(egg); _eggs.Add(egg); output.WriteLine($"{DisplayName} laid {prefix} {egg.BaseName}!"); }
public void EnemyTeam_TestAdd() { var count = _enemyTeam.Fighters.Count; Assert.AreEqual(2, count); var newFighter = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1); _enemyTeam.Add(newFighter); count = _enemyTeam.Fighters.Count; Assert.AreEqual(3, count); Assert.IsTrue(_enemyTeam.Contains(newFighter)); }
/// <summary> /// Loads a team from xml. /// </summary> /// <returns>Team</returns> /// <param name="filePath">String</param> private Team LoadTeamFromXML(string filePath) { XmlDocument doc = new XmlDocument(); doc.Load(filePath); XmlNode root = doc.FirstChild; if (root.HasChildNodes) { foreach (XmlNode xn in root.ChildNodes) { if (xn.Name == "Info") { Dictionary <string, string> infoAttributes = new Dictionary <string, string>(); foreach (XmlNode cn in xn.ChildNodes) { infoAttributes.Add(cn.Name, cn.InnerText); } ret = new Team(infoAttributes["Name"], infoAttributes["Mascot"], Int32.Parse(infoAttributes["Year"]), infoAttributes["FieldName"], Int32.Parse(infoAttributes["FieldCapacity"])); ret.Stats.AddStatSheet(StatTypes.WonLoss, new WonLossRecord(ret)); } if (xn.Name == "TeamOffense") { Dictionary <string, string> offenseAttributes = new Dictionary <string, string>(); foreach (XmlNode cn in xn.ChildNodes) { offenseAttributes.Add(cn.Name, cn.InnerXml); } ret.TeamOffense = new Offense(ret, Int32.Parse(offenseAttributes["OffensiveLineBonus"]), Convert.ToBoolean(Int32.Parse(offenseAttributes["HasAllWeatherPenalty"]))); } if (xn.Name == "Roster") { foreach (XmlNode cn in xn.ChildNodes) { if (cn.Name == "Offense") { int playerId = 1; foreach (XmlNode ccn in cn.ChildNodes) { if (ccn.Name == "Player") { Player p = null; PlayerSkills ps = null; Dictionary <string, string> playerSkillAttributes = new Dictionary <string, string>(); Dictionary <string, string> playerAttributes = new Dictionary <string, string>(); foreach (XmlNode cccn in ccn.ChildNodes) { if (cccn.Name == "PlayerSkills") { foreach (XmlNode ccccn in cccn.ChildNodes) { playerSkillAttributes.Add(ccccn.Name, ccccn.InnerText); } } else { playerAttributes.Add(cccn.Name, cccn.InnerText); } } //Get enums Race race = Race.Black; Grade grade = Grade.Senior; Endurance endurance = Endurance.Superb; p = new Player(ret, playerId.ToString(), playerAttributes["LastName"], playerAttributes["FirstName"], Int32.Parse(playerAttributes["Age"]), Int32.Parse(playerAttributes["Height"]), Int32.Parse(playerAttributes["Weight"]), race, grade, endurance, playerAttributes["Number"], Int32.Parse(playerAttributes["Fumble"])); try { ps = new PlayerSkills(playerSkillAttributes["Run"], playerSkillAttributes["Receive"], playerSkillAttributes["KickReturn"], Int32.Parse(playerSkillAttributes["Pass"]), Int32.Parse(playerSkillAttributes["Kick"]), playerSkillAttributes["Punt"]); p.AddPlayerSkills(ps); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } ret.Add(p); playerId++; } } Player[] players = ret.ToArray(); ret.TeamOffense.SetPosition("QB", players[0]); ret.TeamOffense.SetPosition("TB", players[1]); ret.TeamOffense.SetPosition("FB", players[2]); ret.TeamOffense.SetPosition("TE", players[3]); ret.TeamOffense.SetPosition("WR1", players[4]); ret.TeamOffense.SetPosition("WR2", players[5]); ret.TeamOffense.SetPosition("K", players[6]); ret.TeamOffense.SetPosition("P", players[6]); ret.TeamOffense.SetPosition("KR", players[1]); ret.TeamOffense.InitAvailableReceivers(); } else { Dictionary <string, int> defenseAttributes = new Dictionary <string, int>(); Dictionary <string, List <int> > defenseResults = new Dictionary <string, List <int> >(); foreach (XmlNode ccn in cn.ChildNodes) { if (ccn.Name == "DefenseResults") { foreach (XmlNode cccn in ccn.ChildNodes) { char[] results = cccn.InnerText.ToCharArray(); List <int> resultArray = new List <int>(); foreach (char c in results) { resultArray.Add((int)Char.GetNumericValue(c)); } defenseResults.Add(cccn.Name, resultArray); } } else { defenseAttributes.Add(ccn.Name, Int32.Parse(ccn.InnerText)); } } ret.TeamDefense = new Defense(ret, -defenseAttributes["RunPenalty"], -defenseAttributes["MaxRunLoss"], -defenseAttributes["MaxSackLoss"], -defenseAttributes["PassRushRating"], defenseAttributes["BonusRunPenalty"]); LoadDefenseResults(defenseResults); //ret.TeamDefense.InitCarryDefense(new CarryPlayResult[] { CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain }); //ret.TeamDefense.InitKickoffReturnDefense(new CarryPlayResult[] { CarryPlayResult.Loss, CarryPlayResult.Loss, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NoGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain, CarryPlayResult.NormalGain }); //ret.TeamDefense.InitPassDefense(new PassPlayResult[] { PassPlayResult.Sack, PassPlayResult.Sack, PassPlayResult.Sack, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Incomplete, PassPlayResult.Interception, PassPlayResult.Interception, PassPlayResult.Interception, PassPlayResult.Interception }); } } } } } return(ret); }
static void Main(string[] args) { List <Team> teams = new List <Team>(); while (true) { string[] tokens = Console.ReadLine().Split(";"); if (tokens[0] == "END") { break; } switch (tokens[0]) { case "Team": if (tokens.Length == 2) { if (tokens[1] == " " || tokens[1] == "") { Console.WriteLine("A name should not be empty."); } else { Team t = new Team(tokens[1]); teams.Add(t); } } break; case "Add": if (tokens.Length == 8) { string teamName = tokens[1]; string personName = tokens[2]; int endurance = Convert.ToInt32(tokens[3]); int sprint = Convert.ToInt32(tokens[4]); int dribble = Convert.ToInt32(tokens[5]); int passing = Convert.ToInt32(tokens[6]); int shooting = Convert.ToInt32(tokens[7]); if (teamName == "" || teamName == " " || personName == "" || personName == " ") { Console.WriteLine("A name should not be empty."); } else if (endurance < 0 || endurance > 100) { Console.WriteLine("Endurance should be between 0 and 100."); } else if (sprint < 0 || sprint > 100) { Console.WriteLine("Sprint should be between 0 and 100."); } else if (dribble < 0 || dribble > 100) { Console.WriteLine("Dribble should be between 0 and 100."); } else if (passing < 0 || passing > 100) { Console.WriteLine("Passing should be between 0 and 100."); } else if (shooting < 0 || shooting > 100) { Console.WriteLine("Shooting should be between 0 and 100."); } else { Team team = null; team = teams.Find(t => t.Name == teamName); if (team != null) { Player player = new Player(personName, endurance, sprint, dribble, passing, shooting); team.Add(player); } else { Console.WriteLine($"Team {teamName} does not exist."); } } } break; case "Remove": if (tokens.Length == 3) { Team team = null; Player player = null; team = teams.Find(t => t.Name == tokens[1]); if (team != null) { player = team.Players.Find(p => p.Name == tokens[2]); if (player != null) { team.Remove(player.Name); } else { Console.WriteLine($"Player {tokens[2]} is not in {team.Name} team."); } } else { Console.WriteLine($"Team {tokens[1]} does not exist."); } } break; case "Rating": if (tokens.Length == 2) { Team team = null; team = teams.Find(t => t.Name == tokens[1]); if (team != null) { Console.WriteLine(team.Rating); } else { Console.WriteLine($"Team {team.Name} does not exist."); } } break; } } Console.ReadKey(); }
public override Task DivideLine(string line) { Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} started job."); if (line.Length < 5) { Console.WriteLine($"{DateTime.Now} Line too small, skipped."); } else if (line.Contains(" TC: ")) { Team.Add(line); } else if (line.Contains(" MC LS:")) { Main.Add(line); } else if (line.Contains(" MC LV:")) { Main.Add(line); } else if (line.Contains(" MC SF:")) { Main.Add(line); } else if (line.Contains(" (ADVERT) ")) { Advert.Add(line); } else if (line.Contains(" (MYC ")) { Country.Add(line); } else if (line.Contains(" (sup) ")) { Support.Add(line); } else if (line.Contains(" (cad) ")) { Cad.Add(line); } else if (line.Contains(" KILL: ")) { KillDeaths.Add(line); } else if (line.Contains(" DEATH: ")) { KillDeaths.Add(line); } else if (line.Contains(" killed themselves via command")) { KillDeaths.Add(line); } else if (line.Contains(" GrC (")) { Group.Add(line); } else if (line.Contains(" SC (")) { Squad.Add(line); } else if (line.Contains(" UC (")) { Unit.Add(line); } else if (line.Contains(" (alliance) ")) { Group.Add(line); } else if (line.Contains(" SMS from ")) { Sms.Add(line); } else if (line.Contains(" SMS to ")) { Sms.Add(line); } else if (line.Contains(" T$ ")) { TTransactions.Add(line); if (line.Contains("(CITphoneTran")) { PlayerTransactions.Add(line); } else if (line.Contains("CIThit")) { Hit.Add(line); } } else if (line.Contains(" G$ ")) { GTransactions.Add(line); if (line.Contains("(CITphoneTran")) { PlayerTransactions.Add(line); } else if (line.Contains("CIThit")) { Hit.Add(line); } } else if (line.Contains(" BT: ")) { PlayerTransactions.Add(line); } else if (line.Contains(" (FMSG) ")) { Fmsg.Add(line); } else if (line.Contains(" (LOCF)[")) { Fmsg.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" (LOC)[")) { Local.Add(line); } else if (line.Contains(" LC ")) { Emergency.Add(line); } else if (line.Contains(" GroupPromotion: ")) { Group.Add(line); } else if (line.Contains(" modify ")) { Inventory.Add(line); } else if (line.Contains(" Crafting ")) { Inventory.Add(line); } else if (line.Contains(") sold ")) { Trading.Add(line); } else if (line.Contains(" (Bought ")) { Trading.Add(line); } else if (line.Contains(" NC ")) { JoinQuit.Add(line); } else if (line.Contains(" LOGIN MISC: ")) { JoinQuit.Add(line); } else if (line.Contains(" LOGIN: "******" LOGIN WEPS: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT MISC: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT WEPS: ")) { JoinQuit.Add(line); } else if (line.Contains(" QUIT WEPS: ")) { JoinQuit.Add(line); } else { Other.Add(line); } Console.WriteLine($"{DateTime.Now} Thread {Thread.CurrentThread.ManagedThreadId} ended job."); return(Task.CompletedTask); }
static void Main(string[] args) { Random random = new Random(); Team team1 = new Team("Шахтер", new Coach("Виталий", random.Next(5, 16) / 10.0)); Team team2 = new Team("Днепр", new Coach("Славик", random.Next(5, 16) / 10.0)); Referi.Preferences preferences = Referi.Preferences.Neutral; switch (random.Next(0, 3)) { case 1: preferences = Referi.Preferences.ForFirst; break; case 2: preferences = Referi.Preferences.ForSecond; break; } Referi referi = new Referi("Богдан", preferences); Console.WriteLine("Первая команда:" + team1.Name); team1.Coach.GetInfo(); for (int i = 1; i <= 11; i++) { team1.Add(new Soccer("Игрок" + i.ToString(), random.Next(20, 40), random.Next(0, 101))); team1.Soccers.Last().GetInfo(); } Console.WriteLine("Мастерство:" + team1.Skill); Console.WriteLine(); Console.WriteLine("Вторая команда:" + team2.Name); team2.Coach.GetInfo(); for (int i = 1; i <= 11; i++) { team2.Add(new Soccer("Игрок" + i.ToString(), random.Next(20, 40), random.Next(0, 101))); team2.Soccers.Last().GetInfo(); } Console.WriteLine("Мастерство:" + team2.Skill); Console.WriteLine(); Game game = new Game(team1, team2, referi); game.Referi.GetInfo(); Console.WriteLine(); Console.WriteLine("История:"); Game.GetGames(); Console.WriteLine(); Console.WriteLine("Сортировка по алфавиту команды " + team1.Name); foreach (var i in team1.GetByName()) { i.GetInfo(); } Console.WriteLine(); Console.WriteLine("Сортировка по алфавиту команды " + team2.Name); foreach (var i in team2.GetByName()) { i.GetInfo(); } Console.WriteLine(); Console.WriteLine("Сортировка по мастерству команды " + team1.Name); foreach (var i in team1.GetBySkill()) { i.GetInfo(); } Console.WriteLine(); Console.WriteLine("Сортировка по мастерству команды " + team2.Name); foreach (var i in team2.GetBySkill()) { i.GetInfo(); } Console.WriteLine(); game.Start(); Console.ReadKey(); }
// reducer public static GameSlice GameReducer(GameSlice oldState, IAction action) { GameSlice newState = (GameSlice)oldState.MemberwiseClone(); switch (action) { case AddPlayer a: { // TODO: HARSHA: revisit this, don't think we're copying state properly Team?team = newState.Teams.Find((team) => team.Equals(a.Team)); team?.Add(new Player(a.Name, team)); return(newState); } case StartGame a: { newState.Metadata = a.Metadata; newState.Status = GameStatus.IN_PROGESS; for (int i = 0; i < a.Metadata.NumTeams; ++i) { newState.Teams.Add(new Team(a.Metadata, $"Team {i + 1}")); } newState.Questions.Add(new Question(a.Metadata)); return(newState); } case AwardPower a: { newState.CurrentQuestion.AwardPower(a.Player, newState.Teams); return(newState); } case AwardTossup a: { newState.CurrentQuestion.AwardTossup(a.Player, newState.Teams); return(newState); } case AwardNeg a: { newState.CurrentQuestion.AwardNeg(a.Player); return(newState); } case AwardBonus a: { newState.CurrentQuestion.AwardBonus(a.IsCorrect); if (newState.CurrentQuestion.QuestionStatus == QuestionStatus.COMPLETE) { newState.Questions.Add(new Question(newState.Metadata)); } return(newState); } case AwardNoAnswer a: { newState.CurrentQuestion.AwardNoAnswer(newState.Teams); newState.Questions.Add(new Question(newState.Metadata)); return(newState); } default: return(oldState); } }
public ActionResult Create(Team model) { Team.Add(model); return(RedirectToAction("Index")); }