protected virtual void ProcessRound(Streets street, IAquiredPokerRound aquiredPokerRound, IConvertedPokerPlayer convertedPlayer) { try { FoundAction = true; // Ignore returned chips (they didn't add or substract from the pot // and this action was not "done" by the player if (aquiredPokerRound[ActionCount].What != ActionTypes.U) { IConvertedPokerAction convertedAction = _actionConverter.Convert( aquiredPokerRound[ActionCount], ref Pot, ref ToCall, _aquiredHand.TotalPot); SequenceForCurrentRound.Add( _convertedActionWithId.New.InitializeWith(convertedAction, convertedPlayer.Position)); SetActionSequenceAndAddActionTo(convertedPlayer, convertedAction, street); } } catch (Exception excep) { Log.Error("Unhandled", excep); } }
public HandDealMessage(long gameNumber, Streets type, string board, double pot = 0) { GameNumber = gameNumber; Street = type; Board = board; Pot = pot; }
public override string ToString() { var sb = new StringBuilder( string.Format( "PlayerName: {0}, PokerSite: {1}, LastQueriedId: {2}\n", _playerName, _pokerSite, _lastQueriedId)); this.ToList().ForEach(statisticsSet => sb.AppendLine(statisticsSet.ToString())); sb.AppendLine("Total Counts: ") .AppendLine("Preflop: ") .AppendFormat("UnraisedPot: {0} ", TotalCountPreFlopUnraisedPot) .AppendFormat("RaisedPot: {0}", TotalCountPreFlopRaisedPot); sb.AppendLine("\nPostFlop:") .Append("Out of Position: "); for (Streets street = Streets.Flop; street <= Streets.River; street++) { sb.Append(TotalCountsOutOfPosition(street) + ", "); } sb.AppendLine() .Append("In Position: "); for (Streets street = Streets.Flop; street <= Streets.River; street++) { sb.Append(TotalCountsInPosition(street) + ", "); } return(sb.ToString()); }
void InitializeOppBIntoHeroStatistics(Streets street, int betSizeIndexCount) { var oppBIntoHeroOutOfPositionStatistics = new List <IActionSequenceStatistic> { new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroF, street, false, betSizeIndexCount), new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroC, street, false, betSizeIndexCount), new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroR, street, false, betSizeIndexCount) }; var oppBIntoHeroInPositionStatistics = new List <IActionSequenceStatistic> { new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroF, street, true, betSizeIndexCount), new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroC, street, true, betSizeIndexCount), new PostFlopActionSequenceStatistic(ActionSequences.OppBHeroR, street, true, betSizeIndexCount) }; OppBIntoHeroOutOfPosition[(int)street] = NewActionSequenceSetStatistics(new AcrossRowsPercentagesCalculator(), oppBIntoHeroOutOfPositionStatistics, _playerName, street, ActionSequences.OppB, false); OppBIntoHeroInPosition[(int)street] = NewActionSequenceSetStatistics(new AcrossRowsPercentagesCalculator(), oppBIntoHeroInPositionStatistics, _playerName, street, ActionSequences.OppB, true); }
static Streets[] Street() { Streets[] streets = new Streets[0]; try { using (StreamReader sr = new StreamReader(path)) { int count = 0; while (!sr.EndOfStream) { Array.Resize(ref streets, streets.Length + 1); string line = sr.ReadLine(); string[] arr = line.ToString().Split(' '); int[] array = new int[arr.Length - 1]; streets[count] = new Streets(); streets[count].Name = arr[0].ToString(); for (int j = 0; j < array.Length; j++) { array[j] = int.Parse(arr[j + 1]); } streets[count++].Houses = array; } } return(streets); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } }
protected virtual void ProcessPlayersForRound(Streets street, int fromPlayer, int toPlayer) { if (fromPlayer <= toPlayer) { for (int playerIndex = fromPlayer; playerIndex <= toPlayer; playerIndex++) { // Check if non empty bettinground for that player exists in the current round IAquiredPokerPlayer aquiredPlayer = _aquiredHand[playerIndex]; if (aquiredPlayer.Count > (int)street && aquiredPlayer[street].Actions.Count > ActionCount) { ProcessRound(street, aquiredPlayer[street], _convertedHand[playerIndex]); } } } else { // Headsup Postflop for (int playerIndex = fromPlayer; playerIndex >= toPlayer; playerIndex--) { // Check if non empty bettinground for that player exists in the current round IAquiredPokerPlayer aquiredPlayer = _aquiredHand[playerIndex]; if (aquiredPlayer.Count > (int)street && aquiredPlayer[street].Actions.Count > ActionCount) { ProcessRound(street, aquiredPlayer[street], _convertedHand[playerIndex]); } } } }
private void ParseStreets() { foreach (Match m in GetMatch(streetsFile, @"[0-9]*\s*([0-9А-Яа-я\-]*),\s*([А-Яа-я]*)\.")) { Streets.Add($"{m.Groups[1]} {m.Groups[2]}"); } }
public async Task <IActionResult> PutDot([FromRoute] int id, [FromBody] Streets street) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != street.id) { return(BadRequest()); } _context.Entry(street).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!streetExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void MakeStreet(CellData crossingPoint, int length, bool vertical, double momentum, int color) { var degrees = vertical ? new[] { 90, 270 } : new[] { 0, 180 }; var angle = degrees[Random.Next(0, 2)]; if (Random.NextDouble() > 0.7) { angle += Random.Next(-10, -10); } var street = GetLine(crossingPoint, GetPointAtDistanceOnAngle(crossingPoint, length, angle)); foreach (var cell in street) { cell.SetTile(Road, color); } Streets.Add(street); momentum *= Random.NextDouble() + 1f; length = (int)((length * Random.NextDouble()) + 1f); if (momentum > 0.1f) { for (int i = (int)Math.Ceiling(length / 3f); i < street.Count; i++) { if (Random.NextDouble() > 0.9) { MakeStreet(street[i], length, !vertical, momentum, color); i += 5; } } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Country,City,Region,NameStreen")] Streets streets) { if (id != streets.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(streets); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StreetsExists(streets.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(streets)); }
public bool Equals(PhysicalAddress other) { return(Streets.ListsAreEqual(other.Streets) && string.Equals(City, other.City) && string.Equals(State, other.State) && string.Equals(PostalCode, other.PostalCode) && string.Equals(Country, other.Country)); }
public void UpdateStreet(Streets streets) { if (ValidationStreets(streets) == false) { return; } _streetsRepository.Update(streets); }
public void AddStreet(Streets streets) { if (ValidationStreets(streets) == false) { return; } _streetsRepository.InsertMany(streets); }
private bool ValidationStreets(Streets streets) { if (streets.Name == null) { return(false); } return(true); }
public HeroCheckOrBetSetStatistics( IPercentagesCalculator percentagesCalculator, IEnumerable <IActionSequenceStatistic> statistics, string playerName, Streets street, bool inPosition) : base(percentagesCalculator, statistics, playerName, street, ActionSequences.HeroActs, inPosition) { }
protected virtual IActionSequenceStatisticsSet NewHeroCheckOrBetSetStatistics( IPercentagesCalculator percentagesCalculator, IEnumerable <IActionSequenceStatistic> statistics, string playerName, Streets street, bool inPosition) { return(new HeroCheckOrBetSetStatistics(percentagesCalculator, statistics, playerName, street, inPosition)); }
protected override IActionSequenceStatisticsSet NewHeroCheckOrBetSetStatistics( IPercentagesCalculator percentagesCalculator, IEnumerable <IActionSequenceStatistic> statistics, string playerName, Streets street, bool inPosition) { return(_stub.Out <IActionSequenceStatisticsSet>()); }
public IPostFlopStatisticsSetsViewModel InitializeWith(Streets street) { _street = street; InitializeStatisticsSetSummaryViewModels(); RegisterEvents(); return(this); }
private void BuildRoads() { var topology = new Topology(this); var roads = new List <List <Vector2> > (); var streets = new List <List <Vector2> > (); foreach (var gate in Gates.ToList()) { var endPoint = Market.Shape.Vertices.OrderBy(v => (gate - v).magnitude).First(); var street = topology.BuildPath(gate, endPoint, topology.Outer); if (street != null) { //roads.Add(street); streets.Add(street); if (CityWall.Gates.Contains(gate)) { var direction = GeometryHelpers.Scale(gate - Center, 100000); var start = topology.Node2V.Values.OrderBy(v => (v - direction).magnitude).First(); var road = topology.BuildPath(start, gate, topology.Inner); if (road == null) { CityWall.Gates.Remove(gate); CityWall.Towers.Add(gate); Gates.Remove(gate); } else { roads.Add(road); } } } } if (!roads.Any()) { throw new InvalidOperationException("No roads into the town"); } Roads.AddRange(TidyUpRoads(roads)); Streets.AddRange(TidyUpRoads(streets)); foreach (var road in Roads) { var insideVertices = road.Where(rv => Patches.Where(p => p.Shape.ContainsPoint(rv)).All(p => p.WithinCity)).Except(Gates).ToList(); foreach (var insideVertex in insideVertices) { road.Remove(insideVertex); } } }
public async Task <IActionResult> Create([Bind("Id,Country,City,Region,NameStreen")] Streets streets) { if (ModelState.IsValid) { _context.Add(streets); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(streets)); }
void OnSelectedDistrictChanged() { if (_selectedDistrict != null) { var data = core.GetStreetsByDistrict(SelectedDistrict.Id); foreach (var item in data) { Streets.Add(item); } } }
static Streets[] CreateStreets(int n) { Streets[] streets = new Streets[n]; for (int i = 0; i < n; i++) { streets[i] = new Streets(); streets[i].Name = RandomName(); streets[i].Houses = CreateRandomArray(); } return(streets); }
public async Task <IActionResult> PostStreet([FromBody] Streets street) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.streets.Add(street); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStreet", new { id = street.id }, street)); }
public override int GetHashCode() { unchecked { var hashCode = (Streets != null ? Streets.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); return(hashCode); } }
protected ActionSequenceStatistic(ActionSequences actionSequence, Streets street, int indexesCount) { _actionSequence = actionSequence; _street = street; Percentages = new int[indexesCount]; MatchingPlayers = new List <IAnalyzablePokerPlayer> [indexesCount]; for (int i = 0; i < MatchingPlayers.Length; i++) { MatchingPlayers[i] = new List <IAnalyzablePokerPlayer>(); } }
/// <summary> /// Describes the situation defined by the passed parameters to /// give the user feedback about what a statistics table depicts. /// </summary> /// <param name="playerName"></param> /// <param name="analyzablePokerPlayer">A sample player from the statistics set</param> /// <param name="street">Should always be preflop</param> /// <param name="ratioSizes">In this case is used to describe the range of strategic positions in which the player acted</param> /// <returns>A nice description of the situation depicted by the parameters</returns> public string Describe( string playerName, IAnalyzablePokerPlayer analyzablePokerPlayer, Streets street, ITuple <StrategicPositions, StrategicPositions> ratioSizes) { return(string.Format("{0} was sitting {1}, {2} {3} in {4} and was raised.", playerName, DescribePositions(ratioSizes), DescribeAction(analyzablePokerPlayer, street), street.ToString().ToLower(), StatisticsDescriberUtils.DescribePot(analyzablePokerPlayer, street))); }
private void button_Click(object sender, RoutedEventArgs e) { IPAddress ip = IPAddress.Parse("127.0.0.1"); IPEndPoint ep = new IPEndPoint(ip, 1024); Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); try { s.Connect(ep); if (s.Connected) { //string str = textBox.Text; Streets street = new Streets(); street.index = int.Parse(textBox.Text); //вводим индекс для поиска var JsonStreet = JsonConvert.SerializeObject(street); //серриолизуем в джейсон s.Send(Encoding.ASCII.GetBytes(JsonStreet)); //кодируем сообщение в байтовый массив //s.Send(Encoding.UTF8.GetBytes(str)); byte[] buffer = new byte[1024]; int i; do { i = s.Receive(buffer);//принимаем сообщение string jasonRes = Encoding.ASCII.GetString(buffer); List <Streets> res = JsonConvert.DeserializeObject <List <Streets> >(jasonRes); foreach (var item in res) { listView.Items.Add(item.name); } i = 0;// иначе выводит результат 2 раза } while (i > 0); } else { MessageBox.Show("Error"); } } catch (SocketException ex) { MessageBox.Show(ex.Message); } finally { s.Shutdown(SocketShutdown.Both); s.Close(); } }
internal static void ParseSitus() { var city_list = @"FRESNO,CLOVIS,COALINGA,KINGSBURG,KERMAN,SELMA,FOWLER,SANGER,PARLIER,BIOLA,REEDLEY,DINKEY CREEK,PIEDRA,PINEDALE,PINEHURST,HIGHWAY CITY,DEL REY,HURON,AUBERRY,ORANGE COVE,SAN JOAQUIN,TRANQUILLITY,FIREBAUGH,DINUBA,DOS PALOS,RIVERDALE,MENDOTA,EASTON,SQUAW VALLEY,CARUTHERS,SHAVER LAKE,LATON,PRATHER,HUME LAKE,MALAGA,FRIANT,FIVE POINTS,TOLLHOUSE,RAISIN CITY,MIRAMONTE,CANTUA CREEK,HERNDON,BURRELL,MINERAL,HELM,BIG CREEK,DUNLAP,DUNBAR,HUNTINGTON LA".Split(','); city_list.ToList().ForEach(p => Cities.Add(p, Cities.Keys.Count + 1)); var situs = File.ReadAllLines(@"Data/situs.txt"); var records = new List <AddressRecord> { }; foreach (var line in situs) { if (line.StartsWith("PAGE:")) { continue; } (string prefix, int city_id, string suffix) = ParseLine(line); if (city_id == 0) { msg($"[!] -- no city in: {line}"); continue; } var parts = suffix.Split(' '); // "W" "E" etc prefixes are after the city name: if (!Char.IsDigit(parts[0][0])) { prefix = $"{parts[0][0]} {prefix}"; parts = parts.Skip(1).ToArray(); } if (!Streets.ContainsKey(prefix)) { Streets.Add(prefix, Streets.Keys.Count + 1); } records.Add(new AddressRecord { cityname_id = city_id, streetname_id = Streets[prefix], street_address = parts[0], apn_code = parts[1] }); } AddressRecords = records.ToArray(); Save(); }
public void ProcessRound_PokerPlayerWithNoRound_DoesNotReThrowNullReferenceException( [Values(Streets.PreFlop, Streets.Flop, Streets.Turn, Streets.River)] Streets street) { var convertedPlayer = new ConvertedPokerPlayer(); IAquiredPokerRound aquiredRound = new AquiredPokerRound() .Add(new AquiredPokerAction(_stub.Valid(For.ActionType, ActionTypes.C), _stub.Some <double>())); // Logs the exception and goes on TestDelegate invokeProcessRound = () => NotLogged(() => _converter.InvokeProcessRound(street, aquiredRound, convertedPlayer)); Assert.DoesNotThrow(invokeProcessRound); }
/// <summary> /// Initializes a new instance of the <see cref="ActionSequenceStatisticsSet"/> class. /// Creates instance of ActionSequenceStatisticsSet. /// Use for PostFlop Statistics only /// </summary> /// <param name="percentagesCalculator"> /// </param> /// <param name="statistics"> /// </param> /// <param name="playerName"> /// <see cref="IActionSequenceStatisticsSet.PlayerName"/> /// </param> /// <param name="street"> /// <see cref="IActionSequenceStatisticsSet.Street"/> /// </param> /// <param name="actionSequence"> /// <see cref="IActionSequenceStatisticsSet.ActionSequence"/> /// </param> /// <param name="inPosition"> /// <see cref="IActionSequenceStatisticsSet.InPosition"/> /// </param> public ActionSequenceStatisticsSet( IPercentagesCalculator percentagesCalculator, IEnumerable <IActionSequenceStatistic> statistics, string playerName, Streets street, ActionSequences actionSequence, bool inPosition) { _percentagesCalculator = percentagesCalculator; _statistics = statistics; ActionSequence = actionSequence; PlayerName = playerName; Street = street; InPosition = inPosition; }